Control Libraries 7.4.0
Loading...
Searching...
No Matches
parameter_container.hpp
1#pragma once
2
3#include "state_representation_bindings.hpp"
4
5#include <state_representation/State.hpp>
6#include <state_representation/geometry/Ellipsoid.hpp>
7#include <state_representation/parameters/Parameter.hpp>
8
9namespace py_parameter {
10
12 int int_value = int();
13 std::vector<int> int_array_value = std::vector<int>();
14 double double_value = double();
15 std::vector<double> double_array_value = std::vector<double>();
16 bool bool_value = bool();
17 std::vector<bool> bool_array_value= std::vector<bool>();
18 std::string string_value = std::string();
19 std::vector<std::string> string_array_value = std::vector<std::string>();
20 std::shared_ptr<State> state_pointer;
21 Eigen::MatrixXd matrix_value = Eigen::MatrixXd();
22 Eigen::VectorXd vector_value = Eigen::VectorXd();
23};
24
26public:
28 const std::string& name, const ParameterType& type, const StateType& parameter_state_type = StateType::NONE
29 );
31 const std::string& name, const py::object& value, const ParameterType& type,
32 const StateType& parameter_state_type = StateType::NONE
33 );
34 ParameterContainer(const ParameterContainer& parameter);
35
36 void set_value(py::object value);
37
38 py::object get_value() const;
39
40 void reset();
41
42 ParameterValues values;
43};
44
45ParameterContainer interface_ptr_to_container(const std::shared_ptr<ParameterInterface>& parameter);
46
47std::shared_ptr<ParameterInterface> container_to_interface_ptr(const ParameterContainer& parameter);
48
49template<typename T>
50inline Parameter<T> container_to_parameter(const ParameterContainer& container) {
51 if (container.is_empty()) {
52 return Parameter<T>(container.get_name());
53 } else {
54 return *container_to_interface_ptr(container)->get_parameter<T>();
55 }
56}
57
58std::map<std::string, ParameterContainer>
59interface_ptr_to_container_map(const std::map<std::string, std::shared_ptr<ParameterInterface>>& parameters);
60
61std::map<std::string, std::shared_ptr<ParameterInterface>>
62container_to_interface_ptr_map(const std::map<std::string, ParameterContainer>& parameters);
63
64std::list<ParameterContainer>
65interface_ptr_to_container_list(const std::list<std::shared_ptr<ParameterInterface>>& parameters);
66
67std::list<std::shared_ptr<ParameterInterface>>
68container_to_interface_ptr_list(const std::list<ParameterContainer>& parameters);
69
70}// namespace py_parameter
void reset()
Reset the object to a post-construction state.
Class to represent name-value pairs of different types.
Definition Parameter.hpp:18
const std::string & get_name() const
Getter of the name attribute.
Definition State.cpp:29
bool is_empty() const
Getter of the empty attribute.
Definition State.cpp:33
ParameterType
The parameter value types.
StateType
The class types inheriting from State.
Definition StateType.hpp:13