Back to index

easystroke  0.5.5.1
Public Member Functions | Private Attributes
BiMap< X1, X2 > Class Template Reference
Collaboration diagram for BiMap< X1, X2 >:
Collaboration graph
[legend]

List of all members.

Public Member Functions

void erase1 (X1 x1)
void erase2 (X2 x2)
void pop (X1 &x1, X2 &x2)
void add (X1 x1, X2 x2)
bool empty ()
bool contains1 (X1 x1)
bool contains2 (X2 x2)
X2 find1 (X1 x1)
X1 find2 (X2 x2)

Private Attributes

std::map< X1, X2 > map1
std::map< X2, X1 > map2

Detailed Description

template<class X1, class X2>
class BiMap< X1, X2 >

Definition at line 41 of file grabber.cc.


Member Function Documentation

template<class X1, class X2>
void BiMap< X1, X2 >::add ( X1  x1,
X2  x2 
) [inline]

Definition at line 66 of file grabber.cc.

                              {
              erase1(x1);
              erase2(x2);
              map1[x1] = x2;
              map2[x2] = x1;
       }

Here is the call graph for this function:

Here is the caller graph for this function:

template<class X1, class X2>
bool BiMap< X1, X2 >::contains1 ( X1  x1) [inline]

Definition at line 73 of file grabber.cc.

{ return map1.find(x1) != map1.end(); }

Here is the caller graph for this function:

template<class X1, class X2>
bool BiMap< X1, X2 >::contains2 ( X2  x2) [inline]

Definition at line 74 of file grabber.cc.

{ return map2.find(x2) != map2.end(); }
template<class X1, class X2>
bool BiMap< X1, X2 >::empty ( ) [inline]

Definition at line 72 of file grabber.cc.

{ return map1.empty(); }

Here is the caller graph for this function:

template<class X1, class X2>
void BiMap< X1, X2 >::erase1 ( X1  x1) [inline]

Definition at line 45 of file grabber.cc.

                          {
              typename std::map<X1, X2>::iterator i1 = map1.find(x1);
              if (i1 == map1.end())
                     return;
              map2.erase(i1->second);
              map1.erase(i1->first);
       }

Here is the caller graph for this function:

template<class X1, class X2>
void BiMap< X1, X2 >::erase2 ( X2  x2) [inline]

Definition at line 52 of file grabber.cc.

                          {
              typename std::map<X2, X1>::iterator i2 = map2.find(x2);
              if (i2 == map2.end())
                     return;
              map1.erase(i2->second);
              map2.erase(i2->first);
       }

Here is the caller graph for this function:

template<class X1, class X2>
X2 BiMap< X1, X2 >::find1 ( X1  x1) [inline]

Definition at line 75 of file grabber.cc.

{ return map1.find(x1)->second; }

Here is the caller graph for this function:

template<class X1, class X2>
X1 BiMap< X1, X2 >::find2 ( X2  x2) [inline]

Definition at line 76 of file grabber.cc.

{ return map2.find(x2)->second; }
template<class X1, class X2>
void BiMap< X1, X2 >::pop ( X1 &  x1,
X2 &  x2 
) [inline]

Definition at line 59 of file grabber.cc.

                                {
              typename std::map<X1, X2>::reverse_iterator i1 = map1.rbegin();
              x1 = i1->first;
              x2 = i1->second;
              map2.erase(i1->second);
              map1.erase(i1->first);
       }

Here is the caller graph for this function:


Member Data Documentation

template<class X1, class X2>
std::map<X1, X2> BiMap< X1, X2 >::map1 [private]

Definition at line 42 of file grabber.cc.

template<class X1, class X2>
std::map<X2, X1> BiMap< X1, X2 >::map2 [private]

Definition at line 43 of file grabber.cc.


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