YarpBottleGenerator
 All Classes Files Functions Variables Pages
Public Member Functions | Private Member Functions | Private Attributes | List of all members
BottleCreatorGenerator Class Reference

#include <bottlecreatorgenerator.hpp>

Inheritance diagram for BottleCreatorGenerator:
YarpCodeGenerator

Public Member Functions

 BottleCreatorGenerator (int numFields, const double &rate_, bool toRos)
 
 ~BottleCreatorGenerator ()
 
int getNumFields ()
 
std::vector< ChildGeneratorgetChildren ()
 
std::vector< std::string > getFieldsType ()
 
std::vector< std::string > getFieldsMsg ()
 
std::vector< std::string > getFieldsMux ()
 
void addChild (ChildGenerator &child)
 
void addFieldType (std::string type)
 
void addFieldMsg (std::string msg)
 
void addFieldMux (std::string mux)
 
void removeFirstChild ()
 
ChildGeneratorgetFirstChild ()
 
std::string getFieldType (int fieldIndex)
 
std::string getFieldMsg (int fieldIndex)
 
std::string getFieldMux (int fieldIndex)
 
std::string generateCode ()
 

Private Member Functions

std::string handleFieldGeneration (int fieldIndex)
 

Private Attributes

int numFields_
 
int listIndex_
 
bool toRos_
 
std::vector< ChildGeneratorchildren_
 
std::vector< std::string > fieldsType_
 
std::vector< std::string > fieldsMsg_
 
std::vector< std::string > fieldsMux_
 
double rate
 
double period
 

Detailed Description

Class that generates the code for building the message and sending it through the network (YARP port/ROS topic) This class represents the top level of the message hierarchy (root of the tree)

Definition at line 10 of file bottlecreatorgenerator.hpp.

Constructor & Destructor Documentation

BottleCreatorGenerator::BottleCreatorGenerator ( int  numFields,
const double &  rate_,
bool  toRos 
)

Constructor

Parameters
numFieldsNumber of items (either simple types or messages) of the message
rate_Rate at which the message will be sent (hz)
toRosBoolean flag to know the type of output (ROS message or YARP Bottle)

Definition at line 7 of file bottlecreatorgenerator.cpp.

BottleCreatorGenerator::~BottleCreatorGenerator ( )

Destructor

Definition at line 16 of file bottlecreatorgenerator.cpp.

Member Function Documentation

std::string BottleCreatorGenerator::generateCode ( )
virtual

Generates the code that builds the message for all the items in the configuration file

Returns
String that contains the code for message building and sending, considering the frequency

Implements YarpCodeGenerator.

Definition at line 76 of file bottlecreatorgenerator.cpp.

std::string BottleCreatorGenerator::handleFieldGeneration ( int  fieldIndex)
private

Generates the code that builds the message for an item of the top of the hierarchy, considering all its children in the message tree

Parameters
indexat the ChildGenerator std::vector
Returns
String that contains the code for message building

Definition at line 99 of file bottlecreatorgenerator.cpp.

Member Data Documentation

std::vector<ChildGenerator> BottleCreatorGenerator::children_
private

Vector of ChildGenerator class, that handles built-in (primitive) messages and arrays of built-in messages

Definition at line 62 of file bottlecreatorgenerator.hpp.

std::vector<std::string> BottleCreatorGenerator::fieldsMsg_
private

Vector of std::string that stores "single_value" or "list" if that is the type of the item

Definition at line 64 of file bottlecreatorgenerator.hpp.

std::vector<std::string> BottleCreatorGenerator::fieldsMux_
private

Vector of std::string that stores "mux" if that is the type of the item

Definition at line 65 of file bottlecreatorgenerator.hpp.

std::vector<std::string> BottleCreatorGenerator::fieldsType_
private

Vector of std::string that contains all the message types at the top of the message hierarchy, read from the configuration file

Definition at line 63 of file bottlecreatorgenerator.hpp.

int BottleCreatorGenerator::numFields_
private

Number of items in the message

Definition at line 59 of file bottlecreatorgenerator.hpp.

bool BottleCreatorGenerator::toRos_
private

Boolean flag to know the type of output

Definition at line 61 of file bottlecreatorgenerator.hpp.


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