Fawkes API  Fawkes Development Version
fawkes::gpp::ValueToFieldVisitor Class Reference

A visitor that converts a gologpp::Value to an interface field value. More...

Inheritance diagram for fawkes::gpp::ValueToFieldVisitor:

Public Member Functions

 ValueToFieldVisitor (InterfaceFieldIterator *field, unsigned int index=0)
 Constructor. More...
 
void operator() (unsigned int v)
 Convert the given value and set the field accordingly. More...
 
void operator() (int v)
 Convert the given value and set the field accordingly. More...
 
void operator() (unsigned long v)
 Convert the given value and set the field accordingly. More...
 
void operator() (long v)
 Convert the given value and set the field accordingly. More...
 
void operator() (double v)
 Convert the given value and set the field accordingly. More...
 
void operator() (std::string v)
 Convert the given value and set the field accordingly. More...
 
void operator() (bool v)
 Convert the given value and set the field accordingly. More...
 
void operator() (gologpp::CompoundType::Representation v)
 Not implemented yet. More...
 
void operator() (gologpp::ListType::Representation v)
 Convert the given list by calling a visitor recursively for each item of the list. More...
 
void operator() (void *v)
 Golog++ does not support void* types. More...
 

Detailed Description

A visitor that converts a gologpp::Value to an interface field value.

The visitor checks the types of the input gologpp::Value and the ouput InterfaceFieldIterator. If they match, the field is set. Otherwise, an exception is thrown.

Definition at line 36 of file utils.h.

Constructor & Destructor Documentation

◆ ValueToFieldVisitor()

fawkes::gpp::ValueToFieldVisitor::ValueToFieldVisitor ( InterfaceFieldIterator field,
unsigned int  index = 0 
)

Constructor.

Parameters
fieldThe field to set.
indexThe index to set if field is an array.

Definition at line 42 of file utils.cpp.

Member Function Documentation

◆ operator()() [1/10]

void fawkes::gpp::ValueToFieldVisitor::operator() ( bool  v)

Convert the given value and set the field accordingly.

Parameters
vThe value to set the field to.

Definition at line 142 of file utils.cpp.

References fawkes::InterfaceFieldIterator::get_type(), fawkes::InterfaceFieldIterator::get_typename(), fawkes::IFT_BOOL, and fawkes::InterfaceFieldIterator::set_bool().

◆ operator()() [2/10]

void fawkes::gpp::ValueToFieldVisitor::operator() ( double  v)

Convert the given value and set the field accordingly.

Parameters
vThe value to set the field to.

Definition at line 107 of file utils.cpp.

References fawkes::InterfaceFieldIterator::get_type(), fawkes::InterfaceFieldIterator::get_typename(), fawkes::IFT_DOUBLE, fawkes::IFT_FLOAT, fawkes::InterfaceFieldIterator::set_double(), and fawkes::InterfaceFieldIterator::set_float().

◆ operator()() [3/10]

void fawkes::gpp::ValueToFieldVisitor::operator() ( gologpp::CompoundType::Representation  v)

Not implemented yet.

Parameters
vThe value to set the field to.

Definition at line 165 of file utils.cpp.

References fawkes::InterfaceFieldIterator::get_type(), and fawkes::InterfaceFieldIterator::get_typename().

◆ operator()() [4/10]

void fawkes::gpp::ValueToFieldVisitor::operator() ( gologpp::ListType::Representation  v)

Convert the given list by calling a visitor recursively for each item of the list.

Parameters
vThe value to set the field to.

Definition at line 176 of file utils.cpp.

◆ operator()() [5/10]

void fawkes::gpp::ValueToFieldVisitor::operator() ( int  v)

Convert the given value and set the field accordingly.

Parameters
vThe value to set the field to.

Definition at line 67 of file utils.cpp.

References fawkes::InterfaceFieldIterator::get_type(), fawkes::InterfaceFieldIterator::get_typename(), fawkes::IFT_INT32, fawkes::IFT_INT64, fawkes::InterfaceFieldIterator::set_int32(), and fawkes::InterfaceFieldIterator::set_int64().

◆ operator()() [6/10]

void fawkes::gpp::ValueToFieldVisitor::operator() ( long  v)

Convert the given value and set the field accordingly.

Parameters
vThe value to set the field to.

Definition at line 94 of file utils.cpp.

References fawkes::InterfaceFieldIterator::get_type(), fawkes::InterfaceFieldIterator::get_typename(), fawkes::IFT_INT64, fawkes::IFT_UINT32, fawkes::InterfaceFieldIterator::set_int64(), and fawkes::InterfaceFieldIterator::set_uint32().

◆ operator()() [7/10]

void fawkes::gpp::ValueToFieldVisitor::operator() ( std::string  v)

◆ operator()() [8/10]

◆ operator()() [9/10]

void fawkes::gpp::ValueToFieldVisitor::operator() ( unsigned long  v)

◆ operator()() [10/10]

void fawkes::gpp::ValueToFieldVisitor::operator() ( void *  v)

Golog++ does not support void* types.

Thus, this always throws.

Parameters
vThe value to set the field to.

Definition at line 154 of file utils.cpp.

References fawkes::InterfaceFieldIterator::get_type(), and fawkes::InterfaceFieldIterator::get_typename().


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