|
dds-fmu 0.5.1
DDS-FMU communication integration
|
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... | |
| DynamicPubSub & | operator= (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... | |
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.
| ddsfmu::DynamicPubSub::DynamicPubSub | ( | ) |
| ddsfmu::DynamicPubSub::~DynamicPubSub | ( | ) |
|
delete |
| void ddsfmu::DynamicPubSub::init_key_filters | ( | ) |
For each ContentFilteredTopic: Update filter parameters with reader GUID and key valuesfor which filtering will occur
|
delete |
| 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.
| [in] | fmu_resources | Path to FMU resources folder |
| [in] | mapper | Pointer to DataMapper instance to be used |
| [in] | name | Instance name of FMU |
| [in] | logger | Pointer to FMI logger dispatcher |
| void ddsfmu::DynamicPubSub::take | ( | ) |
For each DataReader: Takes data from DDS and if data: Converts to associated xtypes::DynamicData
| void ddsfmu::DynamicPubSub::write | ( | ) |
For each DataWriter: Converts associated xtypes::DynamicData to DynamicData_ptr and publishes it