YARP
Yet Another Robot Platform
 
Loading...
Searching...
No Matches
FakeNavigation_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 (1.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 Mar 7 17:59:43 2024
12
13
15#include <yarp/os/LogStream.h>
16#include <yarp/os/Value.h>
17
18namespace {
19 YARP_LOG_COMPONENT(FakeNavigationParamsCOMPONENT, "yarp.device.FakeNavigation")
20}
21
22
26
27
28std::vector<std::string> FakeNavigation_ParamsParser::getListOfParams() const
29{
30 std::vector<std::string> params;
31 params.push_back("navigation_time");
32 params.push_back("reached_time");
33 return params;
34}
35
36
38{
39 //Check for --help option
40 if (config.check("help"))
41 {
42 yCInfo(FakeNavigationParamsCOMPONENT) << getDocumentationOfDeviceParams();
43 }
44
45 std::string config_string = config.toString();
46 yarp::os::Property prop_check(config_string.c_str());
47 //Parser of parameter navigation_time
48 {
49 if (config.check("navigation_time"))
50 {
51 m_navigation_time = config.find("navigation_time").asInt64();
52 yCInfo(FakeNavigationParamsCOMPONENT) << "Parameter 'navigation_time' using value:" << m_navigation_time;
53 }
54 else
55 {
56 yCInfo(FakeNavigationParamsCOMPONENT) << "Parameter 'navigation_time' using DEFAULT value:" << m_navigation_time;
57 }
58 prop_check.unput("navigation_time");
59 }
60
61 //Parser of parameter reached_time
62 {
63 if (config.check("reached_time"))
64 {
65 m_reached_time = config.find("reached_time").asInt64();
66 yCInfo(FakeNavigationParamsCOMPONENT) << "Parameter 'reached_time' using value:" << m_reached_time;
67 }
68 else
69 {
70 yCInfo(FakeNavigationParamsCOMPONENT) << "Parameter 'reached_time' using DEFAULT value:" << m_reached_time;
71 }
72 prop_check.unput("reached_time");
73 }
74
75 /*
76 //This code check if the user set some parameter which are not check by the parser
77 //If the parser is set in strict mode, this will generate an error
78 if (prop_check.size() > 0)
79 {
80 bool extra_params_found = false;
81 for (auto it=prop_check.begin(); it!=prop_check.end(); it++)
82 {
83 if (m_parser_is_strict)
84 {
85 yCError(FakeNavigationParamsCOMPONENT) << "User asking for parameter: "<<it->name <<" which is unknown to this parser!";
86 extra_params_found = true;
87 }
88 else
89 {
90 yCWarning(FakeNavigationParamsCOMPONENT) << "User asking for parameter: "<< it->name <<" which is unknown to this parser!";
91 }
92 }
93
94 if (m_parser_is_strict && extra_params_found)
95 {
96 return false;
97 }
98 }
99 */
100 return true;
101}
102
103
105{
106 std::string doc;
107 doc = doc + std::string("\n=============================================\n");
108 doc = doc + std::string("This is the help for device: FakeNavigation\n");
109 doc = doc + std::string("\n");
110 doc = doc + std::string("This is the list of the parameters accepted by the device:\n");
111 doc = doc + std::string("'navigation_time': navigation_time\n");
112 doc = doc + std::string("'reached_time': reached_time\n");
113 doc = doc + std::string("\n");
114 doc = doc + std::string("Here are some examples of invocation command with yarpdev, with all params:\n");
115 doc = doc + " yarpdev --device fakeNavigation --navigation_time 500 --reached_time 100\n";
116 doc = doc + std::string("Using only mandatory params:\n");
117 doc = doc + " yarpdev --device fakeNavigation\n";
118 doc = doc + std::string("=============================================\n\n"); return doc;
119}
std::string getDocumentationOfDeviceParams() const override
Get the documentation of the DeviceDriver's parameters.
std::vector< std::string > getListOfParams() const override
Return a list of all params used by the device.
bool parseParams(const yarp::os::Searchable &config) override
Parse the DeviceDriver parameters.
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,...)