dynamicgraph::command::Value Class Reference

#include <dynamic-graph/value.h>

List of all members.

Public Types

enum  Type {
  NONE,
  BOOL,
  UNSIGNED,
  INT,
  FLOAT,
  DOUBLE,
  STRING,
  VECTOR,
  MATRIX,
  NB_TYPES
}

Public Member Functions

 ~Value ()
void deleteValue ()
 Value (const bool &value)
 Value (const unsigned &value)
 Value (const int &value)
 Value (const float &value)
 Value (const double &value)
 Value (const std::string &value)
 Value (const Vector &value)
 Value (const Matrix &value)
 Value (const Value &value)
 Copy constructor.
 Value ()
Value operator= (const Value &value)
Type type () const
 Return the type of the value.
const EitherType value () const
 Return the value as a castable value into the approriate type.
bool boolValue () const
unsigned unsignedValue () const
int intValue () const
float floatValue () const
double doubleValue () const
std::string stringValue () const
Vector vectorValue () const
Matrix matrixValue () const

Static Public Member Functions

static std::string typeName (Type type)
 Return the name of the type.

Public Attributes

Type type_
const void *const value_

Friends

class EitherType
DYNAMIC_GRAPH_DLLAPI friend
std::ostream & 
operator<< (std::ostream &os, const Value &value)
 Output in a stream.

Member Enumeration Documentation

Enumerator:
NONE 
BOOL 
UNSIGNED 
INT 
FLOAT 
DOUBLE 
STRING 
VECTOR 
MATRIX 
NB_TYPES 

Constructor & Destructor Documentation

dynamicgraph::command::Value::~Value ( )
dynamicgraph::command::Value::Value ( const bool &  value) [explicit]
dynamicgraph::command::Value::Value ( const unsigned &  value) [explicit]
dynamicgraph::command::Value::Value ( const int &  value) [explicit]
dynamicgraph::command::Value::Value ( const float &  value) [explicit]
dynamicgraph::command::Value::Value ( const double &  value) [explicit]
dynamicgraph::command::Value::Value ( const std::string &  value) [explicit]
dynamicgraph::command::Value::Value ( const Vector value) [explicit]
dynamicgraph::command::Value::Value ( const Matrix value) [explicit]
dynamicgraph::command::Value::Value ( const Value value)

Copy constructor.

dynamicgraph::command::Value::Value ( ) [explicit]

Member Function Documentation

bool dynamicgraph::command::Value::boolValue ( ) const
void dynamicgraph::command::Value::deleteValue ( )
double dynamicgraph::command::Value::doubleValue ( ) const
float dynamicgraph::command::Value::floatValue ( ) const
int dynamicgraph::command::Value::intValue ( ) const
Matrix dynamicgraph::command::Value::matrixValue ( ) const
Value dynamicgraph::command::Value::operator= ( const Value value)
std::string dynamicgraph::command::Value::stringValue ( ) const
Type dynamicgraph::command::Value::type ( ) const

Return the type of the value.

static std::string dynamicgraph::command::Value::typeName ( Type  type) [static]

Return the name of the type.

unsigned dynamicgraph::command::Value::unsignedValue ( ) const
const EitherType dynamicgraph::command::Value::value ( ) const

Return the value as a castable value into the approriate type.

For instance,

 Value v1(5.0); // v1 is of type double
 Value v2(3);   // v2 is of type int
 double x1 = v1.value();
 double x2 = v2.value();

The first assignment will succeed, while the second one will throw an exception.

Vector dynamicgraph::command::Value::vectorValue ( ) const

Friends And Related Function Documentation

friend class EitherType [friend]
DYNAMIC_GRAPH_DLLAPI friend std::ostream& operator<< ( std::ostream &  os,
const Value value 
) [friend]

Output in a stream.


Member Data Documentation