Simox  2.3.49
VirtualRobot::BaseIO Class Reference
Inheritance diagram for VirtualRobot::BaseIO:
VirtualRobot::ObjectIO VirtualRobot::RobotIO VirtualRobot::SceneIO

Static Public Member Functions

static void makeAbsolutePath (const std::string &basePath, std::string &filename)
 
static void makeRelativePath (const std::string &basePath, std::string &filename)
 
static bool writeXMLFile (const std::string &filename, const std::string &content, bool overwrite=true)
 
static bool isTrue (const char *s)
 
static float convertToFloat (const char *s)
 
static int convertToInt (const char *s)
 
static void processNodeList (rapidxml::xml_node< char > *parentNode, RobotPtr robot, std::vector< RobotNodePtr > &nodeList, bool clearList=true)
 
static void processLimitsNode (rapidxml::xml_node< char > *limitsXMLNode, float &jointLimitLo, float &jointLimitHi)
 
static std::string processFileNode (rapidxml::xml_node< char > *fileNode, const std::string &basePath)
 
static void processTransformNode (rapidxml::xml_node< char > *transformXMLNode, const std::string &nodeName, Eigen::Matrix4f &transform)
 
static Units getUnitsAttribute (rapidxml::xml_node< char > *node, Units::UnitsType u)
 
static std::string processNameAttribute (rapidxml::xml_node< char > *node, bool allowOtherAttributes=false)
 
static float processFloatAttribute (const std::string &attributeName, rapidxml::xml_node< char > *node, bool allowOtherAttributes=false)
 
static int processIntAttribute (const std::string &attributeName, rapidxml::xml_node< char > *node, bool allowOtherAttributes=false)
 
static float getFloatByAttributeName (rapidxml::xml_node< char > *xmlNode, const std::string &attributeName)
 
static float getOptionalFloatByAttributeName (rapidxml::xml_node< char > *xmlNode, const std::string &attributeName, float standardValue)
 
static bool processConfigurationNode (rapidxml::xml_node< char > *configXMLNode, std::vector< RobotConfig::Configuration > &storeConfigDefinitions, std::string &storeConfigName)
 
static bool processConfigurationNodeList (rapidxml::xml_node< char > *configXMLNode, std::vector< std::vector< RobotConfig::Configuration > > &configDefinitions, std::vector< std::string > &configNames, std::vector< std::string > &tcpNames)
 
static std::string getLowerCase (const char *c)
 
static void getLowerCase (std::string &aString)
 
static std::string processStringAttribute (const std::string &attributeName, rapidxml::xml_node< char > *node, bool allowOtherAttributes=false)
 
static VisualizationNodePtr processVisualizationTag (rapidxml::xml_node< char > *visuXMLNode, const std::string &tagName, const std::string &basePath, bool &useAsColModel)
 
static CollisionModelPtr processCollisionTag (rapidxml::xml_node< char > *colXMLNode, const std::string &tagName, const std::string &basePath)
 
static std::vector< Primitive::PrimitivePtrprocessPrimitives (rapidxml::xml_node< char > *primitivesXMLNode)
 
static void processPhysicsTag (rapidxml::xml_node< char > *physicsXMLNode, const std::string &nodeName, SceneObject::Physics &physics)
 
static RobotNodeSetPtr processRobotNodeSet (rapidxml::xml_node< char > *setXMLNode, RobotPtr robo, const std::string &robotRootNode, int &robotNodeSetCounter)
 
static TrajectoryPtr processTrajectory (rapidxml::xml_node< char > *trajectoryXMLNode, std::vector< RobotPtr > &robots)
 
static Eigen::Matrix3f process3x3Matrix (rapidxml::xml_node< char > *matrixXMLNode)
 
static bool processFloatValueTags (rapidxml::xml_node< char > *XMLNode, int dim, Eigen::VectorXf &stroreResult)
 
static bool hasUnitsAttribute (rapidxml::xml_node< char > *node)
 
static std::vector< UnitsgetUnitsAttributes (rapidxml::xml_node< char > *node)
 
static void getAllAttributes (rapidxml::xml_node< char > *node, const std::string &attrString, std::vector< std::string > &storeValues)
 
static void processDHNode (rapidxml::xml_node< char > *dhXMLNode, DHParameter &dh)
 
static std::string toXML (const Eigen::Matrix4f &m, std::string ident="\t")
 
static std::vector< VisualizationNodePtrprocessVisuFiles (rapidxml::xml_node< char > *visualizationXMLNode, const std::string &basePath, std::string &fileType)
 

Protected Member Functions

 BaseIO ()
 
virtual ~BaseIO ()
 

Static Protected Attributes

static boost::mutex mutex
 

