dynamic-graph  4.4.3
Dynamic graph library
Value Class Reference

This class implements a variant design pattern to handle basic types in Command. More...

#include <dynamic-graph/value.h>

Public Types

enum  Type {
  NONE , BOOL , UNSIGNED , UNSIGNEDLONGINT ,
  INT , LONGINT , FLOAT , DOUBLE ,
  STRING , VECTOR , MATRIX , MATRIX4D ,
  VALUES , NB_TYPES
}
 

Public Member Functions

 Value (const bool &value)
 
 Value (const double &value)
 
 Value (const Eigen::Matrix4d &value)
 
 Value (const Eigen::MatrixXd &value)
 
 Value (const float &value)
 
 Value (const std::int32_t &value)
 
 Value (const std::int64_t &value)
 
 Value (const std::string &value)
 
 Value (const std::uint32_t &value)
 
 Value (const std::uint64_t &value)
 
 Value (const Value &value)
 Copy constructor.
 
 Value (const Values &value)
 
 Value (const Vector &value)
 
bool boolValue () const
 
const Values & constValuesValue () const
 
void deleteValue ()
 
double doubleValue () const
 
float floatValue () const
 
std::int32_t intValue () const
 
std::int64_t longintValue () const
 
Eigen::Matrix4d matrix4dValue () const
 
Eigen::MatrixXd matrixXdValue () const
 
Value operator= (const Value &value)
 
bool operator== (const Value &other) const
 
std::string stringValue () const
 
Type type () const
 Return the type of the value.
 
std::uint64_t unsignedlongintValue () const
 
std::uint32_t unsignedValue () const
 
const EitherType value () const
 
Values valuesValue () const
 
Vector vectorValue () 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.
 

Detailed Description

This class implements a variant design pattern to handle basic types in Command.

Definition at line 51 of file value.h.

Member Function Documentation

◆ value()

const EitherType 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.


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