Skip to content
Snippets Groups Projects
Commit 60056022 authored by Joaquim Casals Buñuel's avatar Joaquim Casals Buñuel
Browse files

Fixed doxygen to parse all files. Added comments for files related to autoconf.

parent 520a4fe9
No related branches found
No related tags found
No related merge requests found
Pipeline #3660 passed
...@@ -429,7 +429,7 @@ EXTRACT_PACKAGE = NO ...@@ -429,7 +429,7 @@ EXTRACT_PACKAGE = NO
# included in the documentation. # included in the documentation.
# The default value is: NO. # The default value is: NO.
EXTRACT_STATIC = NO EXTRACT_STATIC = YES
# If the EXTRACT_LOCAL_CLASSES tag is set to YES classes (and structs) defined # If the EXTRACT_LOCAL_CLASSES tag is set to YES classes (and structs) defined
# locally in source files will be included in the documentation. If set to NO # locally in source files will be included in the documentation. If set to NO
...@@ -756,7 +756,8 @@ WARN_LOGFILE = ...@@ -756,7 +756,8 @@ WARN_LOGFILE =
# Note: If this tag is empty the current directory is searched. # Note: If this tag is empty the current directory is searched.
INPUT = ../doc/main.dox \ INPUT = ../doc/main.dox \
../src ../src \
../include/core
# This tag can be used to specify the character encoding of the source files # This tag can be used to specify the character encoding of the source files
# that doxygen parses. Internally doxygen uses the UTF-8 encoding. Doxygen uses # that doxygen parses. Internally doxygen uses the UTF-8 encoding. Doxygen uses
......
...@@ -8,11 +8,21 @@ ...@@ -8,11 +8,21 @@
#include <iostream> #include <iostream>
#include <array> #include <array>
/**
@file
*/
namespace utils{ namespace utils{
//Typically we want to convert from/to list-type structures. In order to be general
//we define a list type which is used throughout the converter. In this case this type
//is implemented with std::vector
template <typename A> template <typename A>
using list = std::vector<A>; using list = std::vector<A>;
// template <typename A> // template <typename A>
// class toString<A>{}; // class toString<A>{};
/** @Brief Splits a comma-separated string into its pieces
* @param val is just the string of comma separated values
* @return <b>{std::vector<std::string>}</b> vector whose i-th component is the i-th comma separated value
*/
static inline std::vector<std::string> splitter(std::string val){ static inline std::vector<std::string> splitter(std::string val){
std::vector<std::string> cont = std::vector<std::string>(); std::vector<std::string> cont = std::vector<std::string>();
std::stringstream ss(val); std::stringstream ss(val);
...@@ -22,6 +32,11 @@ namespace utils{ ...@@ -22,6 +32,11 @@ namespace utils{
} }
return cont; return cont;
} }
/** @Brief Returns all the substrings of @val that match @exp
* @param val String to be matched
* @param exp Regular expression
* @return <b>{std::vector<std::string>}</b> Collection of matching subtrings
*/
static inline std::vector<std::string> getMatches(std::string val, std::regex exp){ static inline std::vector<std::string> getMatches(std::string val, std::regex exp){
std::smatch res; std::smatch res;
auto v = std::vector<std::string>(); auto v = std::vector<std::string>();
...@@ -32,10 +47,10 @@ namespace utils{ ...@@ -32,10 +47,10 @@ namespace utils{
} }
return v; return v;
} }
static inline std::vector<std::string> pairSplitter(std::string val){ /** @Brief Given a string representation of a matrix extracts the dimensions and the values
std::regex exp("(\\{[^\\{:]:.*?\\})"); * @param matrix is a string either of the form "[[N,M],[a1,a2,a3,...]]" or "[a1,a2,a3,...]"
return getMatches(val, exp); * @return <b>{std::array<std::string, 2>}</b> pair ([N,M],[a1,a2,a3,...]) or just ([a1,a2,a3...])
} */
static inline std::array<std::string,2> splitMatrixStringRepresentation(std::string matrix){ static inline std::array<std::string,2> splitMatrixStringRepresentation(std::string matrix){
std::regex rgx("\\[\\[((?:[0-9]+,?)+)\\],((?:(?:[0-9]+\\.)?[0-9]+,?)+)\\]"); std::regex rgx("\\[\\[((?:[0-9]+,?)+)\\],((?:(?:[0-9]+\\.)?[0-9]+,?)+)\\]");
std::regex rgxStatic("\\[((?:(?:[0-9]+\\.)?[0-9]+,?)+)\\]"); std::regex rgxStatic("\\[((?:(?:[0-9]+\\.)?[0-9]+,?)+)\\]");
...@@ -52,10 +67,21 @@ namespace utils{ ...@@ -52,10 +67,21 @@ namespace utils{
} }
return values; return values;
} }
/** @Brief Splits a dictionary-like string of the form {k1:v1},{k2:v2},... It is tightly coupled with splitMapStringRepresentation
* @param val is just a dictionary-like string
* @return <b>{std::vector<std::string>}</b> Collection of the strings of the form {k_i:v_i}
*/
static inline std::vector<std::string> pairSplitter(std::string val){
std::regex exp("\\{[^\\{:]:.*?\\}");
return getMatches(val, exp);
}
/** @Brief Splits a dictionary-like string of the form [{k1:v1},{k2:v2},...]
* @param str_map just a dictionary-like string
* @return <b>{std::string}</b> String {k1:v1},{k2:v2},... (notice the removed brackets)
*/
static inline std::string splitMapStringRepresentation(std::string str_map){ static inline std::string splitMapStringRepresentation(std::string str_map){
std::smatch mmatches; std::smatch mmatches;
std::regex rgxM("\\[((?:(?:\\{[^\\{:]+:[^:\\}]+\\}),?)*)\\]"); std::regex rgxM("\\[((?:(?:\\{[^\\{:]+:[^:\\}]+\\}),?)*)\\]");
// auto v = std::vector<std::string>();
std::string result = ""; std::string result = "";
if(std::regex_match(str_map, mmatches, rgxM)) { if(std::regex_match(str_map, mmatches, rgxM)) {
// v = splitter(mmatches[1].str()); // v = splitter(mmatches[1].str());
......
...@@ -15,6 +15,10 @@ namespace { ...@@ -15,6 +15,10 @@ namespace {
// for( char c : str ) if( !std::isspace(c) ) str_no_ws += c ; // for( char c : str ) if( !std::isspace(c) ) str_no_ws += c ;
// return str_no_ws ; // return str_no_ws ;
// } // }
/** @Brief Generates a string [v1,v2,v3,...] representing the YAML sequence node
* @param n a YAML::Node
* @return <b>{std::string}</b> [v1,v2,v3,...]
*/
string parseSequence(YAML::Node n){ string parseSequence(YAML::Node n){
assert(n.Type() != YAML::NodeType::Map && "Trying to parse as a Sequence a Map node"); assert(n.Type() != YAML::NodeType::Map && "Trying to parse as a Sequence a Map node");
if(n.Type() == YAML::NodeType::Scalar) return n.Scalar(); if(n.Type() == YAML::NodeType::Scalar) return n.Scalar();
...@@ -31,6 +35,10 @@ namespace { ...@@ -31,6 +35,10 @@ namespace {
aux = aux + "]"; aux = aux + "]";
return aux; return aux;
} }
/** @Brief Transforms a map<string,string> to its string representation [{k1:v1},{k2:v2},{k3:v3},...]
* @param _map just a map<string,string>
* @return <b>{std::string}</b> [{k1:v1},{k2:v2},{k3:v3},...]
*/
std::string mapToString(std::map<std::string,std::string> _map){ std::string mapToString(std::map<std::string,std::string> _map){
std::string result = ""; std::string result = "";
auto v = std::vector<string>(); auto v = std::vector<string>();
...@@ -127,10 +135,8 @@ public: ...@@ -127,10 +135,8 @@ public:
std::string parserYAML::generatePath(std::string path){ std::string parserYAML::generatePath(std::string path){
regex r("^/.*"); regex r("^/.*");
if(regex_match(path, r)){ if(regex_match(path, r)){
std::cout << "Generating path " << path << std::endl;
return path; return path;
}else{ }else{
std::cout << "Generating path " << _path_root + path << std::endl;
return _path_root + path; return _path_root + path;
} }
} }
...@@ -157,6 +163,11 @@ void parserYAML::walkTree(string file, vector<string>& tags, string hdr){ ...@@ -157,6 +163,11 @@ void parserYAML::walkTree(string file, vector<string>& tags, string hdr){
n = YAML::LoadFile(generatePath(file)); n = YAML::LoadFile(generatePath(file));
walkTreeR(n, tags, hdr); walkTreeR(n, tags, hdr);
} }
/** @Brief Recursively walks the YAML tree while filling a map with the values oarsed from the file
* @param YAML node to be parsed
* @param tags represents the path from the root of the YAML tree to the current node
* @param hdr is the name of the current YAML node
*/
void parserYAML::walkTreeR(YAML::Node n, vector<string>& tags, string hdr){ void parserYAML::walkTreeR(YAML::Node n, vector<string>& tags, string hdr){
switch (n.Type()) { switch (n.Type()) {
case YAML::NodeType::Scalar : { case YAML::NodeType::Scalar : {
...@@ -229,6 +240,9 @@ void parserYAML::walkTreeR(YAML::Node n, vector<string>& tags, string hdr){ ...@@ -229,6 +240,9 @@ void parserYAML::walkTreeR(YAML::Node n, vector<string>& tags, string hdr){
void parserYAML::updateActiveName(string tag){ void parserYAML::updateActiveName(string tag){
this->_active_name = tag; this->_active_name = tag;
} }
/** @Brief Parse the sensors, processors, callbacks and files elements of the YAML file. We assume that these elements
are defined at the top level of the YAML file.
* @param file is the path to the YAML file */
void parserYAML::parseFirstLevel(string file){ void parserYAML::parseFirstLevel(string file){
YAML::Node n; YAML::Node n;
n = YAML::LoadFile(generatePath(file)); n = YAML::LoadFile(generatePath(file));
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment