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

#include <portmuxgenerator.hpp>

Inheritance diagram for PortMuxGenerator:
YarpCodeGenerator

Public Member Functions

 PortMuxGenerator (int numMuxes, std::string outputName, bool toRos, std::string &output_port_name_, std::string &ros_message_name, bool fromRos)
 
 ~PortMuxGenerator ()
 
int getNumMuxes ()
 
std::string getOutputName ()
 
std::string getRosMessageName ()
 
bool getToRos ()
 
bool getFromRos ()
 
std::vector< int > getNumPorts ()
 
std::vector< std::string > getPorts ()
 
void addMuxNumPorts (int numPorts)
 
void addMuxPorts (std::string ports)
 
int getMuxNumPorts (int muxIndex)
 
std::string getMuxPorts (int muxIndex)
 
std::string generateCode ()
 

Private Member Functions

std::string extractPortFromString (int muxIndex, int portIndex)
 

Private Attributes

int numMuxes_
 
std::string outputName_
 
std::string rosMessageName_
 
bool toRos_
 
bool fromRos_
 
std::vector< int > numPorts_
 
std::vector< std::string > ports_
 
std::string output_port_name
 

Detailed Description

Class that generates the code for connecting and reading the values from the input YARP ports/ROS topics

Definition at line 8 of file portmuxgenerator.hpp.

Constructor & Destructor Documentation

PortMuxGenerator::PortMuxGenerator ( int  numMuxes,
std::string  outputName,
bool  toRos,
std::string &  output_port_name_,
std::string &  ros_message_name,
bool  fromRos 
)

Constructor

Parameters
numMuxesNumber of hubs
outputNameYARP port/ROS topic where the output will be send
toRosBoolean flag to know the type of output (ROS message or YARP Bottle)
output_port_name_Folder name where the code will be copied
ros_message_nameWhen writing to a ROS topic, this is the ROS message name
fromRosBoolean flag to know the type of inputs (ROS message or YARP Bottle)

Definition at line 9 of file portmuxgenerator.cpp.

PortMuxGenerator::~PortMuxGenerator ( )

Destructor

Definition at line 19 of file portmuxgenerator.cpp.

Member Function Documentation

void PortMuxGenerator::addMuxPorts ( std::string  ports)

Adds the ports/topics string of a hub

Parameters
portsString with comma separated ports/topics

Definition at line 52 of file portmuxgenerator.cpp.

std::string PortMuxGenerator::extractPortFromString ( int  muxIndex,
int  portIndex 
)
private

Retrieve port/topic name from wrap of ports names. Requires names separated by commas and no spaces between them.

Parameters
muxIndexHub's index in the vector of Hubs
portIndexPort's index in the ports string

Definition at line 182 of file portmuxgenerator.cpp.

std::string PortMuxGenerator::generateCode ( )
virtual

Generates the code that connects to all the YARP ports/ROS topics

Returns
String that contains the code for YARP port creation, and connection to the input YARP ports/ROS topics

Implements YarpCodeGenerator.

Definition at line 64 of file portmuxgenerator.cpp.

int PortMuxGenerator::getMuxNumPorts ( int  muxIndex)

Returns the number of ports read by the hub at muxIndex in the hub vector

Parameters
muxIndexHub index in the Hub vector
Returns
int Number of ports/topics read by the hub

Definition at line 56 of file portmuxgenerator.cpp.

std::string PortMuxGenerator::getMuxPorts ( int  muxIndex)

Returns the string that contains all the YARP ports/ROS topics for the hub muxIndex

Parameters
muxIndexHub index in the Hub vector
Returns
String that contains the YARP ports/ROS topics separated by commas

Definition at line 60 of file portmuxgenerator.cpp.

Member Data Documentation

bool PortMuxGenerator::fromRos_
private

Boolean flag to know the type of inputs (ROS message or YARP Bottle)

Definition at line 71 of file portmuxgenerator.hpp.

int PortMuxGenerator::numMuxes_
private

Number of hubs

Definition at line 67 of file portmuxgenerator.hpp.

std::vector<int> PortMuxGenerator::numPorts_
private

Vector that contains the number of ports for all the hubs

Definition at line 72 of file portmuxgenerator.hpp.

std::string PortMuxGenerator::output_port_name
private

Folder name where the code will be copied

Definition at line 74 of file portmuxgenerator.hpp.

std::string PortMuxGenerator::outputName_
private

YARP port/ROS topic where the output will be send

Definition at line 68 of file portmuxgenerator.hpp.

std::vector<std::string> PortMuxGenerator::ports_
private

Vector that contains the inputs (ports/topics) for all the hubs

Definition at line 73 of file portmuxgenerator.hpp.

std::string PortMuxGenerator::rosMessageName_
private

When writing to a ROS topic, this is the ROS message name

Definition at line 69 of file portmuxgenerator.hpp.

bool PortMuxGenerator::toRos_
private

Boolean flag to know the type of output (ROS message or YARP Bottle)

Definition at line 70 of file portmuxgenerator.hpp.


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