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< TableParse (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.

Definition at line 50 of file SignatureParser.h.

Member Typedef Documentation

◆ Row

using gtsam::SignatureParser::Row = std::vector<double>

Definition at line 51 of file SignatureParser.h.

◆ Table

using gtsam::SignatureParser::Table = std::vector<Row>

Definition at line 52 of file SignatureParser.h.

Member Function Documentation

◆ Parse()

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

Definition at line 77 of file SignatureParser.cpp.


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


gtsam
Author(s):
autogenerated on Tue Jul 4 2023 02:47:09