Dev Essential  1.6.3
Loading...
Searching...
No Matches
datamodel_configuration_items.h
Go to the documentation of this file.
1
20
21#ifndef MAPPING_CONFIGURATION_DATA_MODEL_ITEMS_HEADER
22#define MAPPING_CONFIGURATION_DATA_MODEL_ITEMS_HEADER
23
30
31#include <string>
32
33namespace ddl {
34namespace mapping {
35namespace datamodel {
36
41class Header : public ModelSubject<Header>, public InfoMap {
42public:
46 Header() = delete;
51 Header(const Header& other);
56 Header(Header&& other);
65 Header(const Version& mapping_version,
66 const std::string& author = {},
67 const std::string& date_creation = {},
68 const std::string& date_change = {},
69 const std::string& description = {});
74
80 Header& operator=(const Header& other);
87
94 bool operator==(const Header& other) const;
101 bool operator!=(const Header& other) const;
102
113 void setMappingVersion(const Version& mapping_version);
114
119 const std::string& getAuthor() const;
125 void setAuthor(const std::string& author);
126
131 const std::string& getDateCreation() const;
137 void setDateCreation(const std::string& date_creation);
138
143 const std::string& getDateChange() const;
149 void setDateChange(const std::string& date_change);
150
155 const std::string& getDescription() const;
161 void setDescription(const std::string& description);
162
163private:
164 // for internal use
165 class HeaderImpl;
166 std::unique_ptr<HeaderImpl> _impl;
167};
168
173class Property : public ddl::utility::TypeAccessMapSubject<Property>, public InfoMap {
174public:
178 Property() = delete;
183 Property(const Property& other);
194 Property(const std::string& name, const std::string& value);
199
212
219 bool operator==(const Property& other) const;
226 bool operator!=(const Property& other) const;
227
232 const std::string& getName() const;
238 void setName(const std::string& name);
239
244 const std::string& getValue() const;
250 void setValue(const std::string& value);
251
252private:
253 // for internal use
254 class PropertyImpl;
255 std::unique_ptr<PropertyImpl> _impl;
256};
257
262class Source : public ddl::utility::TypeAccessMapSubject<Source>, public InfoMap {
263public:
267 Source() = delete;
272 Source(const Source& other);
277 Source(Source&& other);
284 Source(const std::string& name,
285 const std::string& type,
286 const std::vector<Property>& properties = {});
291
297 Source& operator=(const Source& other);
304
311 bool operator==(const Source& other) const;
318 bool operator!=(const Source& other) const;
319
324 const std::string& getName() const;
330 void setName(const std::string& name);
331
336 const std::string& getType() const;
342 void setType(const std::string& type);
343
349 friend Properties;
351
355 const Properties& getProperties() const;
361
362private:
363 // for internal use
364 bool validateContains(const Properties::access_type& prop) const;
365 void notifyChangedMapContent(ddl::utility::TypeAccessMapEventCode code,
367 const std::string& additional_info);
368 class SourceImpl;
369 std::unique_ptr<SourceImpl> _impl;
370};
371
377public:
381 enum class Type {
397 };
398
403 struct Source {
407 std::string source_name;
408 };
409
414 struct Data {
418 std::string source_name;
422 std::string source_value_name;
426 std::string operation;
430 std::string value;
431 };
432
437 struct Period {
442 std::string time;
446 std::string unit;
447 };
448
452 Trigger() = delete;
457 Trigger(const Trigger& other);
462 Trigger(Trigger&& other);
485
491 Trigger& operator=(const Trigger& other);
498
505 bool operator==(const Trigger& other) const;
512 bool operator!=(const Trigger& other) const;
513
521 Type getType() const;
522
536
542 Data getData() const;
549 void setAsData(const Data& data);
550
564
568 static constexpr auto strategy_trigger = "trigger";
574 static constexpr auto strategy_first_in_config = "first_in_config";
578 static constexpr auto strategy_latest = "latest";
582 static constexpr auto strategy_earliest = "earliest";
583
587 const std::string& getTimeStrategy() const;
593 void setTimeStrategy(const std::string& time_strategy);
594
595private:
596 // for internal use
597 class TriggerImpl;
598 std::unique_ptr<TriggerImpl> _impl;
599};
600
608bool operator==(const Trigger::Source& left, const Trigger::Source& right);
616bool operator!=(const Trigger::Source& left, const Trigger::Source& right);
624bool operator==(const Trigger::Data& left, const Trigger::Data& right);
632bool operator!=(const Trigger::Data& left, const Trigger::Data& right);
640bool operator==(const Trigger::Period& left, const Trigger::Period& right);
648bool operator!=(const Trigger::Period& left, const Trigger::Period& right);
649
654class ParameterValue : public ddl::utility::TypeAccessListSubject<ParameterValue>, public InfoMap {
655public:
676
680 struct SourceValue {
684 std::string name;
688 std::string value_name;
689 };
690
694 struct ConstValue {
700 std::string value;
701 };
702
711 std::string name;
715 std::string value_name;
716 };
717
721 ParameterValue() = delete;
738 ParameterValue(const std::string& name, const SourceValue& source_value);
745 ParameterValue(const std::string& name, const ConstValue& const_value);
746
753 ParameterValue(const std::string& name, const InternalValue& internal_value);
758
771
778 bool operator==(const ParameterValue& other) const;
785 bool operator!=(const ParameterValue& other) const;
786
794 Type getType() const;
795
800 const std::string& getName() const;
806 void setName(const std::string& name);
807
821
835
849
850private:
851 // for internal use
852 class ParameterValueImpl;
853 std::unique_ptr<ParameterValueImpl> _impl;
854};
855
888
897 const ParameterValue::InternalValue& right);
906 const ParameterValue::InternalValue& right);
907
912class Assignment : public ddl::utility::TypeAccessListSubject<Assignment>, public InfoMap {
913public:
934
949 std::string function_name;
950 };
951
955 Assignment() = delete;
960 Assignment(const Assignment& other);
972 Assignment(const std::string& to_target_value_name, const SourceValue& from_source_value);
979 Assignment(const std::string& to_target_value_name, const ConstValue& from_const_value);
989 Assignment(const std::string& to_target_value_name,
990 const FunctionCall& from_module_call,
991 const std::vector<ParameterValue>& parameter_values = {});
996
1009
1016 bool operator==(const Assignment& other) const;
1023 bool operator!=(const Assignment& other) const;
1024
1032 Type getType() const;
1033
1038 const std::string& getTo() const;
1043 const std::string& getName() const;
1048 void setTo(const std::string& to);
1049
1062
1075
1099 void setAsFunctionCall(const FunctionCall& module_call,
1100 const std::vector<ParameterValue>& parameter_values);
1101
1107 friend ParameterValues;
1109
1119
1120private:
1121 // for internal use
1122 void notify(ddl::utility::TypeAccessListEventCode code_forward,
1123 const std::string& additional_info);
1124
1125 bool validateContains(const ParameterValues::access_type& prop) const;
1126 void notifyChangedListContent(ddl::utility::TypeAccessListEventCode code,
1127 ParameterValues::access_type& parameter_value,
1128 const std::string& additional_info);
1129
1130 class AssignmentImpl;
1131 std::unique_ptr<AssignmentImpl> _impl;
1132};
1133
1150
1155class Target : public ddl::utility::TypeAccessMapSubject<Target>, public InfoMap {
1156public:
1160 Target() = delete;
1165 Target(const Target& other);
1170 Target(Target&& other);
1177 Target(const std::string& name,
1178 const std::string& type,
1179 const std::vector<Property>& properties = {});
1184
1190 Target& operator=(const Target& other);
1197
1204 bool operator==(const Target& other) const;
1211 bool operator!=(const Target& other) const;
1212
1217 const std::string& getName() const;
1223 void setName(const std::string& name);
1224
1229 const std::string& getType() const;
1235 void setType(const std::string& type);
1236
1242 friend Properties;
1244
1254
1260 friend Triggers;
1262
1266 const Triggers& getTriggers() const;
1272
1278 friend Assignments;
1280
1290
1291private:
1292 // for internal use
1293 bool validateContains(const Properties::access_type& prop) const;
1294 void notifyChangedMapContent(ddl::utility::TypeAccessMapEventCode code,
1296 const std::string& additional_info);
1297 bool validateContains(const Triggers::access_type& prop) const;
1298 void notifyChangedVectorContent(ddl::utility::TypeAccessVectorEventCode code,
1299 Triggers::access_type& trigger,
1300 const std::string& additional_info);
1301
1302 bool validateContains(const Assignments::access_type& prop) const;
1303 void notifyChangedListContent(ddl::utility::TypeAccessListEventCode code,
1304 Assignments::access_type& assignment,
1305 const std::string& additional_info);
1306 class TargetImpl;
1307 std::unique_ptr<TargetImpl> _impl;
1308};
1309
1314class Function : public ddl::utility::TypeAccessMapSubject<Function>, public InfoMap {
1315public:
1319 Function() = delete;
1324 Function(const Function& other);
1336 Function(const std::string& name,
1337 const std::string& type,
1338 const std::vector<Property>& properties = {});
1343
1356
1363 bool operator==(const Function& other) const;
1370 bool operator!=(const Function& other) const;
1371
1376 const std::string& getName() const;
1382 void setName(const std::string& name);
1383
1388 const std::string& getType() const;
1394 void setType(const std::string& type);
1395
1401 friend Properties;
1403
1414
1415private:
1416 // for internal use
1417 bool validateContains(const Properties::access_type& prop) const;
1418 void notifyChangedMapContent(ddl::utility::TypeAccessMapEventCode code,
1420 const std::string& additional_info);
1421 class FunctionImpl;
1422 std::unique_ptr<FunctionImpl> _impl;
1423};
1424
1425} // namespace datamodel
1426} // namespace mapping
1427} // namespace ddl
1428
1429#endif // MAPPING_CONFIGURATION_DATA_MODEL_ITEMS_HEADER
DDL_TYPE_TO_ACCESS access_type
local definition of the access type
Definition access_list.h:90
Utility class for observable named items where the order is NOT important.
Definition access_map.h:79
DDL_TYPE_TO_ACCESS access_type
local definition of the access type
Definition access_map.h:82
Mapping Version.
Definition mapping_version.h:32
ParameterValue::ConstValue ConstValue
ConstValue type.
Definition datamodel_configuration_items.h:941
Assignment(const Assignment &other)
copy CTOR
bool operator==(const Assignment &other) const
equality operator
const std::string & getName() const
Get the name of the assignment value to assign to (the same as getTo)
Assignment & operator=(const Assignment &other)
copy operator
Type
the type of the assignment
Definition datamodel_configuration_items.h:917
@ const_value
The assignment is a const value assignment.
Definition datamodel_configuration_items.h:927
@ source_value
The assignment is a source value assignment.
Definition datamodel_configuration_items.h:922
@ function_call
The assignment is a function call assignment.
Definition datamodel_configuration_items.h:932
ParameterValue::SourceValue SourceValue
SourceValue type.
Definition datamodel_configuration_items.h:937
Assignment(const std::string &to_target_value_name, const ConstValue &from_const_value)
CTOR.
void setTo(const std::string &to)
Set the assignment value to assign to.
ConstValue getConstValue() const
Get the const value if type is set to Type::const_value.
ddl::utility::TypeAccessList< ParameterValue, Assignment > ParameterValues
ParameterValues type within Assignment.
Definition datamodel_configuration_items.h:1105
SourceValue getSourceValue() const
Get the source value if type is set to Type::source_value.
Assignment(Assignment &&other)
move CTOR
bool operator!=(const Assignment &other) const
inequality operator
void setAsFunctionCall(const FunctionCall &module_call, const std::vector< ParameterValue > &parameter_values)
Set as module call assignment and the parameters to use for the function.
Assignment(const std::string &to_target_value_name, const SourceValue &from_source_value)
CTOR.
FunctionCall getFunctionCall() const
Get the function call value if type is set to Type::function_call.
const ParameterValues & getParameterValues() const
Get the ParameterValues.
const std::string & getTo() const
Get the assignment value to assign to.
ParameterValues & getParameterValues()
Get the ParameterValues.
void setAsConstValue(const ConstValue &const_value)
Set as const value assignment.
void setAsFunctionCall(const FunctionCall &function_call)
Set as function call assignment.
Assignment(const std::string &to_target_value_name, const FunctionCall &from_module_call, const std::vector< ParameterValue > &parameter_values={})
CTOR.
Assignment & operator=(Assignment &&other)
move operator
void setAsSourceValue(const SourceValue &source_value)
Set as source value assignment.
Type getType() const
Get the type.
Function(Function &&other)
move CTOR
Function & operator=(Function &&other)
move operator
Function(const Function &other)
copy CTOR
void setType(const std::string &type)
Set the thype.
const std::string & getType() const
Get the type.
bool operator!=(const Function &other) const
inequality operator
Properties & getProperties()
Get the Properties object.
ddl::utility::TypeAccessMap< Property, Function > Properties
Type of properties within module.
Definition datamodel_configuration_items.h:1399
Function(const std::string &name, const std::string &type, const std::vector< Property > &properties={})
CTOR.
bool operator==(const Function &other) const
equality operator
Function & operator=(const Function &other)
copy operator
const Properties & getProperties() const
Get the Properties.
void setName(const std::string &name)
Set the name.
const std::string & getName() const
Get the name.
void setAuthor(const std::string &author)
Set the author.
const std::string & getDateChange() const
Get the date of last change.
Header(const Version &mapping_version, const std::string &author={}, const std::string &date_creation={}, const std::string &date_change={}, const std::string &description={})
CTOR.
const std::string & getDateCreation() const
Get the date of creation.
Header & operator=(const Header &other)
copy operator
void setDescription(const std::string &description)
Set the description.
const std::string & getDescription() const
Get the description.
Header & operator=(Header &&other)
move operator
Header(Header &&other)
move CTOR
bool operator!=(const Header &other) const
inequality operator
Version getMappingVersion() const
Get the mapping version.
bool operator==(const Header &other) const
equality operator (the header must have exacly the same content)
Header(const Header &other)
copy CTOR
void setDateChange(const std::string &date_change)
Set the date of last change.
const std::string & getAuthor() const
Get the author.
void setMappingVersion(const Version &mapping_version)
Set the mapping version.
void setDateCreation(const std::string &date_creation)
Set the date of creation.
ParameterValue(const ParameterValue &other)
copy CTOR
Type getType() const
Get the type.
void setAsInternalValue(const InternalValue &internal_value)
Set the as internal value.
void setName(const std::string &name)
Set the name.
void setAsConstValue(const ConstValue &const_value)
Set the as const value.
bool operator!=(const ParameterValue &other) const
inequality operator
const std::string & getName() const
Get the name.
InternalValue getInternalValue() const
Get the internal value if type is set to Type::internal_value.
ParameterValue(ParameterValue &&other)
move CTOR
bool operator==(const ParameterValue &other) const
equality operator
ConstValue getConstValue() const
Get the const value if type is set to Type::const_value.
ParameterValue(const std::string &name, const ConstValue &const_value)
CTOR.
ParameterValue & operator=(const ParameterValue &other)
copy operator
ParameterValue(const std::string &name, const InternalValue &internal_value)
CTOR.
ParameterValue & operator=(ParameterValue &&other)
move operator
void setAsSourceValue(const SourceValue &source_value)
Set the as source value.
Type
Type of the parameter value.
Definition datamodel_configuration_items.h:659
@ const_value
The parameter value is a const value.
Definition datamodel_configuration_items.h:669
@ source_value
The parameter value is a source value.
Definition datamodel_configuration_items.h:664
@ internal_value
The parameter value is a const value.
Definition datamodel_configuration_items.h:674
SourceValue getSourceValue() const
Get the source value if type is set to Type::source_value.
ParameterValue(const std::string &name, const SourceValue &source_value)
CTOR.
bool operator==(const Property &other) const
equality operator
Property & operator=(Property &&other)
move operator
Property & operator=(const Property &other)
copy operator
void setValue(const std::string &value)
Set the value.
const std::string & getName() const
Get the name.
Property(const Property &other)
copy CTOR
const std::string & getValue() const
Get the value.
Property(Property &&other)
move CTOR
Property(const std::string &name, const std::string &value)
CTOR.
void setName(const std::string &name)
Set the name.
bool operator!=(const Property &other) const
inequality operator
Source(const std::string &name, const std::string &type, const std::vector< Property > &properties={})
CTOR.
ddl::utility::TypeAccessMap< Property, Source > Properties
Properties type.
Definition datamodel_configuration_items.h:347
const std::string & getType() const
Get the type.
Source(Source &&other)
move CTOR
const Properties & getProperties() const
Get the Properties.
bool operator==(const Source &other) const
equality operator
bool operator!=(const Source &other) const
inequality operator
void setType(const std::string &type)
Set the type.
Properties & getProperties()
Get the Properties.
const std::string & getName() const
Get the name.
void setName(const std::string &name)
Set the name.
Source(const Source &other)
copy CTOR
Source & operator=(Source &&other)
move operator
Source & operator=(const Source &other)
copy operator
bool operator!=(const Target &other) const
inequality operator
void setName(const std::string &name)
Set the name of the target instance to create.
Assignments & getAssignments()
Get the Assignments.
Target(const Target &other)
copy CTOR
const std::string & getName() const
Get the name.
void setType(const std::string &type)
Set the type.
const Assignments & getAssignments() const
Get the Assignments.
bool operator==(const Target &other) const
equality operator
const Triggers & getTriggers() const
Get the Triggers.
ddl::utility::TypeAccessMap< Property, Target > Properties
Properties type within the target.
Definition datamodel_configuration_items.h:1240
Triggers & getTriggers()
Get the Triggers.
ddl::utility::TypeAccessList< Assignment, Target > Assignments
Assignments type within the target.
Definition datamodel_configuration_items.h:1276
Properties & getProperties()
Get the Properties.
Target(const std::string &name, const std::string &type, const std::vector< Property > &properties={})
CTOR.
ddl::utility::TypeAccessVector< Trigger, Target > Triggers
Triggers type within the target.
Definition datamodel_configuration_items.h:1258
Target(Target &&other)
move CTOR
const Properties & getProperties() const
Get the Properties.
Target & operator=(Target &&other)
move operator
const std::string & getType() const
Get the type of the target instance to create.
Target & operator=(const Target &other)
copy operator
static constexpr auto strategy_latest
Definition datamodel_configuration_items.h:578
static constexpr auto strategy_first_in_config
Definition datamodel_configuration_items.h:574
bool operator!=(const Trigger &other) const
inequality operator
bool operator==(const Trigger &other) const
equality operator
Period getPeriod() const
Get the period value if type is set to Type::period.
Type getType() const
Get the type.
void setTimeStrategy(const std::string &time_strategy)
Type
The type of the trigger.
Definition datamodel_configuration_items.h:381
@ source
The trigger is a source trigger.
Definition datamodel_configuration_items.h:386
@ data
The trigger is a data trigger.
Definition datamodel_configuration_items.h:391
@ period
The trigger is a periodic trigger.
Definition datamodel_configuration_items.h:396
Source getSource() const
Get the source value if type is set to Type::source.
Trigger(const Source &source)
CTOR.
static constexpr auto strategy_trigger
Definition datamodel_configuration_items.h:568
Trigger(const Period &period)
CTOR.
void setAsData(const Data &data)
Set as data trigger.
Data getData() const
Get the data value if type is set to Type::data.
Trigger(const Data &data)
CTOR.
void setAsPeriod(const Period &period)
Set as periodic trigger.
static constexpr auto strategy_earliest
Definition datamodel_configuration_items.h:582
const std::string & getTimeStrategy() const
Trigger & operator=(Trigger &&other)
move operator
Trigger & operator=(const Trigger &other)
copy operator
void setAsSource(const Source &source)
Set as source trigger.
Trigger(Trigger &&other)
move CTOR
Trigger(const Trigger &other)
copy CTOR
Bug fix class for ddl::dd::utility::TypeAccessList to get rid of providing getNamedItemList in valida...
Definition access_list.h:829
Utility class for observable named items where the order is important.
Definition access_vector.h:83
Trigger access_type
Definition access_vector.h:86
bool operator!=(const Trigger::Source &left, const Trigger::Source &right)
inequality operator
bool operator==(const Trigger::Source &left, const Trigger::Source &right)
equality operator
ddl::utility::ModelSubjectUtility< SubjectType, ModelEventCode > ModelSubject
Subject template class for observable objects.
Definition datamodel_base.h:190
ModelSubjectUtility< T, TypeAccessMapEventCode > TypeAccessMapSubject
helper template to observe map content.
Definition access_map.h:61
TypeAccessListEventCode
Internal event code to inform the parent DD Object about the change of an item within the list.
Definition access_list.h:43
TypeAccessMapEventCode
Internal event code to inform the parent DD Object about the change of an item within the list.
Definition access_map.h:37
definition of the mapping namespace
Definition ddl.h:50
ModelSubjectUtility< T, TypeAccessVectorEventCode > TypeAccessVectorSubject
helper template to observe vector content.
Definition access_vector.h:65
TypeAccessVectorEventCode
Internal event code to inform the parent DD Object about the change of an item within the list.
Definition access_vector.h:39
ModelSubjectUtility< T, TypeAccessListEventCode > TypeAccessListSubject
helper template to observe list content.
Definition access_list.h:808
definition of the ddl namespace
Definition codec.h:21
FunctionCall type.
Definition datamodel_configuration_items.h:945
std::string function_name
function instance to call
Definition datamodel_configuration_items.h:949
ConstValue type of the parameter.
Definition datamodel_configuration_items.h:694
std::string value
the const value
Definition datamodel_configuration_items.h:700
InternalValue type of the parameter.
Definition datamodel_configuration_items.h:707
std::string value_name
the internal value name within target or source name
Definition datamodel_configuration_items.h:715
std::string name
the source or target name of the value if necessary
Definition datamodel_configuration_items.h:711
SourceValue type of the parameter.
Definition datamodel_configuration_items.h:680
std::string name
the source name of the value
Definition datamodel_configuration_items.h:684
std::string value_name
the value name within the source
Definition datamodel_configuration_items.h:688
Data type of the trigger.
Definition datamodel_configuration_items.h:414
std::string operation
the compare operator to use for value 'operator' source_value_name
Definition datamodel_configuration_items.h:426
std::string source_name
the source name for the value to trigger on update
Definition datamodel_configuration_items.h:418
std::string value
the value to compare the source_value_name to
Definition datamodel_configuration_items.h:430
std::string source_value_name
the value name within the source_name to trigger on update
Definition datamodel_configuration_items.h:422
Period type of the trigger.
Definition datamodel_configuration_items.h:437
std::string unit
the unit of the time value
Definition datamodel_configuration_items.h:446
std::string time
the time of the period Usually this is an unsigned integer value!
Definition datamodel_configuration_items.h:442
Source type of the trigger.
Definition datamodel_configuration_items.h:403
std::string source_name
the source name to trigger on update
Definition datamodel_configuration_items.h:407