31 const Symbol asSymbol(key);
32 if (asSymbol.
chr() > 0) {
33 return (
string) asSymbol;
36 return std::to_string(key);
42 cout << s << keyFormatter(key);
48 if (asLabeledSymbol.
chr() > 0 && asLabeledSymbol.
label() > 0)
49 return (
string) asLabeledSymbol;
51 const Symbol asSymbol(key);
52 if (asLabeledSymbol.
chr() > 0) {
53 return (
string) asSymbol;
56 return std::to_string(key);
61 template<
class CONTAINER>
66 cout <<
"(none)" << endl;
69 cout << keyFormatter(
key) <<
" ";
77 Print(keys, s, keyFormatter);
82 Print(keys, s, keyFormatter);
87 Print(keys, s, keyFormatter);
92 void *&key_formatter::property(ios_base &
s) {
93 static int kUniqueIndex = ios_base::xalloc();
94 return s.pword(kUniqueIndex);
100 property(s) = (
void *)(&f);
112 key_formatter::set_property(os, m.
formatter_);
120 if (formatter ==
nullptr) {
123 os << (*formatter)(streamedKey.
key_);
const gtsam::Symbol key('X', 0)
unsigned char chr() const
void PrintKeyVector(const KeyVector &keys, const string &s, const KeyFormatter &keyFormatter)
Utility function to print sets of keys with optional prefix.
void PrintKeySet(const KeySet &keys, const string &s, const KeyFormatter &keyFormatter)
Utility function to print sets of keys with optional prefix.
string _multirobotKeyFormatter(Key key)
static const KeyFormatter DefaultKeyFormatter
const KeyFormatter & formatter
string _defaultKeyFormatter(Key key)
To use the key_formatter on Keys, they must be wrapped in a StreamedKey.
Point2(* f)(const Point3 &, OptionalJacobian< 2, 3 >)
unsigned char label() const
ostream & operator<<(ostream &os, const StreamedKey &streamedKey)
std::function< std::string(Key)> KeyFormatter
Typedef for a function to format a key, i.e. to convert it to a string.
unsigned char chr() const
ofstream os("timeSchurFactors.csv")
void PrintKey(Key key, const string &s, const KeyFormatter &keyFormatter)
Utility function to print one key with optional prefix.
FastVector< Key > KeyVector
Define collection type once and for all - also used in wrappers.
void PrintKeyList(const KeyList &keys, const string &s, const KeyFormatter &keyFormatter)
Utility function to print sets of keys with optional prefix.
std::uint64_t Key
Integer nonlinear key type.
void Print(const CONTAINER &keys, const string &s, const KeyFormatter &keyFormatter)