1 #ifndef SimTK_SimTKCOMMON_VALUE_H_ 2 #define SimTK_SimTKCOMMON_VALUE_H_ 70 explicit Value(
const T& t) : thing(t) { }
78 operator const T&()
const {
return thing; }
79 operator T&() {
return thing; }
81 const T&
get()
const {
return thing; }
84 void set(
const T& t) { thing = t; }
85 T&
upd() {
return thing; }
107 #endif // SimTK_SimTKCOMMON_VALUE_H_ Value & operator=(const T &t)
Definition: Value.h:77
#define SimTK_DOWNCAST(Derived, Parent)
Add public static method declaration in class derived from an abstract parent to assist in downcastin...
Definition: SimTKcommon/include/SimTKcommon/internal/common.h:554
virtual void compatibleAssign(const AbstractValue &)=0
Value()
Definition: Value.h:69
This is the top-level SimTK namespace into which all SimTK names are placed to avoid collision with o...
Definition: Assembler.h:37
static std::string namestr()
The default implementation of namestr() attempts to return a nicely demangled type name on all platfo...
Definition: SimTKcommon/include/SimTKcommon/internal/common.h:769
T & upd()
Definition: Value.h:85
void compatibleAssign(const AbstractValue &v)
Definition: Value.h:88
AbstractValue & operator=(const AbstractValue &v)
Definition: Value.h:51
#define SimTK_THROW2(exc, a1, a2)
Definition: Exception.h:313
virtual AbstractValue * clone() const =0
virtual String getTypeName() const =0
Definition: Exception.h:260
String getTypeName() const
Definition: Value.h:92
virtual String getValueAsString() const =0
std::ostream & operator<<(std::ostream &o, const ContactForce &f)
Definition: CompliantContactSubsystem.h:387
Value & operator=(const Value &v)
Definition: Value.h:75
String getValueAsString() const
Definition: Value.h:94
SimTK::String is a plug-compatible std::string replacement (plus some additional functionality) inten...
Definition: String.h:62
Abstract base class representing an arbitrary value of self-describing type.
Definition: Value.h:41
Mandatory first inclusion for any Simbody source or header file.
AbstractValue * clone() const
Definition: Value.h:97
T thing
Definition: Value.h:100
AbstractValue()
Definition: Value.h:43
bool isCompatible(const AbstractValue &v) const
Definition: Value.h:87
virtual bool isCompatible(const AbstractValue &) const =0
Value(const T &t)
Definition: Value.h:70
virtual ~AbstractValue()
Definition: Value.h:44
Templatized version of the abstract class, providing generic type-specific functionality that does no...
Definition: Value.h:67