Detailed Description

Several basic XML IO methods.

See also
RobotIO, SceneIO, ObjectIO

Constructor & Destructor Documentation

VirtualRobot::BaseIO::BaseIO ( )
protected
VirtualRobot::BaseIO::~BaseIO ( )
protectedvirtual

Member Function Documentation

float VirtualRobot::BaseIO::convertToFloat ( const char *  s)
static

This method converts s into a float value and returns it. If s is NULL or not a string representation of a float a VirtualRobot::VirtualRobotException is thrown.

Parameters
sthe string to convert to float
Returns
the passed in float value
int VirtualRobot::BaseIO::convertToInt ( const char *  s)
static
void VirtualRobot::BaseIO::getAllAttributes ( rapidxml::xml_node< char > *  node,
const std::string &  attrString,
std::vector< std::string > &  storeValues 
)
static
float VirtualRobot::BaseIO::getFloatByAttributeName ( rapidxml::xml_node< char > *  xmlNode,
const std::string &  attributeName 
)
static

This method gets the attribute attributeName from xml_node xmlNode and returns its value as float. If an error occurs (NULL data, missing attribute, conversion failed) a VirtualRobot::VirtualRobotException is thrown.

std::string VirtualRobot::BaseIO::getLowerCase ( const char *  c)
static

This method creates a std::string from the parameter c and calls VirtualRobot::BaseIO::getLowerCase(std::string) on the created string. Afterwards the transformed string is returned.

void VirtualRobot::BaseIO::getLowerCase ( std::string &  aString)
static

This method applies tolower() to all characters in the string aString.

float VirtualRobot::BaseIO::getOptionalFloatByAttributeName ( rapidxml::xml_node< char > *  xmlNode,
const std::string &  attributeName,
float  standardValue 
)
static

This method gets an optional attribute attributeName from xml_node xmlNode and returns its value as float. When no attribute attributeName is present the standardValue is returned.

Units VirtualRobot::BaseIO::getUnitsAttribute ( rapidxml::xml_node< char > *  node,
Units::UnitsType  u 
)
static

This method processes the unit, units, unitsAngle, unitsLength, unitsTime or unitsWeight attribute of xml_node node. The first matching unit is returned.

Returns
instance of VirtualRobot::Units
std::vector< Units > VirtualRobot::BaseIO::getUnitsAttributes ( rapidxml::xml_node< char > *  node)
static
bool VirtualRobot::BaseIO::hasUnitsAttribute ( rapidxml::xml_node< char > *  node)
static
bool VirtualRobot::BaseIO::isTrue ( const char *  s)
static
void VirtualRobot::BaseIO::makeAbsolutePath ( const std::string &  basePath,
std::string &  filename 
)
static
void VirtualRobot::BaseIO::makeRelativePath ( const std::string &  basePath,
std::string &  filename 
)
static
Eigen::Matrix3f VirtualRobot::BaseIO::process3x3Matrix ( rapidxml::xml_node< char > *  matrixXMLNode)
static
CollisionModelPtr VirtualRobot::BaseIO::processCollisionTag ( rapidxml::xml_node< char > *  colXMLNode,
const std::string &  tagName,
const std::string &  basePath 
)
static
bool VirtualRobot::BaseIO::processConfigurationNode ( rapidxml::xml_node< char > *  configXMLNode,
std::vector< RobotConfig::Configuration > &  storeConfigDefinitions,
std::string &  storeConfigName 
)
static
bool VirtualRobot::BaseIO::processConfigurationNodeList ( rapidxml::xml_node< char > *  configXMLNode,
std::vector< std::vector< RobotConfig::Configuration > > &  configDefinitions,
std::vector< std::string > &  configNames,
std::vector< std::string > &  tcpNames 
)
static
void VirtualRobot::BaseIO::processDHNode ( rapidxml::xml_node< char > *  dhXMLNode,
DHParameter dh 
)
static
std::string VirtualRobot::BaseIO::processFileNode ( rapidxml::xml_node< char > *  fileNode,
const std::string &  basePath 
)
static
float VirtualRobot::BaseIO::processFloatAttribute ( const std::string &  attributeName,
rapidxml::xml_node< char > *  node,
bool  allowOtherAttributes = false 
)
static

This method takes a rapidxml::xml_node and returns the value of the first tag it finds with name attributeName. If an error occurs an exception is thrown If more than one name attribute is found an exception is thrown. If no attribute can be found 0.0 is returned.

