Public Types | List of all members
gtsam::DiscreteValues Class Reference

#include <DiscreteValues.h>

Inheritance diagram for gtsam::DiscreteValues:
Inheritance graph
[legend]

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)
 
DiscreteValuesinsert (const std::pair< Key, size_t > &assignment)
 Insert key-assignment pair. More...
 
DiscreteValuesinsert (const DiscreteValues &values)
 Insert all values from another DiscreteValues object. More...
 
DiscreteValuesupdate (const DiscreteValues &values)
 Update values with corresponding keys from another DiscreteValues object. More...
 
bool contains (Key key) const
 Check if the DiscreteValues contains the given key. More...
 
DiscreteValues filter (const DiscreteKeys &keys) const
 Filter values by keys. More...
 
DiscreteKeys missingKeys (const DiscreteKeys &keys) const
 Return the keys that are not present in the DiscreteValues object. More...
 
std::ostream & operator<< (std::ostream &os, const DiscreteValues &x)
 ostream operator: More...
 
static std::vector< DiscreteValuesCartesianProduct (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< AssignmentType > CartesianProduct (const std::vector< std::pair< Key, size_t >> &keys)
 Get Cartesian product consisting all possible configurations. More...
 

Detailed Description

A map from keys to values

Definition at line 34 of file DiscreteValues.h.

Member Typedef Documentation

◆ Base

Definition at line 36 of file DiscreteValues.h.

◆ Names

using gtsam::DiscreteValues::Names = std::map<Key, std::vector<std::string> >

Translation table from values to strings.

Definition at line 158 of file DiscreteValues.h.

Constructor & Destructor Documentation

◆ DiscreteValues() [1/3]

gtsam::DiscreteValues::DiscreteValues ( )
default

◆ DiscreteValues() [2/3]

gtsam::DiscreteValues::DiscreteValues ( const Base a)
inlineexplicit

Definition at line 46 of file DiscreteValues.h.

◆ DiscreteValues() [3/3]

gtsam::DiscreteValues::DiscreteValues ( std::initializer_list< std::pair< const Key, size_t >>  init)
inline

Definition at line 49 of file DiscreteValues.h.

Member Function Documentation

◆ Assignment() [1/2]

◆ Assignment() [2/2]

Definition at line 58 of file Assignment.h.

◆ CartesianProduct()

static std::vector<DiscreteValues> gtsam::DiscreteValues::CartesianProduct ( const DiscreteKeys keys)
inlinestatic

Return a vector of DiscreteValues, one for each possible combination of values.

Parameters
keysThe keys to generate the Cartesian product for.
Returns
std::vector<DiscreteValues> The vector of DiscreteValues.

Definition at line 148 of file DiscreteValues.h.

◆ contains()

bool gtsam::DiscreteValues::contains ( Key  key) const
inline

Check if the DiscreteValues contains the given key.

Parameters
keyThe key to check for.
Returns
True if the key is present, false otherwise.

Definition at line 110 of file DiscreteValues.h.

◆ equals()

bool DiscreteValues::equals ( const DiscreteValues x,
double  tol = 1e-9 
) const

equals required by Testable for unit testing.

Definition at line 51 of file DiscreteValues.cpp.

◆ filter()

DiscreteValues gtsam::DiscreteValues::filter ( const DiscreteKeys keys) const
inline

Filter values by keys.

Parameters
keysThe keys to filter by.
Returns
DiscreteValues The filtered DiscreteValues object.

Definition at line 118 of file DiscreteValues.h.

◆ 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.

Definition at line 123 of file DiscreteValues.cpp.

◆ insert() [1/3]

DiscreteValues & DiscreteValues::insert ( const DiscreteValues values)

Insert all values from another DiscreteValues object.

Parameters
valuesThe DiscreteValues object containing values to insert.
Returns
DiscreteValues& Reference to the updated DiscreteValues object.
Exceptions
std::invalid_argumentif any keys to be inserted are already used.

Definition at line 74 of file DiscreteValues.cpp.

◆ insert() [2/3]

DiscreteValues & DiscreteValues::insert ( const std::pair< Key, size_t > &  assignment)

Insert key-assignment pair.

Parameters
assignmentThe key-assignment pair to insert.
Returns
DiscreteValues& Reference to the updated DiscreteValues object.
Exceptions
std::invalid_argumentif any keys to be inserted are already used.

Definition at line 62 of file DiscreteValues.cpp.

◆ insert() [3/3]

std::pair<iterator, bool> gtsam::DiscreteValues::insert ( const value_type &  value)
inline

Definition at line 71 of file DiscreteValues.h.

◆ 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.

Definition at line 106 of file DiscreteValues.cpp.

◆ missingKeys()

DiscreteKeys gtsam::DiscreteValues::missingKeys ( const DiscreteKeys keys) const
inline

Return the keys that are not present in the DiscreteValues object.

Parameters
keysThe keys to check for.
Returns
DiscreteKeys Keys not present in the DiscreteValues object.

Definition at line 133 of file DiscreteValues.h.

◆ print()

void DiscreteValues::print ( const std::string &  s = "",
const KeyFormatter keyFormatter = DefaultKeyFormatter 
) const

print required by Testable.

Definition at line 43 of file DiscreteValues.cpp.

◆ Translate()

string DiscreteValues::Translate ( const Names names,
Key  key,
size_t  index 
)
static

Translate an integer index value for given key to a string.

Definition at line 96 of file DiscreteValues.cpp.

◆ update()

DiscreteValues & DiscreteValues::update ( const DiscreteValues values)

Update values with corresponding keys from another DiscreteValues object.

Parameters
valuesThe DiscreteValues object containing values to update.
Returns
DiscreteValues& Reference to the updated DiscreteValues object.
Exceptions
std::out_of_rangeif any keys in values are not present in this object.

Definition at line 82 of file DiscreteValues.cpp.

Friends And Related Function Documentation

◆ operator<<

std::ostream& operator<< ( std::ostream &  os,
const DiscreteValues x 
)
friend

ostream operator:

Definition at line 37 of file DiscreteValues.cpp.


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


gtsam
Author(s):
autogenerated on Wed May 28 2025 03:14:16