20#ifndef _MAPPING_ENGINE_HEADER
21#define _MAPPING_ENGINE_HEADER
42 void add(std::shared_ptr<const SourceFactory> source_factory);
47 void add(std::shared_ptr<const TargetFactory> target_factory);
52 void add(std::shared_ptr<const FunctionFactory> function_factory);
60 std::shared_ptr<Source>
makeSource(
const std::string& type,
70 std::shared_ptr<Target>
makeTarget(
const std::string& type,
88 const std::unordered_map<std::string, std::shared_ptr<const SourceFactory>>&
94 const std::unordered_map<std::string, std::shared_ptr<const TargetFactory>>&
100 const std::unordered_map<std::string, std::shared_ptr<const FunctionFactory>>&
104 std::unordered_map<std::string, std::shared_ptr<const SourceFactory>> _source_factories;
105 std::unordered_map<std::string, std::shared_ptr<const TargetFactory>> _target_factories;
106 std::unordered_map<std::string, std::shared_ptr<const FunctionFactory>> _function_factories;
148 void create(
const std::string& mapping_file);
164 void create(
const std::string& mapping_file,
const std::string& dd_file);
175 virtual void addSource(std::shared_ptr<Source> , std::shared_ptr<Updateable> ){};
326 virtual bool update(std::chrono::nanoseconds time,
327 std::shared_ptr<const Memory> memory) = 0;
347 virtual bool update(std::chrono::nanoseconds time) = 0;
365 virtual std::shared_ptr<Memory>
getMemory(
size_t data_size) = 0;
381 virtual void update(std::chrono::nanoseconds target_time) = 0;
402 std::shared_ptr<ITargetTrigger> target_trigger);
409 void addSource(std::shared_ptr<Source> source, std::shared_ptr<Updateable> trigger_updateable)
override;
410 void addTarget(std::shared_ptr<Target> target)
override;
416 std::shared_ptr<ITimeTrigger> _time_trigger;
417 std::unordered_map<std::string, std::shared_ptr<ISourceTrigger>> _source_triggers;
418 std::unordered_map<std::string, std::shared_ptr<AssignmentTrigger>> _target_triggers;
The Data Definiton class uses the validation model to keep a Data Definition datamodel (ddl::dd::data...
Definition dd.h:92
interface definition for source triggers.
Definition mapping_engine.h:313
virtual ~ISourceTrigger()=default
DTOR.
virtual bool update(std::chrono::nanoseconds time, std::shared_ptr< const Memory > memory)=0
Update the source with current time and memory (if memory source)
interface definition for target triggers that must be implemented
Definition mapping_engine.h:354
virtual ~ITargetTrigger()=default
DTOR.
virtual void update(std::chrono::nanoseconds target_time)=0
Update call for the target.
virtual std::shared_ptr< Memory > getMemory(size_t data_size)=0
Get a current memory buffer reference for the target.
interface definition for time triggers.
Definition mapping_engine.h:334
virtual bool update(std::chrono::nanoseconds time)=0
Periodic time update call.
virtual ~ITimeTrigger()=default
DTOR.
std::shared_ptr< ITimeTrigger > getTimeTrigger()
Get the Time Trigger.
void registerForTarget(const std::string_view &target_name, std::shared_ptr< ITargetTrigger > target_trigger)
registers a target trigger
std::shared_ptr< ISourceTrigger > getSourceTrigger(const std::string_view &source_name)
Get the Source Trigger for the given name.
void reset()
resets the engine in time and memory
DefaultEngine(MapperFactories factories)
virtual void addTarget(std::shared_ptr< Target >)
Callback function to inform about a target that is about to be added to the engine.
Definition mapping_engine.h:179
Engine(MapperFactories mapper_factories)
virtual void addDataTrigger(TargetDataTrigger)
Callback function to inform about a source data trigger that is about to be added to the engine.
Definition mapping_engine.h:283
MapperFactories _factories
the factories to use for creating source, target, function instances
Definition mapping_engine.h:289
static constexpr auto property_time_strategy
Definition mapping_engine.h:169
virtual void addSourceTrigger(TargetSourceTrigger)
Callback function to inform about a source trigger that is about to be added to the engine.
Definition mapping_engine.h:235
void create(const std::string &mapping_file, const std::string &dd_file)
Creates an engine with the given configuration file path and data definition. This method is there fo...
virtual void addSource(std::shared_ptr< Source >, std::shared_ptr< Updateable >)
Callback function to inform about a source that is about to be added to the engine.
Definition mapping_engine.h:175
virtual void addTimeTrigger(TargetTimeTrigger)
Callback function to inform about a time trigger that is about to be added to the engine.
Definition mapping_engine.h:207
std::unique_ptr< Mapper > _mapper
the mapper to initialize
Definition mapping_engine.h:287
void create(const MappingConfiguration &configuration, ddl::DataDefinition dd)
Creates an engine with the given configuration. This method is there for legacy reasons to load mappi...
std::optional< ddl::DataDefinition > _global_dd
the mapping 1.0 global legacy data definition
Definition mapping_engine.h:291
void create(const MappingConfiguration &configuration)
Creates an engine with the given configuration.
void create(const std::string &mapping_file)
Creates an engine with the given configuration file path.
Mapping factory collection class registry.
Definition mapping_engine.h:36
void add(std::shared_ptr< const SourceFactory > source_factory)
Adds a Source factory to the collection.
const std::unordered_map< std::string, std::shared_ptr< const SourceFactory > > & getSourceFactories() const
Get all current registered source factories.
const std::unordered_map< std::string, std::shared_ptr< const FunctionFactory > > & getFunctionFactories() const
Get all current registered function factories.
std::shared_ptr< Source > makeSource(const std::string &type, std::string name, Properties properties) const
Creates a source of given type.
const std::unordered_map< std::string, std::shared_ptr< const TargetFactory > > & getTargetFactories() const
Get all current registered target factories.
std::shared_ptr< Function > makeFunction(const std::string &type, std::string name, Properties properties) const
Creates a function of given type.
void add(std::shared_ptr< const FunctionFactory > function_factory)
Adds a Function factory to the collection.
void add(std::shared_ptr< const TargetFactory > target_factory)
Adds a Target factory to the collection.
std::shared_ptr< Target > makeTarget(const std::string &type, std::string name, Properties properties) const
Creates a target of given type.
Mapping Configuration model with validation and requirements management.
Definition mapping_configuration.h:34
definition of the dd namespace
Definition datamodel_base.h:26
definition of the mapping namespace
Definition ddl.h:50
MapperFactories getDefaultMapperFactories()
Retrieves the default mapper factories This contains:
std::unordered_map< std::string, Property > Properties
Properties class as set of key - property value pairs This proerties are used to adjust the readers a...
Definition mapper_interfaces.h:331
definition of the ddl namespace
Definition codec.h:21
Target data trigger definitions.
Definition mapping_engine.h:241
std::shared_ptr< Source > _source
The source reference to retrieve the strValueName from.
Definition mapping_engine.h:265
std::shared_ptr< AssignmentTrigger > _trigger
assignemnt to trigger
Definition mapping_engine.h:273
std::unordered_map< std::string, std::string > _additional_properties
additional properties (i.e. "time_strategy")
Definition mapping_engine.h:277
std::string strValueName
source value name to execute the conditional operation on.
Definition mapping_engine.h:245
std::string strValue
The value to ececute the operation with as string.
Definition mapping_engine.h:261
std::string strOp
Operation to execute. Possible conditional operation values within ddl::mapping::DefaultEngine :
Definition mapping_engine.h:257
std::shared_ptr< Target > _target
target to update
Definition mapping_engine.h:269
Target source trigger definitions.
Definition mapping_engine.h:213
std::shared_ptr< AssignmentTrigger > _trigger
assignment to trigger
Definition mapping_engine.h:225
std::unordered_map< std::string, std::string > _additional_properties
additional properties (i.e. "time_strategy")
Definition mapping_engine.h:229
std::shared_ptr< Target > _target
target to update
Definition mapping_engine.h:221
std::shared_ptr< Source > _source
source reference
Definition mapping_engine.h:217
Target time trigger definitions.
Definition mapping_engine.h:185
std::shared_ptr< AssignmentTrigger > _trigger
assignment to trigger
Definition mapping_engine.h:197
std::chrono::nanoseconds _duration
time trigger period
Definition mapping_engine.h:189
std::unordered_map< std::string, std::string > _additional_properties
additional properties
Definition mapping_engine.h:201
std::shared_ptr< Target > _target
target to update
Definition mapping_engine.h:193