28 lines
706 B
C++
28 lines
706 B
C++
|
|
#include "profinet_submodule.hpp"
|
||
|
|
|
||
|
|
ProfinetSubmodule::ProfinetSubmodule(uint16_t submodule_id,
|
||
|
|
std::string submodule_name,
|
||
|
|
pnet_data_cfg_t& submodule_data_cfg) :
|
||
|
|
m_id(submodule_id),
|
||
|
|
m_name(submodule_name),
|
||
|
|
m_data_cfg(submodule_data_cfg)
|
||
|
|
{
|
||
|
|
|
||
|
|
}
|
||
|
|
|
||
|
|
bool ProfinetSubmodule::addParameter(std::shared_ptr<ProfinetParameter>& param)
|
||
|
|
{
|
||
|
|
auto ret = m_params.emplace(param->index, param);
|
||
|
|
|
||
|
|
return ret.second;
|
||
|
|
}
|
||
|
|
|
||
|
|
std::shared_ptr<ProfinetParameter> ProfinetSubmodule::getParameterPtr(uint32_t index)
|
||
|
|
{
|
||
|
|
if (!m_params.count(index))
|
||
|
|
{
|
||
|
|
return nullptr;
|
||
|
|
}
|
||
|
|
|
||
|
|
return m_params[index];
|
||
|
|
}
|