gtsam
Loading...
Searching...
No Matches
gtsam::SignatureParser Struct Reference

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.

Static Public Member Functions

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

Public Types

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

The documentation for this struct was generated from the following files:
  • /tmp/gtsam-4.3.0-doxygen.rsXPUS/source/gtsam/discrete/SignatureParser.h
  • /tmp/gtsam-4.3.0-doxygen.rsXPUS/source/gtsam/discrete/SignatureParser.cpp