ADTF  3.18.3
element.h
Go to the documentation of this file.
1 
14 #ifndef ELEMENT_HEADER
15 #define ELEMENT_HEADER
16 
17 #include <a_util/result.h>
18 #include <ddl/dd/dd.h>
20 
21 #include <map>
22 
23 namespace ddl {
24 namespace mapping {
25 
26 #if defined(__GNUC__) && (__GNUC__ == 5) && defined(__QNX__)
27 #pragma GCC diagnostic ignored \
28  "-Wattributes" // standard type attributes are ignored when used in templates
29 #endif
30 
32 typedef std::map<std::string, uint8_t> TypeMap;
33 
34 #if defined(__GNUC__) && (__GNUC__ == 5) && defined(__QNX__)
35 #pragma GCC diagnostic warning \
36  "-Wattributes" // standard type attributes are ignored when used in templates
37 #endif
38 
40 enum DataTypes {
41  e_uint8 = 1,
42  e_uint16,
43  e_uint32,
44  e_uint64,
45  e_int8,
46  e_int16,
47  e_int32,
48  e_int64,
49  e_float32,
50  e_float64,
51  e_bool,
52  e_char,
53 };
54 
55 namespace rt {
56 class Target;
57 
60 public:
66 
71 
80  a_util::result::Result create(void* element_ptr,
81  const ddl::dd::StructElementAccess& element_access,
82  const size_t array_size,
83  const std::string& element_name);
84 
92 
98  a_util::result::Result setDefaultValue(const std::string& default_value);
99 
107  a_util::result::Result setValue(const void* data, uint32_t src_type, size_t mem_size);
108 
114 
115 private:
117  Target* _target;
118  void* _element_ptr;
119  TypeMap _type_map;
120  uint32_t _type_int;
121  ddl::dd::StructElementAccess _element_access;
122  size_t _array_size;
123  const MapTransformationBase* _transformation;
124  // For Debug only
125  std::string _element_name;
127 };
128 
133 typedef std::vector<TargetElement*> TargetElementList;
134 
135 } // namespace rt
136 } // namespace mapping
137 } // namespace ddl
138 #endif // ELEMENT_HEADER
A common result class usable as return value throughout.
Class to access and obtain the byte position and other information of a instance of this element with...
cMapTransformation forms a base class for a single transformation
TargetElement represents a single signal element in the target.
Definition: element.h:59
a_util::result::Result setTransformation(const MapTransformationBase *transformation)
Setter for transformation Write constant from Mapping or default value from DataDefinition or 0.
TargetElement(Target *target)
CTOR.
a_util::result::Result setValue(const void *data, uint32_t src_type, size_t mem_size)
Setter value to the element.
a_util::result::Result create(void *element_ptr, const ddl::dd::StructElementAccess &element_access, const size_t array_size, const std::string &element_name)
Creation method to initialize the object.
a_util::result::Result setDefaultValue(const std::string &default_value)
Method to give a default value to the element.
Target * getTarget()
Getter for the parent target reference.
Target represents a mapped target signal in the runtime api.
Definition: target.h:34
OO DataDefinition - Data Definition.
std::vector< TargetElement * > TargetElementList
the targets element list
Definition: element.h:133
std::map< std::string, uint8_t > TypeMap
String -> Datatype Enum Map.
Definition: element.h:32
DataTypes
Enum for all relevant data types.
Definition: element.h:40
Common include for component a_util::result.