20    yarp::os::Property prop;
 
   21    prop.fromString(config.toString());
 
   23    m_verbose = (prop.check(
"verbose",
"if present, give detailed output"));
 
   26        yCInfo(RAWVALUESPUBLISHERREMAPPER, 
"Running with verbose output\n");
 
   31        yCError(RAWVALUESPUBLISHERREMAPPER) << 
"Error parsing configuration parameters";
 
   35    yCDebug(RAWVALUESPUBLISHERREMAPPER) << 
"RawValuesPublisherRemapper device started";
 
   39        yCDebug(RAWVALUESPUBLISHERREMAPPER) << 
"Axes Name: " << name;
 
 
   51    if (drivers.size() < 1)
 
   53        yCError(RAWVALUESPUBLISHERREMAPPER) << 
"attachAll: cannot attach to less than one device";
 
   56    yCDebug(RAWVALUESPUBLISHERREMAPPER) << 
"Attaching to " << drivers.size() << 
" devices";
 
   57    m_remappedControlBoards.resize(drivers.size());
 
   58    for (
size_t i = 0; i < drivers.size(); i++)
 
   60        yarp::dev::PolyDriver* poly = drivers[i]->poly;
 
   63            yCError(RAWVALUESPUBLISHERREMAPPER) << 
"NullPointerException when getting the polyDriver at attachAll.";
 
   68        yCDebug(RAWVALUESPUBLISHERREMAPPER) << 
"Attaching to device " << drivers[i]->key.c_str();
 
   71        if (!poly->view(m_remappedControlBoards[i]))
 
   73            yCError(RAWVALUESPUBLISHERREMAPPER) << 
"Failure in viewing raw values publisher interface for device " << drivers[i]->key.c_str();
 
   79            yCDebug(RAWVALUESPUBLISHERREMAPPER) << 
"Successfully viewed raw values publisher interface";
 
   80            std::vector<std::string> keys;
 
   81            if (m_remappedControlBoards[i]->
getKeys(keys))
 
   83                yCDebug(RAWVALUESPUBLISHERREMAPPER) << 
"Device " << drivers[i]->key.c_str() << 
" has " << keys.size() << 
" keys";
 
   87                yCWarning(RAWVALUESPUBLISHERREMAPPER) << 
"Failed to get keys from device " << drivers[i]->key.c_str();
 
   90            yCDebug(RAWVALUESPUBLISHERREMAPPER) << 
"Keys from device " << drivers[i]->key.c_str() << 
":";
 
   91            for (
const auto& key : keys)
 
   93                yCDebug(RAWVALUESPUBLISHERREMAPPER) << 
"Key: " << key;
 
 
  111    for (
size_t i = 0; i < m_remappedControlBoards.size(); i++)
 
  113        if (!m_remappedControlBoards[i]) 
 
  115            yCWarning(RAWVALUESPUBLISHERREMAPPER) << 
"Null pointer in m_remappedControlBoards at index " << i;
 
  119        std::map<std::string, std::vector<std::int32_t>> temp_map;
 
  122            yCWarning(RAWVALUESPUBLISHERREMAPPER) << 
"Failed to get raw data map from control board " << i;
 
  130        for (
const auto& [k, v] : temp_map)
 
  132            if (map.find(k) != map.end())
 
  137                    yCDebug(RAWVALUESPUBLISHERREMAPPER) << 
"Key " << k << 
" already exists in the combined map. Appending values.";
 
  139                map[k].insert(map[k].end(), v.begin(), v.end());
 
 
  155    for (
size_t i = 0; i < m_remappedControlBoards.size(); i++)
 
  157        if (!m_remappedControlBoards[i]) 
 
  159            yCWarning(RAWVALUESPUBLISHERREMAPPER) << 
"Null pointer in m_remappedControlBoards at index " << i;
 
  162        std::vector<std::int32_t> temp_data;
 
  163        if (m_remappedControlBoards[i]->
getRawData(key, temp_data))
 
  165            data.insert(
data.end(), temp_data.begin(), temp_data.end());
 
  170        yCWarning(RAWVALUESPUBLISHERREMAPPER) << 
"Key not found: " << key;
 
 
  179    std::set<std::string> unique_keys;
 
  180    for (
size_t i = 0; i < m_remappedControlBoards.size(); i++)
 
  182        if (!m_remappedControlBoards[i]) {
 
  183            yCWarning(RAWVALUESPUBLISHERREMAPPER) << 
"Null pointer in m_remappedControlBoards at index " << i;
 
  187        std::vector<std::string> temp_keys;
 
  188        if (!m_remappedControlBoards[i]->
getKeys(temp_keys))
 
  190            yCWarning(RAWVALUESPUBLISHERREMAPPER) << 
"Failed to get keys from control board " << i;
 
  194        unique_keys.insert(temp_keys.begin(), temp_keys.end());
 
  196    keys.assign(unique_keys.begin(), unique_keys.end());
 
 
  211    yCDebug(RAWVALUESPUBLISHERREMAPPER) << 
"Getting metadata map from all attached control boards:" << m_remappedControlBoards.size();
 
  213    for (
size_t i = 0; i < m_remappedControlBoards.size(); i++)
 
  216        if (!m_remappedControlBoards[i]) 
 
  218            yCWarning(RAWVALUESPUBLISHERREMAPPER) << 
"Null pointer in m_remappedControlBoards at index " << i;
 
  224            yCWarning(RAWVALUESPUBLISHERREMAPPER) << 
"Failed to get metadata map from control board " << i;
 
  230            yCDebug(RAWVALUESPUBLISHERREMAPPER) << 
"Successfully got metadata map from control board " << i << 
"with elements:";
 
  233                for (
const auto& [k, v] : temp_metamap.
metadataMap)
 
  235                    yarp::os::Bottle axesNamesBottle, rawValueNamesBottle;
 
  236                    for(
const auto& axisName : v.axesNames) { axesNamesBottle.addString(axisName); }
 
  237                    for(
const auto& rawValueName : v.rawValueNames) { rawValueNamesBottle.addString(rawValueName); }
 
  238                    yCDebug(RAWVALUESPUBLISHERREMAPPER) << 
"\tKey: " << k << 
" AxesNames: " << axesNamesBottle.
toString() << 
" RawValueNames: " << rawValueNamesBottle.toString();
 
  242        for (
const auto& [k, v] : temp_metamap.
metadataMap)
 
  248                    yCDebug(RAWVALUESPUBLISHERREMAPPER) << 
"Key " << k << 
" already exists in the combined metadata map. Adding only values.";
 
  252                existingMeta.axesNames.insert(existingMeta.axesNames.end(), v.axesNames.begin(), v.axesNames.end());
 
  253                existingMeta.rawValueNames.insert(existingMeta.rawValueNames.end(), v.rawValueNames.begin(), v.rawValueNames.end());
 
  255                existingMeta.size = 
static_cast<int>(existingMeta.rawValueNames.size());
 
  259                yCDebug(RAWVALUESPUBLISHERREMAPPER) << 
"Inserting new key " << k << 
" in the combined metadata map.";
 
 
  306    for (
size_t i = 0; i < m_remappedControlBoards.size(); i++)
 
  308        if (!m_remappedControlBoards[i]) {
 
  309            yCWarning(RAWVALUESPUBLISHERREMAPPER) << 
"Null pointer in m_remappedControlBoards at index " << i;
 
  312        std::vector<std::string> temp_axesNames;
 
  313        if (m_remappedControlBoards[i]->
getAxesNames(key, temp_axesNames))
 
  315            axesNames.insert(axesNames.end(), temp_axesNames.begin(), temp_axesNames.end());
 
  321        yCWarning(RAWVALUESPUBLISHERREMAPPER) << 
"Axes names not found for key: " << key;