Dev Essential  1.6.3
Loading...
Searching...
No Matches
source.h
Go to the documentation of this file.
1
14
15#ifndef DDL_MAPPING_RT_SOURCE_HEADER
16#define DDL_MAPPING_RT_SOURCE_HEADER
17
18#include <a_util/result.h>
23
24#include <memory>
25
26namespace ddl {
27namespace mapping {
28namespace rt {
30struct AssignmentStruct {
31 size_t buffer_size;
32 uint32_t type32;
33 uintptr_t element_ptr_offset;
34
35 AssignmentStruct() : buffer_size(0), type32(0), element_ptr_offset(static_cast<uintptr_t>(-1))
36 {
37 }
38
39 bool operator==(const AssignmentStruct& other) const
40 {
41 return (element_ptr_offset == other.element_ptr_offset);
42 }
43};
45
46} // namespace rt
47} // namespace mapping
48} // namespace ddl
49
50namespace ddl {
51namespace mapping {
52namespace rt {
53class TriggerBase;
54class Target;
55class TargetElement;
60class Source : public ISignalListener {
61public: // types
62#if defined(__GNUC__) && (__GNUC__ == 5) && defined(__QNX__)
63#pragma GCC diagnostic ignored \
64 "-Wattributes" // standard type attributes are ignored when used in templates
65#endif
66
67 // Map of source elements and a vector of target elements
69 typedef std::vector<std::pair<AssignmentStruct, TargetElementList>> Assignments;
70 typedef std::vector<std::pair<TriggerBase*, AssignmentStruct>> Triggers;
71 typedef std::vector<uint8_t> MemoryBuffer;
72 typedef std::set<const Target*> TargetRefList;
74
75#if defined(__GNUC__) && (__GNUC__ == 5) && defined(__QNX__)
76#pragma GCC diagnostic warning \
77 "-Wattributes" // standard type attributes are ignored when used in templates
78#endif
79
80public:
86
90 Source(const Source&) = delete;
91
96 Source& operator=(const Source&) = delete;
97
102
111 const std::string& type_description);
112
121 const std::string& source_element,
122 TargetElement* target_element);
123
131
138
143 const std::string& getTypeName() const;
144
149 const Assignments& getAssigmentList() const;
150
157 a_util::result::Result onSampleReceived(const void* data, size_t size);
158
159private:
161 handle_t _handle;
162 std::string _name;
163 std::string _type_name;
164 std::string _type_description;
165 Assignments _assignments;
166 TargetRefList _targets;
167 std::unique_ptr<ddl::codec::CodecFactory> _codec_factory;
168 TypeMap _type_map;
169 TargetElementList _received_elements;
170 Triggers _triggers;
171};
172
174typedef std::map<std::string, Source*> SourceMap;
175
176} // namespace rt
177} // namespace mapping
178} // namespace ddl
179
180#endif // DDL_MAPPING_RT_SOURCE_HEADER
Definition result_type_decl.h:34
Definition map_configuration.h:36
Definition map_source.h:31
Definition mapping_environment_intf.h:56
Signal listener interface class.
Definition mapping_environment_intf.h:23
a_util::result::Result addTrigger(const MapConfiguration &map_config, TriggerBase *trigger)
a_util::result::Result removeAssignmentsFor(const Target *target)
Source(const Source &)=delete
no copy CTOR
Source & operator=(const Source &)=delete
no copy assignment operator
a_util::result::Result create(const mapping::MapSource &map_source, const std::string &type_description)
a_util::result::Result onSampleReceived(const void *data, size_t size)
const std::string & getTypeName() const
a_util::result::Result addAssignment(const ddl::mapping::MapConfiguration &map_config, const std::string &source_element, TargetElement *target_element)
Source(IMappingEnvironment &env)
const Assignments & getAssigmentList() const
TargetElement represents a single signal element in the target.
Definition element.h:59
Target represents a mapped target signal in the runtime api.
Definition target.h:34
base class representing a trigger
Definition trigger.h:24
void * handle_t
Type of a handle value.
Definition types.h:27
bool operator==(const Date &lhs, const Date &rhs)
definition of the rt namespace for mapping
Definition ddl.h:59
std::vector< TargetElement * > TargetElementList
the targets element list
Definition element.h:133
std::map< std::string, Source * > SourceMap
Public composite types used in the mapping::rt namespace.
Definition source.h:174
definition of the mapping namespace
Definition ddl.h:50
std::map< std::string, uint8_t > TypeMap
String -> Datatype Enum Map.
Definition element.h:32
definition of the ddl namespace
Definition codec.h:21