Drake
AbstractValue Class Referenceabstract

A fully type-erased container class. More...

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

Inheritance diagram for AbstractValue:

Public Member Functions

 AbstractValue ()
 
virtual ~AbstractValue ()
 
virtual std::unique_ptr< AbstractValueClone () const =0
 Returns a copy of this AbstractValue. More...
 
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

A fully type-erased container class.

Only Value<T> should inherit directly from AbstractValue. User-defined classes that define additional type-erased features should inherit from Value<T>.

Constructor & Destructor Documentation

AbstractValue ( )
inline
virtual ~AbstractValue ( )
inlinevirtual

Member Function Documentation

virtual std::unique_ptr<AbstractValue> Clone ( ) const
pure virtual

Returns a copy of this AbstractValue.

Implemented in Value< T >.

Here is the caller graph for this function:

T* GetMutableValue ( )
inline

Returns the value wrapped in this AbstractValue, which must be of exactly type T.

T cannot be a superclass, abstract or otherwise. In Debug builds, if the types don't match, std::bad_cast will be thrown. In Release builds, this is not guaranteed. Intentionally not const: holders of const references to the AbstractValue should not be able to mutate the value it contains.

Here is the caller graph for this function:

const T& GetValue ( ) const
inline

Returns the value wrapped in this AbstractValue, which must be of exactly type T.

T cannot be a superclass, abstract or otherwise. In Debug builds, if the types don't match, std::bad_cast will be thrown. In Release builds, this is not guaranteed.

Here is the caller graph for this function:

void SetValue ( const T &  value_to_set)
inline

Sets the value wrapped in this AbstractValue, which must be of exactly type T.

T cannot be a superclass, abstract or otherwise.

Parameters
value_to_setThe value to be copied into this AbstractValue. In Debug builds, if the types don't match, std::bad_cast will be thrown. In Release builds, this is not guaranteed.

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