YARP
Yet Another Robot Platform
 
Loading...
Searching...
No Matches
FakeDepthCameraDriver_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:30 2025
12
13
15#include <yarp/os/LogStream.h>
16#include <yarp/os/Value.h>
17
18namespace {
19 YARP_LOG_COMPONENT(FakeDepthCameraDriverParamsCOMPONENT, "yarp.device.FakeDepthCameraDriver")
20}
21
22
26
27
29{
30 std::vector<std::string> params;
31 params.push_back("rgb_h");
32 params.push_back("rgb_w");
33 params.push_back("dep_h");
34 params.push_back("dep_w");
35 params.push_back("accuracy");
36 params.push_back("rgb_Vfov");
37 params.push_back("rgb_Hfov");
38 params.push_back("dep_Vfov");
39 params.push_back("dep_Hfov");
40 params.push_back("dep_near");
41 params.push_back("dep_far");
42 return params;
43}
44
45
46bool FakeDepthCameraDriver_ParamsParser::getParamValue(const std::string& paramName, std::string& paramValue) const
47{
48 if (paramName =="rgb_h")
49 {
50 paramValue = std::to_string(m_rgb_h);
51 return true;
52 }
53 if (paramName =="rgb_w")
54 {
55 paramValue = std::to_string(m_rgb_w);
56 return true;
57 }
58 if (paramName =="dep_h")
59 {
60 paramValue = std::to_string(m_dep_h);
61 return true;
62 }
63 if (paramName =="dep_w")
64 {
65 paramValue = std::to_string(m_dep_w);
66 return true;
67 }
68 if (paramName =="accuracy")
69 {
70 paramValue = std::to_string(m_accuracy);
71 return true;
72 }
73 if (paramName =="rgb_Vfov")
74 {
75 paramValue = std::to_string(m_rgb_Vfov);
76 return true;
77 }
78 if (paramName =="rgb_Hfov")
79 {
80 paramValue = std::to_string(m_rgb_Hfov);
81 return true;
82 }
83 if (paramName =="dep_Vfov")
84 {
85 paramValue = std::to_string(m_dep_Vfov);
86 return true;
87 }
88 if (paramName =="dep_Hfov")
89 {
90 paramValue = std::to_string(m_dep_Hfov);
91 return true;
92 }
93 if (paramName =="dep_near")
94 {
95 paramValue = std::to_string(m_dep_near);
96 return true;
97 }
98 if (paramName =="dep_far")
99 {
100 paramValue = std::to_string(m_dep_far);
101 return true;
102 }
103
104 yError() <<"parameter '" << paramName << "' was not found";
105 return false;
106
107}
108
109
111{
112 //This is a sub-optimal solution.
113 //Ideally getConfiguration() should return all parameters but it is currently
114 //returning only user provided parameters (excluding default values)
115 //This behaviour will be fixed in the near future.
116 std::string s_cfg = m_provided_configuration;
117 return s_cfg;
118}
119
121{
122 //Check for --help option
123 if (config.check("help"))
124 {
125 yCInfo(FakeDepthCameraDriverParamsCOMPONENT) << getDocumentationOfDeviceParams();
126 }
127
130 //Parser of parameter rgb_h
131 {
132 if (config.check("rgb_h"))
133 {
134 m_rgb_h = config.find("rgb_h").asFloat64();
135 yCInfo(FakeDepthCameraDriverParamsCOMPONENT) << "Parameter 'rgb_h' using value:" << m_rgb_h;
136 }
137 else
138 {
139 yCInfo(FakeDepthCameraDriverParamsCOMPONENT) << "Parameter 'rgb_h' using DEFAULT value:" << m_rgb_h;
140 }
141 prop_check.unput("rgb_h");
142 }
143
144 //Parser of parameter rgb_w
145 {
146 if (config.check("rgb_w"))
147 {
148 m_rgb_w = config.find("rgb_w").asFloat64();
149 yCInfo(FakeDepthCameraDriverParamsCOMPONENT) << "Parameter 'rgb_w' using value:" << m_rgb_w;
150 }
151 else
152 {
153 yCInfo(FakeDepthCameraDriverParamsCOMPONENT) << "Parameter 'rgb_w' using DEFAULT value:" << m_rgb_w;
154 }
155 prop_check.unput("rgb_w");
156 }
157
158 //Parser of parameter dep_h
159 {
160 if (config.check("dep_h"))
161 {
162 m_dep_h = config.find("dep_h").asFloat64();
163 yCInfo(FakeDepthCameraDriverParamsCOMPONENT) << "Parameter 'dep_h' using value:" << m_dep_h;
164 }
165 else
166 {
167 yCInfo(FakeDepthCameraDriverParamsCOMPONENT) << "Parameter 'dep_h' using DEFAULT value:" << m_dep_h;
168 }
169 prop_check.unput("dep_h");
170 }
171
172 //Parser of parameter dep_w
173 {
174 if (config.check("dep_w"))
175 {
176 m_dep_w = config.find("dep_w").asFloat64();
177 yCInfo(FakeDepthCameraDriverParamsCOMPONENT) << "Parameter 'dep_w' using value:" << m_dep_w;
178 }
179 else
180 {
181 yCInfo(FakeDepthCameraDriverParamsCOMPONENT) << "Parameter 'dep_w' using DEFAULT value:" << m_dep_w;
182 }
183 prop_check.unput("dep_w");
184 }
185
186 //Parser of parameter accuracy
187 {
188 if (config.check("accuracy"))
189 {
190 m_accuracy = config.find("accuracy").asFloat64();
191 yCInfo(FakeDepthCameraDriverParamsCOMPONENT) << "Parameter 'accuracy' using value:" << m_accuracy;
192 }
193 else
194 {
195 yCInfo(FakeDepthCameraDriverParamsCOMPONENT) << "Parameter 'accuracy' using DEFAULT value:" << m_accuracy;
196 }
197 prop_check.unput("accuracy");
198 }
199
200 //Parser of parameter rgb_Vfov
201 {
202 if (config.check("rgb_Vfov"))
203 {
204 m_rgb_Vfov = config.find("rgb_Vfov").asFloat64();
205 yCInfo(FakeDepthCameraDriverParamsCOMPONENT) << "Parameter 'rgb_Vfov' using value:" << m_rgb_Vfov;
206 }
207 else
208 {
209 yCInfo(FakeDepthCameraDriverParamsCOMPONENT) << "Parameter 'rgb_Vfov' using DEFAULT value:" << m_rgb_Vfov;
210 }
211 prop_check.unput("rgb_Vfov");
212 }
213
214 //Parser of parameter rgb_Hfov
215 {
216 if (config.check("rgb_Hfov"))
217 {
218 m_rgb_Hfov = config.find("rgb_Hfov").asFloat64();
219 yCInfo(FakeDepthCameraDriverParamsCOMPONENT) << "Parameter 'rgb_Hfov' using value:" << m_rgb_Hfov;
220 }
221 else
222 {
223 yCInfo(FakeDepthCameraDriverParamsCOMPONENT) << "Parameter 'rgb_Hfov' using DEFAULT value:" << m_rgb_Hfov;
224 }
225 prop_check.unput("rgb_Hfov");
226 }
227
228 //Parser of parameter dep_Vfov
229 {
230 if (config.check("dep_Vfov"))
231 {
232 m_dep_Vfov = config.find("dep_Vfov").asFloat64();
233 yCInfo(FakeDepthCameraDriverParamsCOMPONENT) << "Parameter 'dep_Vfov' using value:" << m_dep_Vfov;
234 }
235 else
236 {
237 yCInfo(FakeDepthCameraDriverParamsCOMPONENT) << "Parameter 'dep_Vfov' using DEFAULT value:" << m_dep_Vfov;
238 }
239 prop_check.unput("dep_Vfov");
240 }
241
242 //Parser of parameter dep_Hfov
243 {
244 if (config.check("dep_Hfov"))
245 {
246 m_dep_Hfov = config.find("dep_Hfov").asFloat64();
247 yCInfo(FakeDepthCameraDriverParamsCOMPONENT) << "Parameter 'dep_Hfov' using value:" << m_dep_Hfov;
248 }
249 else
250 {
251 yCInfo(FakeDepthCameraDriverParamsCOMPONENT) << "Parameter 'dep_Hfov' using DEFAULT value:" << m_dep_Hfov;
252 }
253 prop_check.unput("dep_Hfov");
254 }
255
256 //Parser of parameter dep_near
257 {
258 if (config.check("dep_near"))
259 {
260 m_dep_near = config.find("dep_near").asFloat64();
261 yCInfo(FakeDepthCameraDriverParamsCOMPONENT) << "Parameter 'dep_near' using value:" << m_dep_near;
262 }
263 else
264 {
265 yCInfo(FakeDepthCameraDriverParamsCOMPONENT) << "Parameter 'dep_near' using DEFAULT value:" << m_dep_near;
266 }
267 prop_check.unput("dep_near");
268 }
269
270 //Parser of parameter dep_far
271 {
272 if (config.check("dep_far"))
273 {
274 m_dep_far = config.find("dep_far").asFloat64();
275 yCInfo(FakeDepthCameraDriverParamsCOMPONENT) << "Parameter 'dep_far' using value:" << m_dep_far;
276 }
277 else
278 {
279 yCInfo(FakeDepthCameraDriverParamsCOMPONENT) << "Parameter 'dep_far' using DEFAULT value:" << m_dep_far;
280 }
281 prop_check.unput("dep_far");
282 }
283
284 /*
285 //This code check if the user set some parameter which are not check by the parser
286 //If the parser is set in strict mode, this will generate an error
287 if (prop_check.size() > 0)
288 {
289 bool extra_params_found = false;
290 for (auto it=prop_check.begin(); it!=prop_check.end(); it++)
291 {
292 if (m_parser_is_strict)
293 {
294 yCError(FakeDepthCameraDriverParamsCOMPONENT) << "User asking for parameter: "<<it->name <<" which is unknown to this parser!";
295 extra_params_found = true;
296 }
297 else
298 {
299 yCWarning(FakeDepthCameraDriverParamsCOMPONENT) << "User asking for parameter: "<< it->name <<" which is unknown to this parser!";
300 }
301 }
302
303 if (m_parser_is_strict && extra_params_found)
304 {
305 return false;
306 }
307 }
308 */
309 return true;
310}
311
312
314{
315 std::string doc;
316 doc = doc + std::string("\n=============================================\n");
317 doc = doc + std::string("This is the help for device: FakeDepthCameraDriver\n");
318 doc = doc + std::string("\n");
319 doc = doc + std::string("This is the list of the parameters accepted by the device:\n");
320 doc = doc + std::string("'rgb_h': rgb_h\n");
321 doc = doc + std::string("'rgb_w': rgb_w\n");
322 doc = doc + std::string("'dep_h': dep_h\n");
323 doc = doc + std::string("'dep_w': dep_w\n");
324 doc = doc + std::string("'accuracy': accuracy\n");
325 doc = doc + std::string("'rgb_Vfov': rgb_Vfov\n");
326 doc = doc + std::string("'rgb_Hfov': rgb_Hfov\n");
327 doc = doc + std::string("'dep_Vfov': dep_Vfov\n");
328 doc = doc + std::string("'dep_Hfov': dep_Hfov\n");
329 doc = doc + std::string("'dep_near': dep_near\n");
330 doc = doc + std::string("'dep_far': dep_far\n");
331 doc = doc + std::string("\n");
332 doc = doc + std::string("Here are some examples of invocation command with yarpdev, with all params:\n");
333 doc = doc + " yarpdev --device fakeDepthCamera --rgb_h 480.0 --rgb_w 640.0 --dep_h 480.0 --dep_w 640.0 --accuracy 0.001 --rgb_Vfov 50.0 --rgb_Hfov 36.0 --dep_Vfov 50.0 --dep_Hfov 36.0 --dep_near 0.2 --dep_far 6.0\n";
334 doc = doc + std::string("Using only mandatory params:\n");
335 doc = doc + " yarpdev --device fakeDepthCamera\n";
336 doc = doc + std::string("=============================================\n\n"); return doc;
337}
#define yError(...)
Definition Log.h:361
std::string getDocumentationOfDeviceParams() const override
Get the documentation of the DeviceDriver's parameters.
std::string getConfiguration() const override
Return the configuration of the device.
bool getParamValue(const std::string &paramName, std::string &paramValue) const override
Return the value (represented as a string) of the requested parameter.
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.
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,...)