Dev Essential
Loading...
Searching...
No Matches
map_assignment.h
Go to the documentation of this file.
1
13
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
23namespace ddl {
24namespace mapping {
29typedef std::vector<std::string> MapErrorList;
34public:
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
141private:
149 a_util::result::Result loadFromDOM(const a_util::xml::DOMElement& assignment,
150 MapErrorList& errors);
151
158 a_util::result::Result writeToDOM(a_util::xml::DOMElement& dom_element) const;
159
160private:
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
184inline 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}
191
199inline bool operator!=(const MapAssignment& a, const MapAssignment& b)
200{
201 return !(a == b);
202}
203
205typedef std::vector<MapAssignment> MapAssignmentList;
206
207} // namespace mapping
208} // namespace ddl
209
210#endif // HEADER_MAP_ASSIGNMENT_H
Definition result_type_decl.h:34
Representation for an element in the DOM.
Definition dom.h:47
Definition map_assignment.h:33
a_util::result::Result setTransformation(const std::string &transformation_name)
const std::string & getModulo() const
const std::string & getFunction() const
a_util::result::Result setSimulationTimeFunction()
MapAssignment(std::string to)
a_util::result::Result removeTransformation()
const std::string & getSource() const
const std::string & getFrom() const
a_util::result::Result setTriggerCounterFunction(const std::string &modulo)
a_util::result::Result setReceivedFunction(const std::string &source)
const std::string & getTransformation() const
const std::string & getTo() const
a_util::result::Result connect(const std::string &source_element_path)
a_util::result::Result setConstant(const std::string &constant)
const std::string & getConstant() const
Definition map_configuration.h:36
Definition map_target.h:31
definition of the mapping namespace
Definition ddl.h:50
std::vector< std::string > MapErrorList
container type for mapping errors
Definition map_assignment.h:29
bool operator==(const MapAssignment &a, const MapAssignment &b)
compares the Assignments
Definition map_assignment.h:184
bool operator!=(const MapAssignment &a, const MapAssignment &b)
compares the Assignments
Definition map_assignment.h:199
std::vector< MapAssignment > MapAssignmentList
Public composite types used in the mapping::dd namespace.
Definition map_assignment.h:205
definition of the ddl namespace
Definition codec.h:21