ADTF  3.18.2
map_target.h
Go to the documentation of this file.
1 
14 #ifndef HEADER_MAP_TARGET_H
15 #define HEADER_MAP_TARGET_H
16 
17 #include <a_util/result.h>
18 #include <a_util/xml.h>
22 
23 namespace ddl {
24 namespace mapping {
25 
26 class MapConfiguration;
27 
31 class MapTarget {
32 public:
37 
44  MapTarget(MapConfiguration* config, std::string name, std::string type);
45 
50 
54  MapTarget(const MapTarget& other);
55 
61  MapTarget& operator=(const MapTarget& other);
62 
67  const std::string& getName() const;
68 
76  a_util::result::Result setName(const std::string& name);
77 
82  const std::string& getType() const;
83 
92  a_util::result::Result setType(const std::string& type);
93 
98  bool isValid() const;
99 
110 
117  a_util::result::Result removeAssignment(const std::string& element_name);
118 
123 
134 
142 
147 
152 
153 private:
161 
169 
176 
184 
191  a_util::result::Result removeAssignmentWithoutClear(const std::string& element_name);
192 
199 
206  a_util::result::Result modifySourceName(const std::string& name, const std::string& new_name);
207 
211  void swap(MapTarget& other);
212 
213 private:
215  friend class MapConfiguration;
216  friend class MapSource;
217  MapConfiguration* _config;
218  std::string _name;
219  std::string _type_name;
220  MapSourceNameList _sources;
221  MapAssignmentList _assignments;
222  MapTriggerList _triggers;
223  bool _is_valid;
225 };
226 
235 bool operator==(const MapTarget& a, const MapTarget& b);
236 
245 inline bool operator!=(const MapTarget& a, const MapTarget& b)
246 {
247  return !(a == b);
248 }
249 
251 typedef std::vector<MapTarget> MapTargetList;
252 
253 } // namespace mapping
254 } // namespace ddl
255 
256 #endif // HEADER_MAP_TARGET_H
A common result class usable as return value throughout.
MapConfiguration is the central class of the mapping::dd namespace.
MapSource represents a mapping source from the configuration file.
Definition: map_source.h:31
MapTarget represents a mapped target from the mapping configuration.
Definition: map_target.h:31
const std::string & getType() const
Returns the DataDefinition typename of the mapped target.
a_util::result::Result addTriggerNoTypeCheck(MapTriggerBase *trigger)
Add a trigger to this target.
a_util::result::Result addAssignment(const MapAssignment &assignment)
Add an assignment.
a_util::result::Result loadFromDOM(const a_util::xml::DOMElement &target)
Initializes the target from a target-dom element.
const MapTriggerList & getTriggerList() const
Returns all triggers configured for this target.
a_util::result::Result checkDoubleAssignments()
Checks if the assignments overlap.
a_util::result::Result setType(const std::string &type)
Set type.
a_util::result::Result removeTrigger(MapTriggerBase *trigger)
Remove a trigger.
MapTarget(const MapTarget &other)
CCTOR.
void swap(MapTarget &other)
swap implementation
bool isValid() const
Returns the validity for the current description.
a_util::result::Result setName(const std::string &name)
Set name.
const std::string & getName() const
Returns the name of the mapped target.
const MapSourceNameList & getReferencedSources() const
Returns all referenced sources for this target.
const MapAssignmentList & getAssignmentList() const
Returns all assignments configured for this target.
MapTarget(MapConfiguration *config)
CTOR.
a_util::result::Result removeAssignmentWithoutClear(const std::string &element_name)
Remove an assignment from this target.
a_util::result::Result modifySourceName(const std::string &name, const std::string &new_name)
Modify a source signal name.
a_util::result::Result addTrigger(MapTriggerBase *trigger)
Add a trigger.
a_util::result::Result removeAssignment(const std::string &element_name)
Remove an assignment.
MapTarget(MapConfiguration *config, std::string name, std::string type)
CTOR.
a_util::result::Result addAssignmentNoTypeCheck(const MapAssignment &assignment)
Add an assignment to this target.
a_util::result::Result writeToDOM(a_util::xml::DOMElement &dom_element) const
Export target to a XML dom element.
MapTarget & operator=(const MapTarget &other)
Assignment operator.
cMapTrigger forms a base class for a trigger contained in the configuration
Definition: map_trigger.h:29
WRITER_TYPE & trigger(WRITER_TYPE &oWriter)
Global function template to trigger a writers sample stream manually.
std::vector< MapAssignment > MapAssignmentList
Public composite types used in the mapping::dd namespace.
bool operator==(const MapAssignment &a, const MapAssignment &b)
compares the Assignments
bool operator!=(const MapAssignment &a, const MapAssignment &b)
compares the Assignments
std::vector< MapTarget > MapTargetList
Public composite types used in the mapping::dd namespace.
Definition: map_target.h:251
std::vector< MapTriggerBase * > MapTriggerList
Public composite types used in the mapping::dd namespace.
Definition: map_trigger.h:346
std::set< std::string > MapSourceNameList
defintion of MapSource name list
Definition: map_source.h:139
Common include for component a_util::result.
Common include for component a_util::xml.