YARP
Yet Another Robot Platform
 
Loading...
Searching...
No Matches
generate_ini.cpp
Go to the documentation of this file.
1/*
2 * SPDX-FileCopyrightText: 2024-2024 Istituto Italiano di Tecnologia (IIT)
3 * SPDX-License-Identifier: BSD-3-Clause
4 */
5
6#include "generator.h"
7#include <sstream>
8
9// Example:
10
11//((group: myGroupName)(name: myParamName)(type: string)(required: true)(units: myUnits)(defaultValue: myDefaultValue)(description: myDescription)(notes: myNotes))
12//((group: myGroupName)(name: myParamName)(type: string)(required: true)(units: myUnits)(defaultValue: myDefaultValue)(description: myDescription)(notes: myNotes))
13//((group: myGroupName)(name: myParamName)(type: string)(required: true)(units: myUnits)(defaultValue: myDefaultValue)(description: myDescription)(notes: myNotes)(optionalVariableName: myVar))
14//((group: myGroupName)(name: myParamName)(type: string)(required: true)(units: myUnits)(defaultValue: myDefaultValue)(description: myDescription)(notes: myNotes))
15
17{
18 std::ostringstream s;
19 for (auto param : m_params)
20 {
21 std::string paramGroup = param.getFullGroupOnlyName();
22 std::string paramName = param.getParamOnly();
23 std::string type = param.type;
24 std::string units = param.units;
25 std::string defaultValue = param.defaultValue;
26 std::string description = param.description;
27 std::string notes = param.notes;
28 if (paramGroup.empty()) paramGroup="-";
29 if (paramName.empty()) paramName = "-";
30 if (type.empty()) type = "-";
31 if (units.empty()) units = "-";
32 if (defaultValue.empty()) defaultValue = "-";
33 if (description.empty()) description = "-";
34 if (notes.empty()) notes = "-";
35
36 s << "(";
37 s << "(group: " << paramGroup << " )";
38 s << "(name: " << paramName << " )";
39 s << "(type: " << type << " )";
40 s << "(units: " << units << " )";
41 s << "(defaultValue: " << defaultValue << " )";
42 s << "(required: " << param.required << " )";
43 s << "(description: " << description << " )";
44 s << "(notes: " << notes << " )";
45 if (!param.optional_variable_name.empty())
46 {
47 s << "(optionalVariableName: " << param.optional_variable_name << " )";
48 }
49 s << "(notes: " << notes << " )";
50 s << ")\n";
51 }
52 return s.str();
53}
std::string generateIniParams()
std::deque< Parameter > m_params
Definition generator.h:34