dynamicgraph::command::Value Class Reference

#include <dynamic-graph/value.h>

Public Types

enum  Type {
  NONE,
  BOOL,
  UNSIGNED,
  INT,
  FLOAT,
  DOUBLE,
  STRING,
  VECTOR,
  MATRIX,
  MATRIX4D,
  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 Eigen::MatrixXd &value)
 
 Value (const Eigen::Matrix4d &value)
 
 Value (const Value &value)
 Copy constructor. More...
 
 Value ()
 
Value operator= (const Value &value)
 
Type type () const
 Return the type of the value. More...
 
const EitherType value () const
 Return the value as a castable value into the approriate type. More...
 
bool boolValue () const
 
unsigned unsignedValue () const
 
int intValue () const
 
float floatValue () const
 
double doubleValue () const
 
std::string stringValue () const
 
Vector vectorValue () const
 
Eigen::MatrixXd matrixXdValue () const
 
Eigen::Matrix4d matrix4dValue () const
 

Static Public Member Functions

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

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. More...
 

Member Enumeration Documentation

Enumerator
NONE 
BOOL 
UNSIGNED 
INT 
FLOAT 
DOUBLE 
STRING 
VECTOR 
MATRIX 
MATRIX4D 
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 Eigen::MatrixXd &  value)
explicit
dynamicgraph::command::Value::Value ( const Eigen::Matrix4d &  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
Eigen::Matrix4d dynamicgraph::command::Value::matrix4dValue ( ) const
Eigen::MatrixXd dynamicgraph::command::Value::matrixXdValue ( ) 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

Type dynamicgraph::command::Value::type_
const void* const dynamicgraph::command::Value::value_