Implements the main functionalities of the high-level parser. More...
#include <stdr_parser.h>
Static Public Member Functions | |
template<class T > | |
static T | createMessage (std::string file_name) |
Creates a message from a file. | |
template<class T > | |
static void | saveMessage (T msg, std::string file_name) |
Saves a stdr_msgs::Noise message to a file. | |
Private Member Functions | |
Parser (void) | |
Default constructor. | |
Static Private Member Functions | |
static bool | eliminateFilenames (Node *n) |
Recursive function - Expands the 'filename' nodes and eliminates them. | |
static bool | mergeNodes (Node *n) |
Recursive function - Merges the nodes that do not exist in non_mergable_tags_. | |
static void | mergeNodesValues (Node *n) |
Merges the leaves of the xml tree, which are the value nodes. | |
static void | parse (std::string file_name) |
Parses an xml file. | |
Static Private Attributes | |
static Node * | base_node_ = new Node() |
< Base node of the parsed file |
Implements the main functionalities of the high-level parser.
Definition at line 42 of file stdr_parser.h.
stdr_parser::Parser::Parser | ( | void | ) | [private] |
static T stdr_parser::Parser::createMessage | ( | std::string | file_name | ) | [inline, static] |
Creates a message from a file.
file_name | [std::string] The filename |
Definition at line 91 of file stdr_parser.h.
bool stdr_parser::Parser::eliminateFilenames | ( | Node * | n | ) | [static, private] |
Recursive function - Expands the 'filename' nodes and eliminates them.
n | [Node*] The stdr xml tree node to begin |
< Sanity check for filename. Base and file must be the same
Definition at line 94 of file stdr_parser.cpp.
bool stdr_parser::Parser::mergeNodes | ( | Node * | n | ) | [static, private] |
Recursive function - Merges the nodes that do not exist in non_mergable_tags_.
n | [Node*] The stdr xml tree node to begin |
< Node is value
< Node's child is value
< Child is a mergable tag
< Multiple mergable tags
< Merging multiple tag's children into the first occurence
Definition at line 195 of file stdr_parser.cpp.
void stdr_parser::Parser::mergeNodesValues | ( | Node * | n | ) | [static, private] |
Merges the leaves of the xml tree, which are the value nodes.
n | [Node*] The stdr xml tree node to begin |
< Check if the node does not contain pure values
< Unique value child
Definition at line 145 of file stdr_parser.cpp.
void stdr_parser::Parser::parse | ( | std::string | file_name | ) | [static, private] |
Parses an xml file.
file_name | [std::string] The xml filename |
< Uncomment to see the internal tree structure
Definition at line 44 of file stdr_parser.cpp.
static void stdr_parser::Parser::saveMessage | ( | T | msg, |
std::string | file_name | ||
) | [inline, static] |
Saves a stdr_msgs::Noise message to a file.
msg | [T] The message |
file_name | [std::string] The filename |
Definition at line 114 of file stdr_parser.h.
Node * stdr_parser::Parser::base_node_ = new Node() [static, private] |
< Base node of the parsed file
< Static initializations
Definition at line 47 of file stdr_parser.h.