foxglove_bridge_base
include
foxglove_bridge
parameter.hpp
Go to the documentation of this file.
1
#pragma once
2
3
#include <any>
4
#include <stdint.h>
5
#include <string>
6
#include <unordered_map>
7
#include <vector>
8
9
namespace
foxglove
{
10
11
enum class
ParameterSubscriptionOperation
{
12
SUBSCRIBE
,
13
UNSUBSCRIBE
,
14
};
15
16
enum class
ParameterType
{
17
PARAMETER_NOT_SET
,
18
PARAMETER_BOOL
,
19
PARAMETER_INTEGER
,
20
PARAMETER_DOUBLE
,
21
PARAMETER_STRING
,
22
PARAMETER_ARRAY
,
23
PARAMETER_STRUCT
,
// ROS 1 only
24
PARAMETER_BYTE_ARRAY
,
// ROS 2 only
25
};
26
27
class
ParameterValue
{
28
public
:
29
ParameterValue
();
30
ParameterValue
(
bool
value);
31
ParameterValue
(
int
value);
32
ParameterValue
(int64_t value);
33
ParameterValue
(
double
value);
34
ParameterValue
(
const
std::string& value);
35
ParameterValue
(
const
char
* value);
36
ParameterValue
(
const
std::vector<unsigned char>& value);
37
ParameterValue
(
const
std::vector<ParameterValue>& value);
38
ParameterValue
(
const
std::unordered_map<std::string, ParameterValue>& value);
39
40
inline
ParameterType
getType
()
const
{
41
return
_type
;
42
}
43
44
template
<
typename
T>
45
inline
const
T&
getValue
()
const
{
46
return
std::any_cast<const T&>(
_value
);
47
}
48
49
private
:
50
ParameterType
_type
;
51
std::any
_value
;
52
};
53
54
class
Parameter
{
55
public
:
56
Parameter
();
57
Parameter
(
const
std::string& name);
58
Parameter
(
const
std::string& name,
const
ParameterValue
& value);
59
60
inline
const
std::string&
getName
()
const
{
61
return
_name
;
62
}
63
64
inline
ParameterType
getType
()
const
{
65
return
_value
.
getType
();
66
}
67
68
inline
const
ParameterValue
&
getValue
()
const
{
69
return
_value
;
70
}
71
72
private
:
73
std::string
_name
;
74
ParameterValue
_value
;
75
};
76
77
}
// namespace foxglove
foxglove::ParameterValue::getType
ParameterType getType() const
Definition:
parameter.hpp:40
foxglove
Definition:
base64.hpp:8
foxglove::Parameter::_name
std::string _name
Definition:
parameter.hpp:73
foxglove::ParameterType::PARAMETER_STRING
@ PARAMETER_STRING
foxglove::ParameterType::PARAMETER_ARRAY
@ PARAMETER_ARRAY
foxglove::ParameterType::PARAMETER_BYTE_ARRAY
@ PARAMETER_BYTE_ARRAY
foxglove::ParameterType::PARAMETER_BOOL
@ PARAMETER_BOOL
foxglove::ParameterSubscriptionOperation
ParameterSubscriptionOperation
Definition:
parameter.hpp:11
foxglove::ParameterType
ParameterType
Definition:
parameter.hpp:16
foxglove::ParameterType::PARAMETER_STRUCT
@ PARAMETER_STRUCT
foxglove::ParameterValue::ParameterValue
ParameterValue()
Definition:
parameter.cpp:5
foxglove::Parameter::getType
ParameterType getType() const
Definition:
parameter.hpp:64
foxglove::ParameterValue::_value
std::any _value
Definition:
parameter.hpp:51
foxglove::ParameterValue
Definition:
parameter.hpp:27
foxglove::Parameter::getName
const std::string & getName() const
Definition:
parameter.hpp:60
foxglove::ParameterSubscriptionOperation::SUBSCRIBE
@ SUBSCRIBE
foxglove::ParameterType::PARAMETER_NOT_SET
@ PARAMETER_NOT_SET
foxglove::Parameter
Definition:
parameter.hpp:54
foxglove::Parameter::Parameter
Parameter()
Definition:
parameter.cpp:35
foxglove::Parameter::_value
ParameterValue _value
Definition:
parameter.hpp:74
foxglove::Parameter::getValue
const ParameterValue & getValue() const
Definition:
parameter.hpp:68
foxglove::ParameterType::PARAMETER_DOUBLE
@ PARAMETER_DOUBLE
foxglove::ParameterType::PARAMETER_INTEGER
@ PARAMETER_INTEGER
foxglove::ParameterSubscriptionOperation::UNSUBSCRIBE
@ UNSUBSCRIBE
foxglove::ParameterValue::_type
ParameterType _type
Definition:
parameter.hpp:50
foxglove::ParameterValue::getValue
const T & getValue() const
Definition:
parameter.hpp:45
foxglove_bridge
Author(s): Foxglove
autogenerated on Tue May 20 2025 02:34:26