GTSAM  4.0.2
C++ library for smoothing and mapping (SAM)
Public Types | Static Public Member Functions | List of all members
gtsam::SignatureParser Struct Reference

A simple parser that replaces the boost spirit parser. More...

#include <SignatureParser.h>

Public Types

using Row = std::vector< double >
 
using Table = std::vector< Row >
 

Static Public Member Functions

static std::optional< Table > Parse (const std::string &str)
 

Detailed Description

A simple parser that replaces the boost spirit parser.

It is meant to parse strings like "1/1 2/3 1/4". Every word of the form "a/b/c/..." is parsed as a row, and the rows are stored in a table.

A Row is a vector of doubles, and a Table is a vector of rows.

Examples: the parser is able to parse the following strings: "1/1 2/3 1/4": {{1,1},{2,3},{1,4}} "1/1 2/3 1/4 1/1 2/3 1/4" : {{1,1},{2,3},{1,4},{1,1},{2,3},{1,4}} "1/2/3 2/3/4 1/2/3 2/3/4 1/2/3 2/3/4 1/2/3 2/3/4 1/2/3" : {{1,2,3},{2,3,4},{1,2,3},{2,3,4},{1,2,3},{2,3,4},{1,2,3},{2,3,4},{1,2,3}}

If the string has un-parsable elements the parser will fail with nullopt: "1/2 sdf" : nullopt !

It also fails if the string is empty: "": nullopt !

Also fails if the rows are not of the same size.


The documentation for this struct was generated from the following file: