YARP
Yet Another Robot Platform
 
Loading...
Searching...
No Matches
FrameTransformStorage_ParamsParser.cpp
Go to the documentation of this file.
1/*
2 * SPDX-FileCopyrightText: 2023-2023 Istituto Italiano di Tecnologia (IIT)
3 * SPDX-License-Identifier: LGPL-2.1-or-later
4 */
5
6
7// Generated by yarpDeviceParamParserGenerator (2.0)
8// This is an automatically generated file. Please do not edit it.
9// It will be re-generated if the cmake flag ALLOW_DEVICE_PARAM_PARSER_GERNERATION is ON.
10
11// Generated on: Thu May 22 11:32:46 2025
12
13
15#include <yarp/os/LogStream.h>
16#include <yarp/os/Value.h>
17
18namespace {
19 YARP_LOG_COMPONENT(FrameTransformStorageParamsCOMPONENT, "yarp.device.FrameTransformStorage")
20}
21
22
26
27
29{
30 std::vector<std::string> params;
31 params.push_back("FrameTransform_verbose_debug");
32 params.push_back("FrameTransform_container_timeout");
33 return params;
34}
35
36
37bool FrameTransformStorage_ParamsParser::getParamValue(const std::string& paramName, std::string& paramValue) const
38{
39 if (paramName =="FrameTransform_verbose_debug")
40 {
41 if (m_FrameTransform_verbose_debug==true) paramValue = "true";
42 else paramValue = "false";
43 return true;
44 }
45 if (paramName =="FrameTransform_container_timeout")
46 {
47 paramValue = std::to_string(m_FrameTransform_container_timeout);
48 return true;
49 }
50
51 yError() <<"parameter '" << paramName << "' was not found";
52 return false;
53
54}
55
56
58{
59 //This is a sub-optimal solution.
60 //Ideally getConfiguration() should return all parameters but it is currently
61 //returning only user provided parameters (excluding default values)
62 //This behaviour will be fixed in the near future.
63 std::string s_cfg = m_provided_configuration;
64 return s_cfg;
65}
66
68{
69 //Check for --help option
70 if (config.check("help"))
71 {
72 yCInfo(FrameTransformStorageParamsCOMPONENT) << getDocumentationOfDeviceParams();
73 }
74
77 //Parser of parameter FrameTransform_verbose_debug
78 {
79 if (config.check("FrameTransform_verbose_debug"))
80 {
81 m_FrameTransform_verbose_debug = config.find("FrameTransform_verbose_debug").asBool();
82 yCInfo(FrameTransformStorageParamsCOMPONENT) << "Parameter 'FrameTransform_verbose_debug' using value:" << m_FrameTransform_verbose_debug;
83 }
84 else
85 {
86 yCInfo(FrameTransformStorageParamsCOMPONENT) << "Parameter 'FrameTransform_verbose_debug' using DEFAULT value:" << m_FrameTransform_verbose_debug;
87 }
88 prop_check.unput("FrameTransform_verbose_debug");
89 }
90
91 //Parser of parameter FrameTransform_container_timeout
92 {
93 if (config.check("FrameTransform_container_timeout"))
94 {
95 m_FrameTransform_container_timeout = config.find("FrameTransform_container_timeout").asFloat64();
96 yCInfo(FrameTransformStorageParamsCOMPONENT) << "Parameter 'FrameTransform_container_timeout' using value:" << m_FrameTransform_container_timeout;
97 }
98 else
99 {
100 yCInfo(FrameTransformStorageParamsCOMPONENT) << "Parameter 'FrameTransform_container_timeout' using DEFAULT value:" << m_FrameTransform_container_timeout;
101 }
102 prop_check.unput("FrameTransform_container_timeout");
103 }
104
105 /*
106 //This code check if the user set some parameter which are not check by the parser
107 //If the parser is set in strict mode, this will generate an error
108 if (prop_check.size() > 0)
109 {
110 bool extra_params_found = false;
111 for (auto it=prop_check.begin(); it!=prop_check.end(); it++)
112 {
113 if (m_parser_is_strict)
114 {
115 yCError(FrameTransformStorageParamsCOMPONENT) << "User asking for parameter: "<<it->name <<" which is unknown to this parser!";
116 extra_params_found = true;
117 }
118 else
119 {
120 yCWarning(FrameTransformStorageParamsCOMPONENT) << "User asking for parameter: "<< it->name <<" which is unknown to this parser!";
121 }
122 }
123
124 if (m_parser_is_strict && extra_params_found)
125 {
126 return false;
127 }
128 }
129 */
130 return true;
131}
132
133
135{
136 std::string doc;
137 doc = doc + std::string("\n=============================================\n");
138 doc = doc + std::string("This is the help for device: FrameTransformStorage\n");
139 doc = doc + std::string("\n");
140 doc = doc + std::string("This is the list of the parameters accepted by the device:\n");
141 doc = doc + std::string("'FrameTransform_verbose_debug': Enables additinal debug print\n");
142 doc = doc + std::string("'FrameTransform_container_timeout': After this time, not-refreshed transforms will be deleted\n");
143 doc = doc + std::string("\n");
144 doc = doc + std::string("Here are some examples of invocation command with yarpdev, with all params:\n");
145 doc = doc + " yarpdev --device frameTransformStorage --FrameTransform_verbose_debug false --FrameTransform_container_timeout 0.2\n";
146 doc = doc + std::string("Using only mandatory params:\n");
147 doc = doc + " yarpdev --device frameTransformStorage\n";
148 doc = doc + std::string("=============================================\n\n"); return doc;
149}
#define yError(...)
Definition Log.h:361
bool parseParams(const yarp::os::Searchable &config) override
Parse the DeviceDriver parameters.
std::vector< std::string > getListOfParams() const override
Return a list of all params used by the device.
std::string getConfiguration() const override
Return the configuration of the device.
std::string getDocumentationOfDeviceParams() const override
Get the documentation of the DeviceDriver's parameters.
bool getParamValue(const std::string &paramName, std::string &paramValue) const override
Return the value (represented as a string) of the requested parameter.
A class for storing options and configuration information.
Definition Property.h:33
void unput(const std::string &key)
Remove the association from the given key to a value, if present.
A base class for nested structures that can be searched.
Definition Searchable.h:31
virtual bool check(const std::string &key) const =0
Check if there exists a property of the given name.
virtual std::string toString() const =0
Return a standard text representation of the content of the object.
virtual Value & find(const std::string &key) const =0
Gets a value corresponding to a given keyword.
#define yCInfo(component,...)
#define YARP_LOG_COMPONENT(name,...)