ADTF  3.18.2
map_trigger.h
Go to the documentation of this file.
1 
14 #ifndef HEADER_MAP_TRIGGER_H
15 #define HEADER_MAP_TRIGGER_H
16 
17 #include <a_util/result.h>
18 #include <a_util/xml.h>
19 
20 #include <string>
21 #include <vector>
22 
23 namespace ddl {
24 namespace mapping {
25 class MapConfiguration;
30 public:
35 
39  virtual ~MapTriggerBase();
40 
44  bool isValid() const;
45 
49  virtual std::string getSourceDependency() const;
50 
54  virtual bool isEqual(const MapTriggerBase& other) const = 0;
55 
60  bool checkValidity();
61 
68 
69 protected:
73  virtual MapTriggerBase* clone() const = 0;
74 
75 private:
85  const a_util::xml::DOMElement& dom_element,
86  MapTriggerBase*& destination);
87 
95 
100  a_util::result::Result setSourceDependency(const std::string& new_name);
101 
102 protected:
104  friend class MapConfiguration;
105  friend class MapTarget;
106  MapConfiguration* _config;
107  bool _is_valid;
109 };
110 
113 public:
119 
123  double getPeriod() const;
124 
130  a_util::result::Result setPeriod(const std::string& period, const std::string& unit);
131 
137  bool isEqual(const MapTriggerBase& other) const;
138 
139 protected:
140  // implements MapTriggerBase
142 
143 private:
151 
159 
160 private:
162  friend class MapTriggerBase;
163  double _period;
165 };
166 
169 public:
175 
179  virtual std::string getSourceDependency() const;
180 
184  const std::string& getVariable() const;
185 
192  a_util::result::Result setVariable(const std::string& signal_name);
193 
199  bool isEqual(const MapTriggerBase& other) const;
200 
201 protected:
202  // implements MapTriggerBase
204 
205 private:
213 
221 
228  a_util::result::Result setVariableNoTypeCheck(const std::string& signal_name);
229 
230 private:
232  friend class MapConfiguration;
233  friend class MapTriggerBase;
234  std::string _variable;
235  bool _is_valid;
237 };
238 
241 public:
247 
252  virtual std::string getSourceDependency() const;
253 
258  const std::string& getVariable() const;
259 
263  const std::string& getSource() const;
264 
268  const std::string& getOperator() const;
269 
273  double getValue() const;
274 
284  a_util::result::Result setComparison(const std::string& source_element_path,
285  const std::string& comp_operator,
286  const std::string& value);
287 
293  bool isEqual(const MapTriggerBase& other) const;
294 
295 protected: // implements MapTriggerBase
297 
298 private:
306 
314 
323  a_util::result::Result setComparisonNoTypeCheck(const std::string& source_element_path,
324  const std::string& comp_operator,
325  const std::string& value);
326 
332  a_util::result::Result setSourceNoTypeCheck(const std::string& source);
333 
334 private:
336  friend class MapConfiguration;
337  friend class MapTriggerBase;
338  std::string _variable;
339  std::string _source;
340  std::string _operator;
341  double _value;
343 };
344 
346 typedef std::vector<MapTriggerBase*> MapTriggerList;
347 
348 } // namespace mapping
349 } // namespace ddl
350 
351 #endif // HEADER_MAP_TRIGGER_H
A common result class usable as return value throughout.
MapConfiguration is the central class of the mapping::dd namespace.
implementation of a data trigger in the configuration api
Definition: map_trigger.h:240
const std::string & getVariable() const
Returns the variable to compare.
a_util::result::Result setComparisonNoTypeCheck(const std::string &source_element_path, const std::string &comp_operator, const std::string &value)
Set the comparison.
virtual std::string getSourceDependency() const
Overrides MapTriggerBase.
bool isEqual(const MapTriggerBase &other) const
Polymorphic comparison method (impl.
const std::string & getOperator() const
Returns the operator for the comparison.
MapTriggerBase * clone() const
Polymorphic clone method.
a_util::result::Result loadFromDom(const a_util::xml::DOMElement &trigger_element)
creates a trigger instance from a trigger-dom element
const std::string & getSource() const
Returns the source signal.
double getValue() const
Returns the value to compare to.
a_util::result::Result setSourceNoTypeCheck(const std::string &source)
Set the source.
MapDataTrigger(MapConfiguration *config)
CTOR.
a_util::result::Result setComparison(const std::string &source_element_path, const std::string &comp_operator, const std::string &value)
Set the comparison.
a_util::result::Result writeToDOM(a_util::xml::DOMElement &dom_element) const
Export trigger to a XML dom element.
implementation of a periodic trigger in the configuration api
Definition: map_trigger.h:112
MapPeriodicTrigger(MapConfiguration *config)
CTOR.
bool isEqual(const MapTriggerBase &other) const
Polymorphic comparison method (impl.
a_util::result::Result setPeriod(const std::string &period, const std::string &unit)
Set the period.
MapTriggerBase * clone() const
Polymorphic clone method.
a_util::result::Result loadFromDom(const a_util::xml::DOMElement &dom_element)
creates a trigger instance from a trigger-dom element
double getPeriod() const
Returns the period of the trigger in ms.
a_util::result::Result writeToDOM(a_util::xml::DOMElement &dom_element) const
Export trigger to a XML dom element.
implementation of a signal trigger in the configuration api
Definition: map_trigger.h:168
MapSignalTrigger(MapConfiguration *config)
CTOR.
const std::string & getVariable() const
Returns the source signal.
a_util::result::Result setVariableNoTypeCheck(const std::string &signal_name)
Set the source signal.
virtual std::string getSourceDependency() const
Overrides MapTriggerBase.
bool isEqual(const MapTriggerBase &other) const
Polymorphic comparison method (impl.
MapTriggerBase * clone() const
Polymorphic clone method.
a_util::result::Result loadFromDom(const a_util::xml::DOMElement &dom_element)
creates a trigger instance from a trigger-dom element
a_util::result::Result setVariable(const std::string &signal_name)
Set the source signal.
a_util::result::Result writeToDOM(a_util::xml::DOMElement &dom_element) const
Export trigger to a XML dom element.
MapTarget represents a mapped target from the mapping configuration.
Definition: map_target.h:31
cMapTrigger forms a base class for a trigger contained in the configuration
Definition: map_trigger.h:29
virtual bool isEqual(const MapTriggerBase &other) const =0
Polymorphic comparison method.
a_util::result::Result checkTriggerReferences() const
Checks the configuration for consistency of a new trigger.
static a_util::result::Result createFromDOM(MapConfiguration *config, const a_util::xml::DOMElement &dom_element, MapTriggerBase *&destination)
creates a polymorphic trigger instance from a trigger-dom element
virtual std::string getSourceDependency() const
returns an optional dependency on a source name
bool isValid() const
Returns the validity for the current description.
virtual MapTriggerBase * clone() const =0
Polymorphic clone method.
a_util::result::Result setSourceDependency(const std::string &new_name)
Change name for source signal.
virtual ~MapTriggerBase()
DTOR.
MapTriggerBase(MapConfiguration *config)
CTOR.
bool checkValidity()
Check Trigger validity and set validity flag.
a_util::result::Result writeToDOM(a_util::xml::DOMElement &dom_element) const
Export trigger to a XML dom element.
@ unit
the unit is a unit (Unit)
std::vector< MapTriggerBase * > MapTriggerList
Public composite types used in the mapping::dd namespace.
Definition: map_trigger.h:346
Common include for component a_util::result.
Common include for component a_util::xml.