-
Notifications
You must be signed in to change notification settings - Fork 196
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- fixed capital letters of source files - added parser to CMakeLists.txt - added dummy param files as placeholders
- Loading branch information
Showing
137 changed files
with
5,226 additions
and
217 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
File renamed without changes.
File renamed without changes.
98 changes: 98 additions & 0 deletions
98
src/devices/fake/fakeAnalogSensor/FakeAnalogSensor_ParamsParser.cpp
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,98 @@ | ||
/* | ||
* SPDX-FileCopyrightText: 2023-2023 Istituto Italiano di Tecnologia (IIT) | ||
* SPDX-License-Identifier: LGPL-2.1-or-later | ||
*/ | ||
|
||
|
||
// Generated by yarpDeviceParamParserGenerator (1.0) | ||
// This is an automatically generated file. Please do not edit it. | ||
// It will be re-generated if the cmake flag ALLOW_DEVICE_PARAM_PARSER_GERNERATION is ON. | ||
|
||
// Generated on: Fri Feb 9 20:17:51 2024 | ||
|
||
|
||
#include "FakeAnalogSensor_ParamsParser.h" | ||
#include <yarp/os/LogStream.h> | ||
#include <yarp/os/Value.h> | ||
|
||
namespace { | ||
YARP_LOG_COMPONENT(FakeAnalogSensorParamsCOMPONENT, "yarp.device.FakeAnalogSensor") | ||
} | ||
|
||
|
||
std::vector<std::string> FakeAnalogSensor_ParamsParser::getListOfParams() const | ||
{ | ||
std::vector<std::string> params; | ||
params.push_back("period"); | ||
return params; | ||
} | ||
|
||
|
||
bool FakeAnalogSensor_ParamsParser::parseParams(const yarp::os::Searchable & config) | ||
{ | ||
//Check for --help option | ||
if (config.check("help")) | ||
{ | ||
yCInfo(FakeAnalogSensorParamsCOMPONENT) << getDocumentationOfDeviceParams(); | ||
} | ||
|
||
std::string config_string = config.toString(); | ||
yarp::os::Property prop_check(config_string.c_str()); | ||
//Parser of parameter period | ||
{ | ||
if (config.check("period")) | ||
{ | ||
m_period = config.find("period").asFloat64(); | ||
yCInfo(FakeAnalogSensorParamsCOMPONENT) << "Parameter 'period' using value:" << m_period; | ||
} | ||
else | ||
{ | ||
yCInfo(FakeAnalogSensorParamsCOMPONENT) << "Parameter 'period' using DEFAULT value:" << m_period; | ||
} | ||
prop_check.unput("period"); | ||
} | ||
|
||
/* | ||
//This code check if the user set some parameter which are not check by the parser | ||
//If the parser is set in strict mode, this will generate an error | ||
if (prop_check.size() > 0) | ||
{ | ||
bool extra_params_found = false; | ||
for (auto it=prop_check.begin(); it!=prop_check.end(); it++) | ||
{ | ||
if (m_parser_is_strict) | ||
{ | ||
yCError(FakeAnalogSensorParamsCOMPONENT) << "User asking for parameter: "<<it->name <<" which is unknown to this parser!"; | ||
extra_params_found = true; | ||
} | ||
else | ||
{ | ||
yCWarning(FakeAnalogSensorParamsCOMPONENT) << "User asking for parameter: "<< it->name <<" which is unknown to this parser!"; | ||
} | ||
} | ||
if (m_parser_is_strict && extra_params_found) | ||
{ | ||
return false; | ||
} | ||
} | ||
*/ | ||
return true; | ||
} | ||
|
||
|
||
std::string FakeAnalogSensor_ParamsParser::getDocumentationOfDeviceParams() const | ||
{ | ||
std::string doc; | ||
doc = doc + std::string("\n=============================================\n"); | ||
doc = doc + std::string("This is the help for device: FakeAnalogSensor\n"); | ||
doc = doc + std::string("\n"); | ||
doc = doc + std::string("This is the list of the parameters accepted by the device:\n"); | ||
doc = doc + std::string("'period': thread period\n"); | ||
doc = doc + std::string("\n"); | ||
doc = doc + std::string("Here are some examples of invocation command with yarpdev, with all params:\n"); | ||
doc = doc + " yarpdev --device FakeAnalogSensor --period 1.0\n"; | ||
doc = doc + std::string("Using only mandatory params:\n"); | ||
doc = doc + " yarpdev --device FakeAnalogSensor\n"; | ||
doc = doc + std::string("=============================================\n\n"); return doc; | ||
} |
64 changes: 64 additions & 0 deletions
64
src/devices/fake/fakeAnalogSensor/FakeAnalogSensor_ParamsParser.h
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,64 @@ | ||
/* | ||
* SPDX-FileCopyrightText: 2023-2023 Istituto Italiano di Tecnologia (IIT) | ||
* SPDX-License-Identifier: LGPL-2.1-or-later | ||
*/ | ||
|
||
|
||
// Generated by yarpDeviceParamParserGenerator (1.0) | ||
// This is an automatically generated file. Please do not edit it. | ||
// It will be re-generated if the cmake flag ALLOW_DEVICE_PARAM_PARSER_GERNERATION is ON. | ||
|
||
// Generated on: Fri Feb 9 20:17:51 2024 | ||
|
||
|
||
#ifndef FAKEANALOGSENSOR_PARAMSPARSER_H | ||
#define FAKEANALOGSENSOR_PARAMSPARSER_H | ||
|
||
#include <yarp/os/Searchable.h> | ||
#include <yarp/dev/IDeviceDriverParams.h> | ||
#include <string> | ||
#include <cmath> | ||
|
||
/** | ||
* This class is the parameters parser for class FakeAnalogSensor. | ||
* | ||
* These are the used parameters: | ||
* | Group name | Parameter name | Type | Units | Default Value | Required | Description | Notes | | ||
* |:----------:|:--------------:|:------:|:-----:|:-------------:|:--------:|:-------------:|:----------------------:| | ||
* | - | period | double | s | 1.0 | 0 | thread period | optional, default 1.0s | | ||
* | ||
* The device can be launched by yarpdev using one of the following examples: | ||
* \code{.unparsed} | ||
* yarpdev --device FakeAnalogSensor --period 1.0 | ||
* \endcode | ||
* | ||
* \code{.unparsed} | ||
* yarpdev --device FakeAnalogSensor | ||
* \endcode | ||
* | ||
*/ | ||
|
||
class FakeAnalogSensor_ParamsParser : public yarp::dev::IDeviceDriverParams | ||
{ | ||
public: | ||
FakeAnalogSensor_ParamsParser() = default; | ||
~FakeAnalogSensor_ParamsParser() override = default; | ||
|
||
public: | ||
const std::string m_device_type = {"FakeAnalogSensor"}; | ||
bool m_parser_is_strict = false; | ||
struct parser_version_type | ||
{ | ||
int major = 1; | ||
int minor = 0; | ||
}; | ||
const parser_version_type m_parser_version; | ||
double m_period = {1.0}; | ||
|
||
bool parseParams(const yarp::os::Searchable & config) override; | ||
std::string getDeviceType() const override { return m_device_type; } | ||
std::string getDocumentationOfDeviceParams() const override; | ||
std::vector<std::string> getListOfParams() const override; | ||
}; | ||
|
||
#endif |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
* | | period | double | s | 1.0 | No | thread period | optional, default 1.0s | |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
File renamed without changes.
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,98 @@ | ||
/* | ||
* SPDX-FileCopyrightText: 2023-2023 Istituto Italiano di Tecnologia (IIT) | ||
* SPDX-License-Identifier: LGPL-2.1-or-later | ||
*/ | ||
|
||
|
||
// Generated by yarpDeviceParamParserGenerator (1.0) | ||
// This is an automatically generated file. Please do not edit it. | ||
// It will be re-generated if the cmake flag ALLOW_DEVICE_PARAM_PARSER_GERNERATION is ON. | ||
|
||
// Generated on: Fri Feb 9 20:17:51 2024 | ||
|
||
|
||
#include "FakeBattery_ParamsParser.h" | ||
#include <yarp/os/LogStream.h> | ||
#include <yarp/os/Value.h> | ||
|
||
namespace { | ||
YARP_LOG_COMPONENT(FakeBatteryParamsCOMPONENT, "yarp.device.FakeBattery") | ||
} | ||
|
||
|
||
std::vector<std::string> FakeBattery_ParamsParser::getListOfParams() const | ||
{ | ||
std::vector<std::string> params; | ||
params.push_back("period"); | ||
return params; | ||
} | ||
|
||
|
||
bool FakeBattery_ParamsParser::parseParams(const yarp::os::Searchable & config) | ||
{ | ||
//Check for --help option | ||
if (config.check("help")) | ||
{ | ||
yCInfo(FakeBatteryParamsCOMPONENT) << getDocumentationOfDeviceParams(); | ||
} | ||
|
||
std::string config_string = config.toString(); | ||
yarp::os::Property prop_check(config_string.c_str()); | ||
//Parser of parameter period | ||
{ | ||
if (config.check("period")) | ||
{ | ||
m_period = config.find("period").asFloat64(); | ||
yCInfo(FakeBatteryParamsCOMPONENT) << "Parameter 'period' using value:" << m_period; | ||
} | ||
else | ||
{ | ||
yCInfo(FakeBatteryParamsCOMPONENT) << "Parameter 'period' using DEFAULT value:" << m_period; | ||
} | ||
prop_check.unput("period"); | ||
} | ||
|
||
/* | ||
//This code check if the user set some parameter which are not check by the parser | ||
//If the parser is set in strict mode, this will generate an error | ||
if (prop_check.size() > 0) | ||
{ | ||
bool extra_params_found = false; | ||
for (auto it=prop_check.begin(); it!=prop_check.end(); it++) | ||
{ | ||
if (m_parser_is_strict) | ||
{ | ||
yCError(FakeBatteryParamsCOMPONENT) << "User asking for parameter: "<<it->name <<" which is unknown to this parser!"; | ||
extra_params_found = true; | ||
} | ||
else | ||
{ | ||
yCWarning(FakeBatteryParamsCOMPONENT) << "User asking for parameter: "<< it->name <<" which is unknown to this parser!"; | ||
} | ||
} | ||
if (m_parser_is_strict && extra_params_found) | ||
{ | ||
return false; | ||
} | ||
} | ||
*/ | ||
return true; | ||
} | ||
|
||
|
||
std::string FakeBattery_ParamsParser::getDocumentationOfDeviceParams() const | ||
{ | ||
std::string doc; | ||
doc = doc + std::string("\n=============================================\n"); | ||
doc = doc + std::string("This is the help for device: FakeBattery\n"); | ||
doc = doc + std::string("\n"); | ||
doc = doc + std::string("This is the list of the parameters accepted by the device:\n"); | ||
doc = doc + std::string("'period': thread period\n"); | ||
doc = doc + std::string("\n"); | ||
doc = doc + std::string("Here are some examples of invocation command with yarpdev, with all params:\n"); | ||
doc = doc + " yarpdev --device FakeBattery --period 1.0\n"; | ||
doc = doc + std::string("Using only mandatory params:\n"); | ||
doc = doc + " yarpdev --device FakeBattery\n"; | ||
doc = doc + std::string("=============================================\n\n"); return doc; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,64 @@ | ||
/* | ||
* SPDX-FileCopyrightText: 2023-2023 Istituto Italiano di Tecnologia (IIT) | ||
* SPDX-License-Identifier: LGPL-2.1-or-later | ||
*/ | ||
|
||
|
||
// Generated by yarpDeviceParamParserGenerator (1.0) | ||
// This is an automatically generated file. Please do not edit it. | ||
// It will be re-generated if the cmake flag ALLOW_DEVICE_PARAM_PARSER_GERNERATION is ON. | ||
|
||
// Generated on: Fri Feb 9 20:17:51 2024 | ||
|
||
|
||
#ifndef FAKEBATTERY_PARAMSPARSER_H | ||
#define FAKEBATTERY_PARAMSPARSER_H | ||
|
||
#include <yarp/os/Searchable.h> | ||
#include <yarp/dev/IDeviceDriverParams.h> | ||
#include <string> | ||
#include <cmath> | ||
|
||
/** | ||
* This class is the parameters parser for class FakeBattery. | ||
* | ||
* These are the used parameters: | ||
* | Group name | Parameter name | Type | Units | Default Value | Required | Description | Notes | | ||
* |:----------:|:--------------:|:------:|:-----:|:-------------:|:--------:|:-------------:|:----------------------:| | ||
* | - | period | double | s | 1.0 | 0 | thread period | optional, default 1.0s | | ||
* | ||
* The device can be launched by yarpdev using one of the following examples: | ||
* \code{.unparsed} | ||
* yarpdev --device FakeBattery --period 1.0 | ||
* \endcode | ||
* | ||
* \code{.unparsed} | ||
* yarpdev --device FakeBattery | ||
* \endcode | ||
* | ||
*/ | ||
|
||
class FakeBattery_ParamsParser : public yarp::dev::IDeviceDriverParams | ||
{ | ||
public: | ||
FakeBattery_ParamsParser() = default; | ||
~FakeBattery_ParamsParser() override = default; | ||
|
||
public: | ||
const std::string m_device_type = {"FakeBattery"}; | ||
bool m_parser_is_strict = false; | ||
struct parser_version_type | ||
{ | ||
int major = 1; | ||
int minor = 0; | ||
}; | ||
const parser_version_type m_parser_version; | ||
double m_period = {1.0}; | ||
|
||
bool parseParams(const yarp::os::Searchable & config) override; | ||
std::string getDeviceType() const override { return m_device_type; } | ||
std::string getDocumentationOfDeviceParams() const override; | ||
std::vector<std::string> getListOfParams() const override; | ||
}; | ||
|
||
#endif |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
* | | period | double | s | 1.0 | No | thread period | optional, default 1.0s | |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.