Go to the documentation of this file.
25 using std::stringstream;
32 for (
const auto& kv :
x)
33 os <<
"(" << keyFormatter(kv.first) <<
", " << kv.second <<
")";
46 stream(cout, *
this, keyFormatter);
52 if (this->
size() != x.size())
return false;
54 auto it2 = this->begin();
55 for (; it1 !=
x.end(); ++it1, ++it2) {
56 if (it1->first != it2->first || it1->second != it2->second)
return false;
63 const std::pair<Key, size_t>& assignment) {
64 if (count(assignment.first)) {
65 throw std::out_of_range(
66 "Requested to insert a DiscreteValues into another DiscreteValues "
67 "that already contains one or more of its keys.");
69 this->emplace(assignment);
75 for (
const auto& kv :
values) {
83 for (
const auto& kv :
values) {
84 if (!count(kv.first)) {
85 throw std::out_of_range(
86 "Requested to update a DiscreteValues with another DiscreteValues "
87 "that contains keys not present in the first.");
89 (*this)[kv.first] = kv.second;
111 ss <<
"|Variable|value|\n|:-:|:-:|\n";
114 for (
const auto& kv : *
this) {
115 ss <<
"|" << keyFormatter(kv.first) <<
"|"
128 ss <<
"<div>\n<table class='DiscreteValues'>\n <thead>\n";
131 ss <<
" <tr><th>Variable</th><th>value</th></tr>\n";
134 ss <<
" </thead>\n <tbody>\n";
137 for (
const auto& kv : *
this) {
139 ss <<
"<th>" << keyFormatter(kv.first) <<
"</th><td>"
143 ss <<
" </tbody>\n</table>\n</div>";
static void stream(std::ostream &os, const DiscreteValues &x, const KeyFormatter &keyFormatter)
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.
std::ostream & operator<<(std::ostream &os, const Dih6 &m)
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.
ofstream os("timeSchurFactors.csv")
std::string html(const KeyFormatter &keyFormatter=DefaultKeyFormatter, const Names &names={}) const
Output as a html table.
KeyFormatter DefaultKeyFormatter
Assign default key formatter.
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)
Update values with corresponding keys from another DiscreteValues object.
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 Sun Feb 16 2025 04:01:18