gtsam 4.2.0
gtsam
gtsam::DiscreteValues Class Reference

Detailed Description

A map from keys to values.

+ Inheritance diagram for gtsam::DiscreteValues:

Wrapper support

using Names = std::map< Key, std::vector< std::string > >
 Translation table from values to strings.
 
std::string markdown (const KeyFormatter &keyFormatter=DefaultKeyFormatter, const Names &names={}) const
 Output as a markdown table. More...
 
std::string html (const KeyFormatter &keyFormatter=DefaultKeyFormatter, const Names &names={}) const
 Output as a html table. More...
 
static std::string Translate (const Names &names, Key key, size_t index)
 Translate an integer index value for given key to a string.
 

Standard Interface

std::pair< iterator, bool > insert (const value_type &value)
 
DiscreteValuesinsert (const DiscreteValues &values)
 Insert all values from values. More...
 
DiscreteValuesupdate (const DiscreteValues &values)
 For all key/value pairs in values, replace values with corresponding keys in this object with those in values. More...
 
static std::vector< DiscreteValuesCartesianProduct (const DiscreteKeys &keys)
 Return a vector of DiscreteValues, one for each possible combination of values.
 

Public Member Functions

Standard Constructors
 DiscreteValues ()=default
 
 DiscreteValues (const Base &a)
 
 DiscreteValues (std::initializer_list< std::pair< const Key, size_t > > init)
 
 Assignment ()=default
 
 Assignment (std::initializer_list< std::pair< const L, size_t > > init)
 
Testable
void print (const std::string &s="", const KeyFormatter &keyFormatter=DefaultKeyFormatter) const
 print required by Testable.
 
bool equals (const DiscreteValues &x, double tol=1e-9) const
 equals required by Testable for unit testing.
 
- Public Member Functions inherited from gtsam::Assignment< Key >
 Assignment (std::initializer_list< std::pair< const Key, size_t > > init)
 
void print (const std::string &s="Assignment: ", const std::function< std::string(Key)> &labelFormatter=&DefaultFormatter) const
 
bool equals (const Assignment &other, double tol=1e-9) const
 

Public Types

using Base = Assignment< Key >
 

Additional Inherited Members

- Static Public Member Functions inherited from gtsam::Assignment< Key >
static std::vector< Derived > CartesianProduct (const std::vector< std::pair< Key, size_t > > &keys)
 Get Cartesian product consisting all possible configurations. More...
 

Member Function Documentation

◆ html()

string DiscreteValues::html ( const KeyFormatter keyFormatter = DefaultKeyFormatter,
const Names names = {} 
) const

Output as a html table.

Parameters
keyFormatterfunction that formats keys.
namestranslation table for values.
Returns
string html output.

◆ insert()

DiscreteValues & DiscreteValues::insert ( const DiscreteValues values)

Insert all values from values.

Throws an invalid_argument exception if any keys to be inserted are already used.

◆ markdown()

string DiscreteValues::markdown ( const KeyFormatter keyFormatter = DefaultKeyFormatter,
const Names names = {} 
) const

Output as a markdown table.

Parameters
keyFormatterfunction that formats keys.
namestranslation table for values.
Returns
string markdown output.

◆ update()

DiscreteValues & DiscreteValues::update ( const DiscreteValues values)

For all key/value pairs in values, replace values with corresponding keys in this object with those in values.

Throws std::out_of_range if any keys in values are not present in this object.


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