ADTF  3.18.2
map_assignment.h
Go to the documentation of this file.
1 
14 #ifndef HEADER_MAP_ASSIGNMENT_H
15 #define HEADER_MAP_ASSIGNMENT_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 {
29 typedef std::vector<std::string> MapErrorList;
34 public:
39 
44  MapAssignment(std::string to);
45 
49  bool isValid() const;
50 
55  const std::string& getFrom() const;
56 
60  const std::string& getSource() const;
61 
69  a_util::result::Result connect(const std::string& source_element_path);
70 
74  const std::string& getConstant() const;
75 
82  a_util::result::Result setConstant(const std::string& constant);
83 
87  const std::string& getFunction() const;
88 
94 
103 
110  a_util::result::Result setReceivedFunction(const std::string& source);
111 
115  const std::string& getModulo() const;
116 
120  const std::string& getTo() const;
121 
125  const std::string& getTransformation() const;
126 
133  a_util::result::Result setTransformation(const std::string& transformation_name);
134 
140 
141 private:
150  MapErrorList& errors);
151 
159 
160 private:
162  friend class MapConfiguration;
163  friend class MapTarget;
164  std::string _from;
165  std::string _source;
166  std::string _constant;
167  std::string _function; // "simulation_time" -> no args, "trigger_counter" -> arg in modulo,
168  // "received" -> arg in from
169  std::string _modulo;
170  std::string _to;
171  std::string _transform;
172  bool _is_valid;
174 };
175 
184 inline bool operator==(const MapAssignment& a, const MapAssignment& b)
185 {
186  return a.getConstant() == b.getConstant() && a.getFrom() == b.getFrom() &&
187  a.getSource() == b.getSource() && a.getTo() == b.getTo() &&
188  a.getFunction() == b.getFunction() && a.getModulo() == b.getModulo() &&
190 }
199 inline bool operator!=(const MapAssignment& a, const MapAssignment& b)
200 {
201  return !(a == b);
202 }
203 
205 typedef std::vector<MapAssignment> MapAssignmentList;
206 
207 } // namespace mapping
208 } // namespace ddl
209 
210 #endif // HEADER_MAP_ASSIGNMENT_H
A common result class usable as return value throughout.
const std::string & getTransformation() const
Returns the associated transformation of this assignment (or an empty string)
a_util::result::Result setConstant(const std::string &constant)
Setter for the constant of the assignment.
const std::string & getFunction() const
Returns the constant of the assignment (or an empty string)
const std::string & getFrom() const
Returns the source element name of the assignment (or an empty string)
a_util::result::Result removeTransformation()
Remove the transformation from this assignment.
bool isValid() const
Returns the validity for the current description.
MapAssignment(std::string to)
CTOR.
const std::string & getTo() const
Returns the name of the target element that is assigned.
a_util::result::Result setTransformation(const std::string &transformation_name)
Associates the transformation to this assignment.
const std::string & getConstant() const
Returns the constant of the assignment (or an empty string)
const std::string & getModulo() const
Returns the constant of the assignment (or an empty string)
const std::string & getSource() const
Returns the source name of the assignment (or an empty string)
a_util::result::Result setTriggerCounterFunction(const std::string &modulo)
Setter for the TriggerCounter assignment.
a_util::result::Result connect(const std::string &source_element_path)
Connects the target element or signal with a source.
a_util::result::Result loadFromDOM(const a_util::xml::DOMElement &assignment, MapErrorList &errors)
Initializes the assignment from a assignment-dom element.
a_util::result::Result setReceivedFunction(const std::string &source)
Setter for the Received assignment.
a_util::result::Result setSimulationTimeFunction()
Setter for the SimulationTime assignment.
a_util::result::Result writeToDOM(a_util::xml::DOMElement &dom_element) const
Export assignment to a XML dom element.
MapConfiguration is the central class of the mapping::dd namespace.
MapTarget represents a mapped target from the mapping configuration.
Definition: map_target.h:31
std::vector< std::string > MapErrorList
container type for mapping errors
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
Common include for component a_util::result.
Common include for component a_util::xml.