Protected Attributes | List of all members
gtsam::LabeledSymbol Class Reference

#include <LabeledSymbol.h>

Public Member Functions

Constructors
 LabeledSymbol ()
 Default constructor. More...
 
 LabeledSymbol (const LabeledSymbol &key)
 Copy constructor. More...
 
 LabeledSymbol (unsigned char c, unsigned char label, std::uint64_t j)
 Constructor fro characters c and label, and integer j. More...
 
 LabeledSymbol (Key key)
 Constructor that decodes an integer Key. More...
 
Testable
void print (const std::string &s="") const
 Prints the LabeledSymbol with an optional prefix string. More...
 
bool equals (const LabeledSymbol &expected, double tol=0.0) const
 Checks if this LabeledSymbol is equal to another, tolerance is ignored. More...
 
Comparison
bool operator< (const LabeledSymbol &comp) const
 
bool operator== (const LabeledSymbol &comp) const
 
bool operator== (Key comp) const
 
bool operator!= (const LabeledSymbol &comp) const
 
bool operator!= (Key comp) const
 
Advanced API
LabeledSymbol upper () const
 Converts to upper/lower versions of labels. More...
 
LabeledSymbol lower () const
 
LabeledSymbol newChr (unsigned char c) const
 Create a new symbol with a different character. More...
 
LabeledSymbol newLabel (unsigned char label) const
 Create a new symbol with a different label. More...
 

Static Public Member Functions

Filtering

Return a filter function that returns true when evaluated on a Key whose character (when converted to a LabeledSymbol) matches c. Use this with the Values::filter() function to retrieve all key-value pairs with the requested character.

static std::function< bool(Key)> TypeTest (unsigned char c)
 Checks only the type. More...
 
static std::function< bool(Key)> LabelTest (unsigned char label)
 Checks only the robot ID (label_) More...
 
static std::function< bool(Key)> TypeLabelTest (unsigned char c, unsigned char label)
 Checks both type and the robot ID. More...
 

Protected Attributes

unsigned char c_
 
std::uint64_t j_
 
unsigned char label_
 

Standard API

 operator Key () const
 Cast to Key. More...
 
Key key () const
 return the integer version More...
 
unsigned char label () const
 Retrieve label character. More...
 
unsigned char chr () const
 Retrieve key character. More...
 
size_t index () const
 Retrieve key index. More...
 
 operator std::string () const
 Create a string from the key. More...
 
GTSAM_EXPORT std::ostream & operator<< (std::ostream &, const LabeledSymbol &)
 Output stream operator that can be used with key_formatter (see Key.h). More...
 

Detailed Description

Customized version of gtsam::Symbol for multi-robot use.

This variation of Symbol stores two char values in addition to an integer key, which is useful for encoding a group for a variable. This was originally designed for multi-robot systems, which allows expressing "Pose 7 from robot B" as "xB7".

Definition at line 37 of file LabeledSymbol.h.

Constructor & Destructor Documentation

◆ LabeledSymbol() [1/4]

gtsam::LabeledSymbol::LabeledSymbol ( )

Default constructor.

Definition at line 28 of file LabeledSymbol.cpp.

◆ LabeledSymbol() [2/4]

gtsam::LabeledSymbol::LabeledSymbol ( const LabeledSymbol key)

Copy constructor.

Definition at line 32 of file LabeledSymbol.cpp.

◆ LabeledSymbol() [3/4]

gtsam::LabeledSymbol::LabeledSymbol ( unsigned char  c,
unsigned char  label,
std::uint64_t  j 
)

Constructor fro characters c and label, and integer j.

Definition at line 36 of file LabeledSymbol.cpp.

◆ LabeledSymbol() [4/4]

gtsam::LabeledSymbol::LabeledSymbol ( gtsam::Key  key)

Constructor that decodes an integer Key.

Definition at line 40 of file LabeledSymbol.cpp.

Member Function Documentation

◆ chr()

unsigned char gtsam::LabeledSymbol::chr ( ) const
inline

Retrieve key character.

Definition at line 84 of file LabeledSymbol.h.

◆ equals()

bool gtsam::LabeledSymbol::equals ( const LabeledSymbol expected,
double  tol = 0.0 
) const
inline

