21 #include <boost/serialization/nvp.hpp>
47 c_(key.c_), j_(key.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 version) {
121 ar & BOOST_SERIALIZATION_NVP(c_);
122 ar & BOOST_SERIALIZATION_NVP(j_);
135 namespace symbol_shorthand {
136 inline Key A(
size_t j) {
return Symbol(
'a', j); }
137 inline Key B(
size_t j) {
return Symbol(
'b', j); }
138 inline Key C(
size_t j) {
return Symbol(
'c', j); }
139 inline Key D(
size_t j) {
return Symbol(
'd', j); }
140 inline Key E(
size_t j) {
return Symbol(
'e', j); }
141 inline Key F(
size_t j) {
return Symbol(
'f', j); }
142 inline Key G(
size_t j) {
return Symbol(
'g', j); }
143 inline Key H(
size_t j) {
return Symbol(
'h', j); }
144 inline Key I(
size_t j) {
return Symbol(
'i', j); }
145 inline Key J(
size_t j) {
return Symbol(
'j', j); }
146 inline Key K(
size_t j) {
return Symbol(
'k', j); }
147 inline Key L(
size_t j) {
return Symbol(
'l', j); }
148 inline Key M(
size_t j) {
return Symbol(
'm', j); }
149 inline Key N(
size_t j) {
return Symbol(
'n', j); }
150 inline Key O(
size_t j) {
return Symbol(
'o', j); }
151 inline Key P(
size_t j) {
return Symbol(
'p', j); }
152 inline Key Q(
size_t j) {
return Symbol(
'q', j); }
153 inline Key R(
size_t j) {
return Symbol(
'r', j); }
154 inline Key S(
size_t j) {
return Symbol(
's', j); }
155 inline Key T(
size_t j) {
return Symbol(
't', j); }
156 inline Key U(
size_t j) {
return Symbol(
'u', j); }
157 inline Key V(
size_t j) {
return Symbol(
'v', j); }
158 inline Key W(
size_t j) {
return Symbol(
'w', j); }
159 inline Key X(
size_t j) {
return Symbol(
'x', j); }
160 inline Key Y(
size_t j) {
return Symbol(
'y', j); }
161 inline Key Z(
size_t j) {
return Symbol(
'z', j); }
bool operator!=(Key comp) const
Comparison for use in maps.
Definition: Symbol.h:104
size_t index() const
Retrieve key index.
Definition: Symbol.h:76
bool operator==(Key comp) const
Comparison for use in maps.
Definition: Symbol.h:94
Character and index key used in VectorValues, GaussianFactorGraph, GaussianFactor, etc.
Definition: Symbol.h:33
Symbol(const Symbol &key)
Copy constructor.
Definition: Symbol.h:46
void print(const Matrix &A, const string &s, ostream &stream)
print a matrix
Definition: Matrix.cpp:183
unsigned char symbolChr(Key key)
Return the character portion of a symbol key.
Definition: Symbol.h:130
Template to create a binary predicate.
Definition: Testable.h:102
size_t Key
Integer nonlinear key type.
Definition: types.h:59
bool operator==(const Symbol &comp) const
Comparison for use in maps.
Definition: Symbol.h:89
bool operator!=(const Symbol &comp) const
Comparison for use in maps.
Definition: Symbol.h:99
Key symbol(unsigned char c, size_t j)
Create a symbol key from a character and index, i.e.
Definition: Symbol.h:127
Symbol()
Default constructor.
Definition: Symbol.h:41
size_t symbolIndex(Key key)
Return the index portion of a symbol key.
Definition: Symbol.h:133
Symbol(unsigned char c, size_t j)
Constructor.
Definition: Symbol.h:51
bool operator<(const Symbol &comp) const
Comparison for use in maps.
Definition: Symbol.h:84
unsigned char chr() const
Retrieve key character.
Definition: Symbol.h:71