16#include <xtypes/DynamicData.hpp>
17#include <xtypes/idl/idl.hpp>
19#include "visitors.hpp"
54 typedef std::tuple<std::int32_t, std::int32_t, std::int32_t, std::int32_t>
IndexOffsets;
68 void reset(
const std::filesystem::path& fmu_resources);
70 inline void set_double(
const std::int32_t value_ref,
const double& value) {
71 m_real_writer.at(value_ref)(value);
73 inline void get_double(
const std::int32_t value_ref,
double& value)
const {
74 m_real_reader.at(value_ref)(value);
76 inline void set_int(
const std::int32_t value_ref,
const std::int32_t& value) {
77 m_int_writer.at(value_ref)(value);
79 inline void get_int(
const std::int32_t value_ref, std::int32_t& value)
const {
80 m_int_reader.at(value_ref)(value);
82 inline void set_bool(
const std::int32_t value_ref,
const bool& value) {
83 m_bool_writer.at(value_ref)(value);
85 inline void get_bool(
const std::int32_t value_ref,
bool& value)
const {
86 m_bool_reader.at(value_ref)(value);
88 inline void set_string(
const std::int32_t value_ref,
const std::string& value) {
89 m_string_writer.at(value_ref)(value);
91 inline void get_string(
const std::int32_t value_ref, std::string& value)
const {
92 m_string_reader.at(value_ref)(value);
95 inline eprosima::xtypes::DynamicData&
data_ref(
const std::string& topic,
Direction read_write_param) {
96 return m_data_store.at(std::make_tuple(topic, read_write_param));
98 inline const eprosima::xtypes::DynamicData&
100 return m_data_store.at(std::make_tuple(topic, read_write_param));
103 inline eprosima::xtypes::idl::Context&
idl_context() {
return m_context; }
107 return m_offsets.at(std::make_tuple(topic, read_write_param));
111 m_potential_keys.push(std::make_pair(topic_name, topic_type));
117 typedef std::tuple<std::string, Direction> StoreKey;
118 void add(
const std::string& topic_name,
const std::string& topic_type,
Direction read_write_param);
120 std::int32_t m_int_offset, m_real_offset, m_bool_offset, m_string_offset;
121 std::map<StoreKey, IndexOffsets> m_offsets;
122 std::queue<std::pair<std::string, std::string>> m_potential_keys;
123 std::vector<std::function<void(
const std::int32_t&)>> m_int_writer;
124 std::vector<std::function<void(std::int32_t&)>> m_int_reader;
125 std::vector<std::function<void(
const double&)>> m_real_writer;
126 std::vector<std::function<void(
double&)>> m_real_reader;
127 std::vector<std::function<void(
const bool&)>> m_bool_writer;
128 std::vector<std::function<void(
bool&)>> m_bool_reader;
129 std::vector<std::function<void(
const std::string&)>> m_string_writer;
130 std::vector<std::function<void(std::string&)>> m_string_reader;
131 std::map<StoreKey, eprosima::xtypes::DynamicData> m_data_store;
132 eprosima::xtypes::idl::Context m_context;
Manages mapping between FMU signals and xtypes data storage.
Definition: DataMapper.hpp:36
void get_bool(const std::int32_t value_ref, bool &value) const
Definition: DataMapper.hpp:85
void set_int(const std::int32_t value_ref, const std::int32_t &value)
Definition: DataMapper.hpp:76
void set_bool(const std::int32_t value_ref, const bool &value)
Definition: DataMapper.hpp:82
void get_double(const std::int32_t value_ref, double &value) const
Definition: DataMapper.hpp:73
DataMapper & operator=(const DataMapper &)=delete
Copy assignment.
void get_int(const std::int32_t value_ref, std::int32_t &value) const
Definition: DataMapper.hpp:79
void get_string(const std::int32_t value_ref, std::string &value) const
Definition: DataMapper.hpp:91
const eprosima::xtypes::DynamicData & data_ref(const std::string &topic, Direction read_write_param) const
Definition: DataMapper.hpp:99
std::tuple< std::int32_t, std::int32_t, std::int32_t, std::int32_t > IndexOffsets
Definition: DataMapper.hpp:54
void reset(const std::filesystem::path &fmu_resources)
Clears and repopulates internal data structures.
Definition: DataMapper.cpp:36
void queue_for_key_parameter(const std::string &topic_name, const std::string &topic_type)
Definition: DataMapper.hpp:110
Direction
Definition: DataMapper.hpp:42
eprosima::xtypes::idl::Context & idl_context()
Definition: DataMapper.hpp:103
DataMapper(const DataMapper &)=delete
Copy constructor.
eprosima::xtypes::DynamicData & data_ref(const std::string &topic, Direction read_write_param)
Definition: DataMapper.hpp:95
IndexOffsets index_offsets(const std::string &topic, Direction read_write_param) const
Definition: DataMapper.hpp:105
void set_double(const std::int32_t value_ref, const double &value)
Definition: DataMapper.hpp:70
void process_key_queue()
Definition: DataMapper.cpp:106
void set_string(const std::int32_t value_ref, const std::string &value)
Definition: DataMapper.hpp:88
Definition: auxiliaries.cpp:26