GTSAM  4.0.2
C++ library for smoothing and mapping (SAM)
Classes | Public Types | Public Member Functions | Static Public Member Functions | List of all members
gtsam::BTree< KEY, VALUE > Class Template Reference

Binary tree. More...

#include <BTree.h>

Classes

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

Public Types

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

Public Member Functions

 BTree ()
 
 BTree (const BTree &other)
 
 BTree (const value_type &keyValue)
 
 BTree (const BTree &l, const value_type &keyValue, const BTree &r)
 
BTreeoperator= (const BTree &other)
 
bool empty () const
 
BTree add (const value_type &xd) const
 
BTree add (const KEY &x, const VALUE &d) const
 
bool mem (const KEY &x) const
 
bool same (const BTree &other) const
 
bool operator== (const BTree &other) const
 
bool operator!= (const BTree &other) const
 
const value_type & min () const
 
BTree remove_min () const
 
BTree remove (const KEY &x) const
 
size_t height () const
 
size_t size () const
 
const VALUE & find (const KEY &k) const
 
void print (const std::string &s="") const
 
void iter (std::function< void(const KEY &, const VALUE &)> f) const
 
template<class TO >
BTree< KEY, TO > map (std::function< TO(const KEY &, const VALUE &)> f) const
 
template<class ACC >
ACC fold (std::function< ACC(const KEY &, const VALUE &, const ACC &)> f, const ACC &a) const
 
const_iterator begin () const
 
const_iterator end () const
 

Static Public Member Functions

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

Detailed Description

template<class KEY, class VALUE>
class gtsam::BTree< KEY, VALUE >

Binary tree.

Constructor & Destructor Documentation

◆ BTree() [1/4]

template<class KEY, class VALUE>
gtsam::BTree< KEY, VALUE >::BTree ( )
inline

default constructor creates an empty tree

◆ BTree() [2/4]

template<class KEY, class VALUE>
gtsam::BTree< KEY, VALUE >::BTree ( const BTree< KEY, VALUE > &  other)
inline

copy constructor

◆ BTree() [3/4]

template<class KEY, class VALUE>
gtsam::BTree< KEY, VALUE >::BTree ( const value_type &  keyValue)
inline

create leaf from key-value pair

◆ BTree() [4/4]

template<class KEY, class VALUE>
gtsam::BTree< KEY, VALUE >::BTree ( const BTree< KEY, VALUE > &  l,
const value_type &  keyValue,
const BTree< KEY, VALUE > &  r 
)
inline

create from key-value pair and left, right subtrees

Member Function Documentation

◆ add() [1/2]

template<class KEY, class VALUE>
BTree gtsam::BTree< KEY, VALUE >::add ( const value_type &  xd) const
inline

add a key-value pair

◆ add() [2/2]

template<class KEY, class VALUE>
BTree gtsam::BTree< KEY, VALUE >::add ( const KEY &  x,
const VALUE &  d 
) const
inline

add a key-value pair

◆ begin()

template<class KEY, class VALUE>
const_iterator gtsam::BTree< KEY, VALUE >::begin ( ) const
inline

return iterator

◆ empty()

template<class KEY, class VALUE>
bool gtsam::BTree< KEY, VALUE >::empty ( ) const
inline

Check whether tree is empty

◆ end()

template<class KEY, class VALUE>
const_iterator gtsam::BTree< KEY, VALUE >::end ( ) const
inline

return iterator

◆ find()

template<class KEY, class VALUE>
const VALUE& gtsam::BTree< KEY, VALUE >::find ( const KEY &  k) const
inline

find a value given a key, throws exception when not found Optimized non-recursive version as [find] is crucial for speed

◆ fold()

template<class KEY, class VALUE>
template<class ACC >
ACC gtsam::BTree< KEY, VALUE >::fold ( std::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

◆ height()

template<class KEY, class VALUE>
size_t gtsam::BTree< KEY, VALUE >::height ( ) const
inline

Return height of the tree, 0 if empty

◆ iter()

template<class KEY, class VALUE>
void gtsam::BTree< KEY, VALUE >::iter ( std::function< void(const KEY &, const VALUE &)>  f) const
inline

iterate over tree

◆ map()

template<class KEY, class VALUE>
template<class TO >
BTree<KEY, TO> gtsam::BTree< KEY, VALUE >::map ( std::function< TO(const KEY &, const VALUE &)>  f) const
inline

map key-values in tree over function f that computes a new value

◆ mem()

template<class KEY, class VALUE>
bool gtsam::BTree< KEY, VALUE >::mem ( const KEY &  x) const
inline

member predicate

◆ merge()

template<class KEY, class VALUE>
static BTree gtsam::BTree< KEY, VALUE >::merge ( const BTree< KEY, VALUE > &  t1,
const BTree< KEY, VALUE > &  t2 
)
inlinestatic

merge two trees

◆ min()

template<class KEY, class VALUE>
const value_type& gtsam::BTree< KEY, VALUE >::min ( ) const
inline

minimum key binding

◆ operator=()

template<class KEY, class VALUE>
BTree& gtsam::BTree< KEY, VALUE >::operator= ( const BTree< KEY, VALUE > &  other)
inline

assignment operator

◆ operator==()

template<class KEY, class VALUE>
bool gtsam::BTree< KEY, VALUE >::operator== ( const BTree< KEY, VALUE > &  other) const
inline

Check whether trees are structurally the same, i.e., contain the same values in same tree-structure.

◆ print()

template<class KEY, class VALUE>
void gtsam::BTree< KEY, VALUE >::print ( const std::string &  s = "") const
inline

print in-order

◆ remove()

template<class KEY, class VALUE>
BTree gtsam::BTree< KEY, VALUE >::remove ( const KEY &  x) const
inline

remove a key-value pair

◆ remove_min()

template<class KEY, class VALUE>
BTree gtsam::BTree< KEY, VALUE >::remove_min ( ) const
inline

remove minimum key binding

◆ same()

template<class KEY, class VALUE>
bool gtsam::BTree< KEY, VALUE >::same ( const BTree< KEY, VALUE > &  other) const
inline

Check whether trees are exactly the same (occupy same memory)

◆ size()

template<class KEY, class VALUE>
size_t gtsam::BTree< KEY, VALUE >::size ( ) const
inline

return size of the tree


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