29 : c_(0), label_(0), j_(0) {}
42 const size_t chrBits =
sizeof(
unsigned char) * 8;
43 const size_t lblBits =
sizeof(
unsigned char) * 8;
44 const size_t indexBits = keyBits - chrBits - lblBits;
48 c_ = (
unsigned char)((key & chrMask) >> (indexBits + lblBits));
56 const size_t chrBits =
sizeof(
unsigned char) * 8;
57 const size_t lblBits =
sizeof(
unsigned char) * 8;
58 const size_t indexBits = keyBits - chrBits - lblBits;
63 throw std::invalid_argument(
"Symbol index is too large");
70 std::cout << s <<
": " << (std::string) (*
this) << std::endl;
74 LabeledSymbol::operator std::string()
const {
76 snprintf(buffer, 100,
"%c%c%llu",
c_,
label_,
77 static_cast<unsigned long long>(
j_));
78 return std::string(buffer);
113 auto equals = [](
unsigned char s,
unsigned char c) {
return s ==
c; };
122 auto equals = [](
unsigned char s,
unsigned char c) {
return s ==
c; };
131 auto logical_and = [](
bool is_type,
bool is_label) {
return is_type == is_label; };
132 auto equals = [](
unsigned char s,
unsigned char c) {
return s ==
c; };
133 return std::bind(logical_and,
136 std::bind(
make, std::placeholders::_1)),
140 std::bind(
make, std::placeholders::_1)),
unsigned char chr() const
static LabeledSymbol make(gtsam::Key key)
static const Key indexMask
static std::function< bool(gtsam::Key)> LabelTest(unsigned char label)
bool operator==(const LabeledSymbol &comp) const
static const size_t indexBits
unsigned __int64 uint64_t
To use the key_formatter on Keys, they must be wrapped in a StreamedKey.
static std::function< bool(gtsam::Key)> TypeTest(unsigned char c)
bool operator!=(const LabeledSymbol &comp) const
unsigned char label() const
Key symbol(unsigned char c, std::uint64_t j)
static const size_t chrBits
static std::function< bool(gtsam::Key)> TypeLabelTest(unsigned char c, unsigned char label)
bool operator<(const LabeledSymbol &comp) const
static const size_t keyBits
ofstream os("timeSchurFactors.csv")
friend GTSAM_EXPORT std::ostream & operator<<(std::ostream &, const LabeledSymbol &)
Output stream operator that can be used with key_formatter (see Key.h).
std::uint64_t Key
Integer nonlinear key type.
void print(const std::string &s="") const