Simbody
3.7
|
Abstract base class representing an arbitrary value of unknown type. More...
Public Member Functions | |
virtual AbstractValue * | clone () const =0 |
Create a deep copy of this object. More... | |
virtual String | getTypeName () const =0 |
Return a human-readable form of the object type that is stored in the concrete derived class underlying this AbstractValue. More... | |
virtual String | getValueAsString () const =0 |
Return a human-readable representation of the value stored in this AbstractValue object. More... | |
virtual bool | isCompatible (const AbstractValue &other) const =0 |
Check whether the other object contains a value that is assignment- compatible with this one. More... | |
virtual void | compatibleAssign (const AbstractValue &source)=0 |
If the source contains a compatible value, assign a copy of that value into this object. More... | |
AbstractValue & | operator= (const AbstractValue &v) |
Invokes the compatibleAssign() method which will perform the assignment if the source object is compatible, or throw an exception otherwise. More... | |
template<typename T > | |
const T & | getValue () const |
Retrieve the original (type-erased)thing as read-only. More... | |
template<typename T > | |
T & | updValue () |
Retrieve the original (type-erased)thing as read-write. More... | |
virtual | ~AbstractValue () |
Related Functions | |
(Note that these are not member functions.) | |
std::ostream & | operator<< (std::ostream &o, const AbstractValue &v) |
Write a human-readable representation of an AbstractValue to an output stream, using the getValueAsString() member function. More... | |
Abstract base class representing an arbitrary value of unknown type.
This provides an ability to manipulate "values" abstractly without knowing the specific type of that value. This is useful, for example, for discrete state variables and Measures, where much of what we need to do with them is independent of their types.
|
inlinevirtual |
|
pure virtual |
Create a deep copy of this object.
Implemented in SimTK::Value< T >.
|
pure virtual |
Return a human-readable form of the object type that is stored in the concrete derived class underlying this AbstractValue.
Implemented in SimTK::Value< T >.
|
pure virtual |
Return a human-readable representation of the value stored in this AbstractValue object.
Implemented in SimTK::Value< T >.
|
pure virtual |
Check whether the other
object contains a value that is assignment- compatible with this one.
If so you can perform the assignment with the assignment operator or with compatibleAssign().
Implemented in SimTK::Value< T >.
|
pure virtual |
If the source
contains a compatible value, assign a copy of that value into this object.
Otherwise an exception is thrown.
Implemented in SimTK::Value< T >.
|
inline |
Invokes the compatibleAssign() method which will perform the assignment if the source object is compatible, or throw an exception otherwise.
|
inline |
Retrieve the original (type-erased)thing
as read-only.
The template argument must be exactly the non-reference type of the stored thing
.
|
inline |
Retrieve the original (type-erased)thing
as read-write.
The template argument must be exactly the non-reference type of the stored thing
|
related |
Write a human-readable representation of an AbstractValue to an output stream, using the getValueAsString() member function.