Warning
Do NOT use this method if there are several attributes which need to be processed (or set allowOtherAttributes to silently ignore other attributes)
Returns
the value of the attribute or 0.0 if no attribute was found
bool VirtualRobot::BaseIO::processFloatValueTags ( rapidxml::xml_node< char > *  XMLNode,
int  dim,
Eigen::VectorXf &  stroreResult 
)
static
int VirtualRobot::BaseIO::processIntAttribute ( const std::string &  attributeName,
rapidxml::xml_node< char > *  node,
bool  allowOtherAttributes = false 
)
static

This method takes a rapidxml::xml_node and returns the value of the first tag it finds with name attributeName. If an error occurs an exception is thrown If more than one name attribute is found an exception is thrown. If no attribute can be found 0 is returned.

Warning
Do NOT use this method if there are several attributes which need to be processed (or set allowOtherAttributes to silently ignore other attributes)
Returns
the value of the attribute or 0.0 if no attribute was found
static void VirtualRobot::BaseIO::processLimitsNode ( rapidxml::xml_node< char > *  limitsXMLNode,
float &  jointLimitLo,
float &  jointLimitHi 
)
static
std::string VirtualRobot::BaseIO::processNameAttribute ( rapidxml::xml_node< char > *  node,
bool  allowOtherAttributes = false 
)
static

This method takes a rapidxml::xml_node and returns the value of the first name tag it finds. If an error occurs a message is logged to the console and an empty string is returned. If more than one name attribute is found an exception is thrown.

Warning
Do NOT use this method if there are several attributes which need to be processed (or set allowOtherAttributes to silently ignore other attributes)
Returns
the value of the name attribute or an empty string on error
void VirtualRobot::BaseIO::processNodeList ( rapidxml::xml_node< char > *  parentNode,
RobotPtr  robot,
std::vector< RobotNodePtr > &  nodeList,
bool  clearList = true 
)
static

This method processes the parentNode Tag and extracts a list of <Node name="xyz"/> tags. All other child tags raise a VirtualRobot::VirtualRobotException. The resulting nodes are stored in nodeList.

If the parameter clearList is true all elements from nodeList are removed.

void VirtualRobot::BaseIO::processPhysicsTag ( rapidxml::xml_node< char > *  physicsXMLNode,
const std::string &  nodeName,
SceneObject::Physics physics 
)
static
std::vector< Primitive::PrimitivePtr > VirtualRobot::BaseIO::processPrimitives ( rapidxml::xml_node< char > *  primitivesXMLNode)
static
RobotNodeSetPtr VirtualRobot::BaseIO::processRobotNodeSet ( rapidxml::xml_node< char > *  setXMLNode,
RobotPtr  robo,
const std::string &  robotRootNode,
int &  robotNodeSetCounter 
)
static
std::string VirtualRobot::BaseIO::processStringAttribute ( const std::string &  attributeName,
rapidxml::xml_node< char > *  node,
bool  allowOtherAttributes = false 
)
static

This method takes a rapidxml::xml_node and returns the value of the first tag it finds with name attributeName. If an error occurs a message is logged to the console and "" is returned. If more than one name attribute is found an exception is thrown. If no attribute can be found 0.0 is returned.

Warning
Do NOT use this method if there are several attributes which need to be processed (or set allowOtherAttributes to silently ignore other attributes)
Returns
the value of the name attribute or an empty string on error
TrajectoryPtr VirtualRobot::BaseIO::processTrajectory ( rapidxml::xml_node< char > *  trajectoryXMLNode,
std::vector< RobotPtr > &  robots 
)
static
void VirtualRobot::BaseIO::processTransformNode ( rapidxml::xml_node< char > *  transformXMLNode,
const std::string &  tagName,
Eigen::Matrix4f &  transform 
)
static

This method processes <Transform> tags. If transformXMLNode is NULL (e.g. the tag does not exist) transform is set to contain the identity matrix.

VisualizationNodePtr VirtualRobot::BaseIO::processVisualizationTag ( rapidxml::xml_node< char > *  visuXMLNode,
const std::string &  tagName,
const std::string &  basePath,
bool &  useAsColModel 
)
static
std::vector< VisualizationNodePtr > VirtualRobot::BaseIO::processVisuFiles ( rapidxml::xml_node< char > *  visualizationXMLNode,
const std::string &  basePath,
std::string &  fileType 
)
static
std::string VirtualRobot::BaseIO::toXML ( const Eigen::Matrix4f &  m,
std::string  ident = "\t" 
)
static
bool VirtualRobot::BaseIO::writeXMLFile ( const std::string &  filename,
const std::string &  content,
bool  overwrite = true 
)
static

Create a file and store XML content.

Parameters
filenameThe filename
contentThe XML content as string. No checks are performed.
overwriteIf true, a potentially existing file is silently overwritten.
Returns
True on success

Field Documentation

boost::mutex VirtualRobot::BaseIO::mutex
staticprotected