dds-fmu 0.5.1
DDS-FMU communication integration
ddsfmu::DynamicPubSub Class Reference

Dynamic Publisher and Subscriber. More...

#include <DynamicPubSub.hpp>

Public Member Functions

 DynamicPubSub ()
 Default constructor sets pointers to nullptr and m_xml_load ed false. More...
 
 ~DynamicPubSub ()
 Destructor calls clear() More...
 
 DynamicPubSub (const DynamicPubSub &)=delete
 Copy constructor. More...
 
DynamicPubSuboperator= (const DynamicPubSub &)=delete
 Copy assignment. More...
 
void reset (const std::filesystem::path &fmu_resources, DataMapper *const mapper, const std::string &name="dds-fmu", cppfmu::Logger *const logger=nullptr)
 Resets all members of DynamicPubSub. More...
 
void write ()
 Writes DDS data by using data from DataMapper. More...
 
void take ()
 Takes DDS data into data in DataMapper. More...
 
void init_key_filters ()
 Initialize content filters for keyed topics. More...
 

Detailed Description

This class consists of one each instances: A DDS Domain Participant, a dds::Publisher, and a dds::Subscriber. It loads a Fast-DDS XML profile, uses IDL files for type specification, and a DDS to FMU mapping configuration file. For each mapping of DDS topic, it registers either a DataWriter or DataReader entity. It has convenience functions to call write or take on all registered entities. By means of a converter, the inbound or outbound DDS data are populated in a connected DataMapper instance.

Constructor & Destructor Documentation

◆ DynamicPubSub() [1/2]

ddsfmu::DynamicPubSub::DynamicPubSub ( )

◆ ~DynamicPubSub()

ddsfmu::DynamicPubSub::~DynamicPubSub ( )

◆ DynamicPubSub() [2/2]

ddsfmu::DynamicPubSub::DynamicPubSub ( const DynamicPubSub )
delete

Member Function Documentation

◆ init_key_filters()

void ddsfmu::DynamicPubSub::init_key_filters ( )

For each ContentFilteredTopic: Update filter parameters with reader GUID and key valuesfor which filtering will occur

◆ operator=()

DynamicPubSub & ddsfmu::DynamicPubSub::operator= ( const DynamicPubSub )
delete

◆ reset()

void ddsfmu::DynamicPubSub::reset ( const std::filesystem::path &  fmu_resources,
DataMapper *const  mapper,
const std::string &  name = "dds-fmu",
cppfmu::Logger *const  logger = nullptr 
)

Calls clear(), then loads configuration files and initializes DDS members, as well as other data structures.

Parameters
[in]fmu_resourcesPath to FMU resources folder
[in]mapperPointer to DataMapper instance to be used
[in]nameInstance name of FMU
[in]loggerPointer to FMI logger dispatcher

◆ take()

void ddsfmu::DynamicPubSub::take ( )

For each DataReader: Takes data from DDS and if data: Converts to associated xtypes::DynamicData

◆ write()

void ddsfmu::DynamicPubSub::write ( )

For each DataWriter: Converts associated xtypes::DynamicData to DynamicData_ptr and publishes it