gtsam  4.0.0
gtsam
gtsam::BTree< KEY, VALUE > Class Template Reference

Public Member Functions

 BTree ()
 default constructor creates an empty tree
 
 BTree (const BTree &other)
 copy constructor
 
 BTree (const value_type &keyValue)
 create leaf from key-value pair
 
 BTree (const BTree &l, const value_type &keyValue, const BTree &r)
 create from key-value pair and left, right subtrees
 
BTreeoperator= (const BTree &other)
 assignment operator
 
bool empty () const
 Check whether tree is empty.
 
BTree add (const value_type &xd) const
 add a key-value pair
 
BTree add (const KEY &x, const VALUE &d) const
 add a key-value pair
 
bool mem (const KEY &x) const
 member predicate
 
bool same (const BTree &other) const
 Check whether trees are exactly the same (occupy same memory)
 
bool operator== (const BTree &other) const
 Check whether trees are structurally the same, i.e., contain the same values in same tree-structure.
 
bool operator!= (const BTree &other) const
 
const value_type & min () const
 minimum key binding
 
BTree remove_min () const
 remove minimum key binding
 
BTree remove (const KEY &x) const
 remove a key-value pair
 
size_t height () const
 Return height of the tree, 0 if empty.
 
size_t size () const
 return size of the tree
 
const VALUE & find (const KEY &k) const
 find a value given a key, throws exception when not found Optimized non-recursive version as [find] is crucial for speed
 
void print (const std::string &s="") const
 print in-order
 
void iter (boost::function< void(const KEY &, const VALUE &)> f) const
 iterate over tree
 
template<class TO >
BTree< KEY, TO > map (boost::function< TO(const KEY &, const VALUE &)> f) const
 map key-values in tree over function f that computes a new value
 
template<class ACC >
ACC fold (boost::function< ACC(const KEY &, const VALUE &, const ACC &)> f, const ACC &a) const
 t.fold(f,a) computes [(f kN dN ... More...
 
const_iterator begin () const
 return iterator
 
const_iterator end () const
 return iterator
 

Static Public Member Functions

static BTree merge (const BTree &t1, const BTree &t2)
 merge two trees
 

Public Types

typedef std::pair< KEY, VALUE > value_type
 
typedef const_iterator iterator
 

Classes

class  const_iterator
 Const iterator Not trivial: iterator keeps a stack to indicate current path from root_. More...
 

Member Function Documentation

◆ fold()

template<class KEY, class VALUE>
template<class ACC >
ACC gtsam::BTree< KEY, VALUE >::fold ( boost::function< ACC(const KEY &, const VALUE &, const ACC &)>  f,
const ACC &  a 
) const
inline

t.fold(f,a) computes [(f kN dN ...

(f k1 d1 a)...)], where [k1 ... kN] are the keys of all bindings in [m], and [d1 ... dN] are the associated data. The associated values are passed to [f] in reverse sort order


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