23 #include <boost/lexical_cast.hpp> 32 const Symbol asSymbol(key);
33 if (asSymbol.
chr() > 0)
34 return (
string) asSymbol;
36 return boost::lexical_cast<
string>(
key);
41 cout << s << keyFormatter(key);
47 if (asLabeledSymbol.
chr() > 0 && asLabeledSymbol.
label() > 0)
48 return (
string) asLabeledSymbol;
50 const Symbol asSymbol(key);
51 if (asLabeledSymbol.
chr() > 0)
52 return (
string) asSymbol;
54 return boost::lexical_cast<
string>(
key);
58 template<
class CONTAINER>
63 cout <<
"(none)" << endl;
66 cout << keyFormatter(
key) <<
" ";
74 Print(keys, s, keyFormatter);
79 Print(keys, s, keyFormatter);
84 Print(keys, s, keyFormatter);
89 void *&key_formatter::property(ios_base &
s) {
90 static int kUniqueIndex = ios_base::xalloc();
91 return s.pword(kUniqueIndex);
97 property(s) = (
void *)(&f);
109 key_formatter::set_property(os, m.
formatter_);
117 if (formatter ==
nullptr) {
120 os << (*formatter)(streamedKey.
key_);
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.
unsigned char label() const
unsigned char chr() const
string _multirobotKeyFormatter(Key key)
static const KeyFormatter DefaultKeyFormatter
const KeyFormatter & formatter
string _defaultKeyFormatter(Key key)
FastVector< Key > KeyVector
Define collection type once and for all - also used in wrappers.
unsigned char chr() const
To use the key_formatter on Keys, they must be wrapped in a StreamedKey.
std::function< std::string(Key)> KeyFormatter
Typedef for a function to format a key, i.e. to convert it to a string.
Point2(* f)(const Point3 &, OptionalJacobian< 2, 3 >)
ostream & operator<<(ostream &os, const StreamedKey &streamedKey)
ofstream os("timeSchurFactors.csv")
void PrintKey(Key key, const string &s, const KeyFormatter &keyFormatter)
Utility function to print one key with optional prefix.
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)