gtsam 4.1.1
gtsam
gtsam::Symbol Class Reference

Detailed Description

Character and index key used to refer to variables.

Will simply cast to a Key, i.e., a large integer. Keys are used to retrieve values from Values, specify what variables factors depend on, etc.

Public Member Functions

 Symbol ()
 Default constructor.
 
 Symbol (const Symbol &key)
 Copy constructor.
 
 Symbol (unsigned char c, std::uint64_t j)
 Constructor.
 
 Symbol (Key key)
 Constructor that decodes an integer Key.
 
Key key () const
 return Key (integer) representation
 
 operator Key () const
 Cast to integer.
 
void print (const std::string &s="") const
 Print.
 
bool equals (const Symbol &expected, double tol=0.0) const
 Check equality.
 
unsigned char chr () const
 Retrieve key character.
 
std::uint64_t index () const
 Retrieve key index.
 
 operator std::string () const
 Create a string from the key.
 
std::string string () const
 Return string representation of the key.
 
bool operator< (const Symbol &comp) const
 Comparison for use in maps.
 
bool operator== (const Symbol &comp) const
 Comparison for use in maps.
 
bool operator== (Key comp) const
 Comparison for use in maps.
 
bool operator!= (const Symbol &comp) const
 Comparison for use in maps.
 
bool operator!= (Key comp) const
 Comparison for use in maps.
 

Static Public Member Functions

static std::function< bool(Key)> ChrTest (unsigned char c)
 Return a filter function that returns true when evaluated on a Key whose character (when converted to a Symbol) matches c. More...
 

Protected Attributes

unsigned char c_
 
std::uint64_t j_
 

Friends

class boost::serialization::access
 Serialization function.
 
GTSAM_EXPORT friend std::ostream & operator<< (std::ostream &, const Symbol &)
 Output stream operator that can be used with key_formatter (see Key.h).
 

Member Function Documentation

◆ ChrTest()

std::function< bool(Key)> gtsam::Symbol::ChrTest ( unsigned char  c)
static

Return a filter function that returns true when evaluated on a Key whose character (when converted to a Symbol) matches c.

Use this with the Values::filter() function to retrieve all key-value pairs with the requested character.


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