#include <DiscreteValues.h>
Public Types | |
using | Base = Assignment< Key > |
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. More... | |
bool | equals (const DiscreteValues &x, double tol=1e-9) const |
equals required by Testable for unit testing. More... | |
Public Member Functions inherited from gtsam::Assignment< Key > | |
Assignment ()=default | |
Assignment (std::initializer_list< std::pair< const Key, size_t >> init) | |
bool | equals (const Assignment &other, double tol=1e-9) const |
void | print (const std::string &s="Assignment: ", const std::function< std::string(Key)> &labelFormatter=&DefaultFormatter) const |
Standard Interface | |
std::pair< iterator, bool > | insert (const value_type &value) |
DiscreteValues & | insert (const DiscreteValues &values) |
DiscreteValues & | update (const DiscreteValues &values) |
static std::vector< DiscreteValues > | CartesianProduct (const DiscreteKeys &keys) |
Return a vector of DiscreteValues, one for each possible combination of values. More... | |
Wrapper support | |
using | Names = std::map< Key, std::vector< std::string > > |
Translation table from values to strings. More... | |
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. More... | |
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... | |
A map from keys to values
Definition at line 34 of file DiscreteValues.h.
using gtsam::DiscreteValues::Base = Assignment<Key> |
Definition at line 36 of file DiscreteValues.h.
using gtsam::DiscreteValues::Names = std::map<Key, std::vector<std::string> > |
Translation table from values to strings.
Definition at line 95 of file DiscreteValues.h.
|
default |
|
inlineexplicit |
Definition at line 46 of file DiscreteValues.h.
|
inline |
Definition at line 49 of file DiscreteValues.h.
|
default |
|
inline |
Definition at line 58 of file Assignment.h.
|
inlinestatic |
Return a vector of DiscreteValues, one for each possible combination of values.
Definition at line 85 of file DiscreteValues.h.
bool DiscreteValues::equals | ( | const DiscreteValues & | x, |
double | tol = 1e-9 |
||
) | const |
equals required by Testable for unit testing.
Definition at line 39 of file DiscreteValues.cpp.
string DiscreteValues::html | ( | const KeyFormatter & | keyFormatter = DefaultKeyFormatter , |
const Names & | names = {} |
||
) | const |
Output as a html table.
keyFormatter | function that formats keys. |
names | translation table for values. |
Definition at line 105 of file DiscreteValues.cpp.
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.
Definition at line 50 of file DiscreteValues.cpp.
|
inline |
Definition at line 68 of file DiscreteValues.h.
string DiscreteValues::markdown | ( | const KeyFormatter & | keyFormatter = DefaultKeyFormatter , |
const Names & | names = {} |
||
) | const |
Output as a markdown table.
keyFormatter | function that formats keys. |
names | translation table for values. |
Definition at line 88 of file DiscreteValues.cpp.
void DiscreteValues::print | ( | const std::string & | s = "" , |
const KeyFormatter & | keyFormatter = DefaultKeyFormatter |
||
) | const |
print required by Testable.
Definition at line 30 of file DiscreteValues.cpp.
Translate an integer index value for given key to a string.
Definition at line 78 of file DiscreteValues.cpp.
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.
Definition at line 64 of file DiscreteValues.cpp.