Go to the documentation of this file.
25 using std::stringstream;
33 for (
auto&& kv : *
this)
34 cout <<
"(" << keyFormatter(kv.first) <<
", " << kv.second <<
")";
40 if (this->
size() != x.size())
return false;
42 auto it2 = this->begin();
43 for (; it1 !=
x.end(); ++it1, ++it2) {
44 if (it1->first != it2->first || it1->second != it2->second)
return false;
51 for (
const auto& kv :
values) {
52 if (count(kv.first)) {
53 throw std::out_of_range(
54 "Requested to insert a DiscreteValues into another DiscreteValues "
55 "that already contains one or more of its keys.");
65 for (
const auto& kv :
values) {
66 if (!count(kv.first)) {
67 throw std::out_of_range(
68 "Requested to update a DiscreteValues with another DiscreteValues "
69 "that contains keys not present in the first.");
71 (*this)[kv.first] = kv.second;
93 ss <<
"|Variable|value|\n|:-:|:-:|\n";
96 for (
const auto& kv : *
this) {
97 ss <<
"|" << keyFormatter(kv.first) <<
"|"
110 ss <<
"<div>\n<table class='DiscreteValues'>\n <thead>\n";
113 ss <<
" <tr><th>Variable</th><th>value</th></tr>\n";
116 ss <<
" </thead>\n <tbody>\n";
119 for (
const auto& kv : *
this) {
121 ss <<
"<th>" << keyFormatter(kv.first) <<
"</th><td>"
125 ss <<
" </tbody>\n</table>\n</div>";
void print(const std::string &s="", const KeyFormatter &keyFormatter=DefaultKeyFormatter) const
print required by Testable.
string markdown(const DiscreteValues &values, const KeyFormatter &keyFormatter, const DiscreteValues::Names &names)
Free version of markdown.
set noclip points set clip one set noclip two set bar set border lt lw set xdata set ydata set zdata set x2data set y2data set boxwidth set dummy x
std::string markdown(const KeyFormatter &keyFormatter=DefaultKeyFormatter, const Names &names={}) const
Output as a markdown table.
std::string html(const KeyFormatter &keyFormatter=DefaultKeyFormatter, const Names &names={}) const
Output as a html table.
static std::stringstream ss
std::function< std::string(Key)> KeyFormatter
Typedef for a function to format a key, i.e. to convert it to a string.
DiscreteValues & update(const DiscreteValues &values)
const gtsam::Symbol key('X', 0)
bool equals(const DiscreteValues &x, double tol=1e-9) const
equals required by Testable for unit testing.
std::pair< iterator, bool > insert(const value_type &value)
string html(const DiscreteValues &values, const KeyFormatter &keyFormatter, const DiscreteValues::Names &names)
Free version of html.
std::map< Key, std::vector< std::string > > Names
Translation table from values to strings.
static std::string Translate(const Names &names, Key key, size_t index)
Translate an integer index value for given key to a string.
std::uint64_t Key
Integer nonlinear key type.
std::string html(const KeyFormatter &keyFormatter=DefaultKeyFormatter) const
Output as a html table.
gtsam
Author(s):
autogenerated on Fri Nov 1 2024 03:32:26