template<typename T>
class maliput::drake::Value< T >
A container class for an arbitrary type T (with some restrictions).
This class inherits from AbstractValue and therefore at runtime can be passed between functions without mentioning T.
Example:
void print_string(const AbstractValue& arg) {
const std::string& message = arg.get_value<std::string>();
std::cerr << message;
}
void meow() {
const Value<std::string> value("meow");
print_string(value);
}
(Advanced.) User-defined classes with additional features may subclass Value, but should take care to override Clone().
- Template Parameters
-
T | Must be copy-constructible or cloneable. Must not be a pointer, array, nor have const, volatile, or reference qualifiers. |
|
template<typename T1 = T, typename = typename std::enable_if_t<std::is_default_constructible_v<T1>>> |
| Value () |
| Constructs a Value<T> using T's default constructor, if available. More...
|
|
| Value (const T &v) |
| Constructs a Value<T> by copying or cloning the given value v . More...
|
|
template<typename Arg1 , typename... Args, typename = typename internal::ValueForwardingCtorEnabled<true, T, Arg1, Args...>> |
| Value (Arg1 &&arg1, Args &&... args) |
| Constructs a Value<T> by forwarding the given args to T's constructor, if available. More...
|
|
template<typename Arg1 , typename... Args, typename = void, typename = typename internal::ValueForwardingCtorEnabled<false, T, Arg1, Args...>> |
| Value (Arg1 &&arg1, Args &&... args) |
|
| Value (std::unique_ptr< T > v) |
| Constructs a Value<T> by copying or moving the given value v . More...
|
|
| ~Value () override |
|
const T & | get_value () const |
| Returns a const reference to the stored value. More...
|
|
T & | get_mutable_value () |
| Returns a mutable reference to the stored value. More...
|
|
void | set_value (const T &v) |
| Replaces the stored value with a new one. More...
|
|
std::unique_ptr< AbstractValue > | Clone () const override |
|
void | SetFrom (const AbstractValue &other) override |
|
const std::type_info & | type_info () const final |
|
const std::type_info & | static_type_info () const final |
|
std::string | GetNiceTypeName () const |
| Returns a human-readable name for the underlying type T. More...
|
|
virtual const std::type_info & | static_type_info () const=0 |
| Returns typeid(T) for this Value<T> object. More...
|
|