Checks if this LabeledSymbol is equal to another, tolerance is ignored.

Definition at line 66 of file LabeledSymbol.h.

◆ index()

size_t gtsam::LabeledSymbol::index ( ) const
inline

Retrieve key index.

Definition at line 87 of file LabeledSymbol.h.

◆ key()

Key gtsam::LabeledSymbol::key ( ) const
inline

return the integer version

Definition at line 78 of file LabeledSymbol.h.

◆ label()

unsigned char gtsam::LabeledSymbol::label ( ) const
inline

Retrieve label character.

Definition at line 81 of file LabeledSymbol.h.

◆ LabelTest()

std::function< bool(gtsam::Key)> gtsam::LabeledSymbol::LabelTest ( unsigned char  label)
static

Checks only the robot ID (label_)

Definition at line 120 of file LabeledSymbol.cpp.

◆ lower()

LabeledSymbol gtsam::LabeledSymbol::lower ( ) const
inline

Definition at line 130 of file LabeledSymbol.h.

◆ newChr()

LabeledSymbol gtsam::LabeledSymbol::newChr ( unsigned char  c) const
inline

Create a new symbol with a different character.

Definition at line 133 of file LabeledSymbol.h.

◆ newLabel()

LabeledSymbol gtsam::LabeledSymbol::newLabel ( unsigned char  label) const
inline

Create a new symbol with a different label.

Definition at line 138 of file LabeledSymbol.h.

◆ operator Key()

gtsam::LabeledSymbol::operator Key ( ) const

Cast to Key.

◆ operator std::string()

gtsam::LabeledSymbol::operator std::string ( ) const

Create a string from the key.

Definition at line 74 of file LabeledSymbol.cpp.

◆ operator!=() [1/2]

bool gtsam::LabeledSymbol::operator!= ( const LabeledSymbol comp) const

Definition at line 94 of file LabeledSymbol.cpp.

◆ operator!=() [2/2]

Definition at line 104 of file LabeledSymbol.cpp.

◆ operator<()

bool gtsam::LabeledSymbol::operator< ( const LabeledSymbol comp) const

Definition at line 82 of file LabeledSymbol.cpp.

◆ operator==() [1/2]

bool gtsam::LabeledSymbol::operator== ( const LabeledSymbol comp) const

Definition at line 89 of file LabeledSymbol.cpp.

◆ operator==() [2/2]

bool gtsam::LabeledSymbol::operator== ( gtsam::Key  comp) const

Definition at line 99 of file LabeledSymbol.cpp.

◆ print()

void gtsam::LabeledSymbol::print ( const std::string &  s = "") const

Prints the LabeledSymbol with an optional prefix string.

Definition at line 69 of file LabeledSymbol.cpp.

◆ TypeLabelTest()

std::function< bool(gtsam::Key)> gtsam::LabeledSymbol::TypeLabelTest ( unsigned char  c,
unsigned char  label 
)
static

Checks both type and the robot ID.

Definition at line 129 of file LabeledSymbol.cpp.

◆ TypeTest()

std::function< bool(gtsam::Key)> gtsam::LabeledSymbol::TypeTest ( unsigned char  c)
static

Checks only the type.

Definition at line 111 of file LabeledSymbol.cpp.

◆ upper()

LabeledSymbol gtsam::LabeledSymbol::upper ( ) const
inline

Converts to upper/lower versions of labels.

Definition at line 129 of file LabeledSymbol.h.

Friends And Related Function Documentation

◆ operator<<

GTSAM_EXPORT std::ostream& operator<< ( std::ostream &  os,
const LabeledSymbol symbol 
)
friend

Output stream operator that can be used with key_formatter (see Key.h).

Definition at line 145 of file LabeledSymbol.cpp.

Member Data Documentation

◆ c_

unsigned char gtsam::LabeledSymbol::c_
protected

Definition at line 39 of file LabeledSymbol.h.

◆ j_

std::uint64_t gtsam::LabeledSymbol::j_
protected

Definition at line 40 of file LabeledSymbol.h.

◆ label_

unsigned char gtsam::LabeledSymbol::label_
protected

Definition at line 39 of file LabeledSymbol.h.


The documentation for this class was generated from the following files:


gtsam
Author(s):
autogenerated on Sat Nov 16 2024 04:15:38