23 #include <boost/serialization/nvp.hpp> 47 c_(key.c_), j_(key.j_) {
51 Symbol(
unsigned char c, std::uint64_t j) :
62 operator Key()
const {
return key(); }
65 void print(
const std::string& s =
"")
const;
68 bool equals(
const Symbol& expected,
double tol = 0.0)
const;
71 unsigned char chr()
const {
81 operator std::string()
const;
85 return c_ < comp.c_ || (comp.c_ == c_ && j_ < comp.j_);
90 return comp.c_ == c_ && comp.j_ == j_;
95 return comp == (
Key)(*
this);
100 return comp.c_ != c_ || comp.j_ != j_;
105 return comp != (
Key)(*
this);
113 static boost::function<bool(
Key)> ChrTest(
unsigned char c);
118 friend class boost::serialization::access;
119 template<
class ARCHIVE>
120 void serialize(ARCHIVE & ar,
const unsigned int ) {
121 ar & BOOST_SERIALIZATION_NVP(c_);
122 ar & BOOST_SERIALIZATION_NVP(j_);
135 namespace symbol_shorthand {
136 inline Key A(std::uint64_t j) {
return Symbol(
'a', j); }
137 inline Key B(std::uint64_t j) {
return Symbol(
'b', j); }
138 inline Key C(std::uint64_t j) {
return Symbol(
'c', j); }
139 inline Key D(std::uint64_t j) {
return Symbol(
'd', j); }
140 inline Key E(std::uint64_t j) {
return Symbol(
'e', j); }
141 inline Key F(std::uint64_t j) {
return Symbol(
'f', j); }
142 inline Key G(std::uint64_t j) {
return Symbol(
'g', j); }
143 inline Key H(std::uint64_t j) {
return Symbol(
'h', j); }
144 inline Key I(std::uint64_t j) {
return Symbol(
'i', j); }
145 inline Key J(std::uint64_t j) {
return Symbol(
'j', j); }
146 inline Key K(std::uint64_t j) {
return Symbol(
'k', j); }
147 inline Key L(std::uint64_t j) {
return Symbol(
'l', j); }
148 inline Key M(std::uint64_t j) {
return Symbol(
'm', j); }
149 inline Key N(std::uint64_t j) {
return Symbol(
'n', j); }
150 inline Key O(std::uint64_t j) {
return Symbol(
'o', j); }
151 inline Key P(std::uint64_t j) {
return Symbol(
'p', j); }
152 inline Key Q(std::uint64_t j) {
return Symbol(
'q', j); }
153 inline Key R(std::uint64_t j) {
return Symbol(
'r', j); }
154 inline Key S(std::uint64_t j) {
return Symbol(
's', j); }
155 inline Key T(std::uint64_t j) {
return Symbol(
't', j); }
156 inline Key U(std::uint64_t j) {
return Symbol(
'u', j); }
157 inline Key V(std::uint64_t j) {
return Symbol(
'v', j); }
158 inline Key W(std::uint64_t j) {
return Symbol(
'w', j); }
159 inline Key X(std::uint64_t j) {
return Symbol(
'x', j); }
160 inline Key Y(std::uint64_t j) {
return Symbol(
'y', j); }
161 inline Key Z(std::uint64_t j) {
return Symbol(
'z', j); }
Symbol()
Default constructor.
Definition: Symbol.h:41
Symbol(unsigned char c, std::uint64_t j)
Constructor.
Definition: Symbol.h:51
std::uint64_t index() const
Retrieve key index.
Definition: Symbol.h:76
Character and index key used to refer to variables.
Definition: Symbol.h:33
void print(const Matrix &A, const string &s, ostream &stream)
print without optional string, must specify cout yourself
Definition: Matrix.cpp:141
std::uint64_t Key
Integer nonlinear key type.
Definition: types.h:57
Template to create a binary predicate.
Definition: Testable.h:110
A helper that implements the traits interface for GTSAM types.
Definition: Testable.h:150
unsigned char symbolChr(Key key)
Return the character portion of a symbol key.
Definition: Symbol.h:130
bool operator==(const Symbol &comp) const
Comparison for use in maps.
Definition: Symbol.h:89
std::uint64_t symbolIndex(Key key)
Return the index portion of a symbol key.
Definition: Symbol.h:133
unsigned char chr() const
Retrieve key character.
Definition: Symbol.h:71
A manifold defines a space in which there is a notion of a linear tangent space that can be centered ...
Definition: concepts.h:30
bool operator!=(Key comp) const
Comparison for use in maps.
Definition: Symbol.h:104
Symbol(const Symbol &key)
Copy constructor.
Definition: Symbol.h:46
Global functions in a separate testing namespace.
Definition: chartTesting.h:28
Concept check for values that can be used in unit tests.
bool operator!=(const Symbol &comp) const
Comparison for use in maps.
Definition: Symbol.h:99
Key symbol(unsigned char c, std::uint64_t j)
Create a symbol key from a character and index, i.e.
Definition: Symbol.h:127
bool operator==(Key comp) const
Comparison for use in maps.
Definition: Symbol.h:94
bool operator<(const Symbol &comp) const
Comparison for use in maps.
Definition: Symbol.h:84