Drake
Value< T > Class Template Reference

A container class for an arbitrary type T. More...

#include <drake/systems/framework/value.h>

Inheritance diagram for Value< T >:
Collaboration diagram for Value< T >:

Public Member Functions

 Value (const T &v)
 
 Value (const Value< T > &other)=default
 
Valueoperator= (const Value< T > &other)=default
 
 Value (Value< T > &&other)=delete
 
Valueoperator= (Value< T > &&other)=delete
 
std::unique_ptr< AbstractValueClone () const override
 Returns a copy of this AbstractValue. More...
 
const T & get_value () const
 Returns a const reference to the stored value. More...
 
T * get_mutable_value ()
 Returns a mutable pointer to the stored value (never null). More...
 
void set_value (const T &v)
 Replaces the stored value with a new one. More...
 
- Public Member Functions inherited from AbstractValue
 AbstractValue ()
 
virtual ~AbstractValue ()
 
template<typename T >
const T & GetValue () const
 Returns the value wrapped in this AbstractValue, which must be of exactly type T. More...
 
template<typename T >
T * GetMutableValue ()
 Returns the value wrapped in this AbstractValue, which must be of exactly type T. More...
 
template<typename T >
void SetValue (const T &value_to_set)
 Sets the value wrapped in this AbstractValue, which must be of exactly type T. More...
 

Detailed Description

template<typename T>
class drake::systems::Value< T >

A container class for an arbitrary type T.

User-defined classes that require additional type-erased features should subclass Value<T>, taking care to define the copy constructors and override Clone().

Template Parameters
TMust be copy-constructible, and therefore not abstract.

Constructor & Destructor Documentation

Value ( const T &  v)
inlineexplicit
Value ( const Value< T > &  other)
default
Value ( Value< T > &&  other)
delete

Member Function Documentation

std::unique_ptr<AbstractValue> Clone ( ) const
inlineoverridevirtual

Returns a copy of this AbstractValue.

Implements AbstractValue.

T* get_mutable_value ( )
inline

Returns a mutable pointer to the stored value (never null).

const T& get_value ( ) const
inline

Returns a const reference to the stored value.

Value& operator= ( const Value< T > &  other)
default
Value& operator= ( Value< T > &&  other)
delete
void set_value ( const T &  v)
inline

Replaces the stored value with a new one.


The documentation for this class was generated from the following file: