BFLibCPP 0.1
CPP Library
Loading...
Searching...
No Matches
BF::Dictionary< K, V, S > Class Template Reference

#include <dictionary.hpp>

Inheritance diagram for BF::Dictionary< K, V, S >:
Collaboration diagram for BF::Dictionary< K, V, S >:

Classes

class  Entry
 

Public Types

typedef RBTree< Entry *, S >::Iterator Iterator
 

Public Member Functions

 Dictionary ()
 
 Dictionary (int(*keyCompareCallback)(K a1, K a2), void(*retainCallback)(K *k, V *v), void(*releaseCallback)(K *k, V *v))
 
virtual ~Dictionary ()
 
size () const
 
void setKeyCompareCallback (int(*cb)(K a1, K a2))
 
void setEntryReleaseCallback (void(*cb)(K *k, V *v))
 
void setEntryRetainCallback (void(*cb)(K *k, V *v))
 
valueForKey (K key)
 
int setValueForKey (K key, V value)
 
int removeValueForKey (K key)
 
void print ()
 
int createIterator (Iterator **itr)
 
- Public Member Functions inherited from BF::Object
 Object ()
 
 Object (Object &obj)
 
virtual ~Object ()
 

Friends

class Entry
 

Additional Inherited Members

- Static Public Member Functions inherited from BF::Object
static void retain (Object *obj)
 
static void release (Object *obj)
 
static int retainCount (Object *obj)
 
static int retainCount (Object &obj)
 

Detailed Description

template<typename K, typename V, typename S = int>
class BF::Dictionary< K, V, S >

Dictionary whose entries are pair with keys (of type K) and values (of type V)

Member Typedef Documentation

◆ Iterator

template<typename K , typename V , typename S = int>
typedef RBTree<Entry*,S>::Iterator BF::Dictionary< K, V, S >::Iterator

Constructor & Destructor Documentation

◆ Dictionary() [1/2]

template<typename K , typename V , typename S = int>
BF::Dictionary< K, V, S >::Dictionary ( )
inline
Here is the call graph for this function:

◆ Dictionary() [2/2]

template<typename K , typename V , typename S = int>
BF::Dictionary< K, V, S >::Dictionary ( int(* keyCompareCallback )(K a1, K a2),
void(* retainCallback )(K *k, V *v),
void(* releaseCallback )(K *k, V *v) )
inline

◆ ~Dictionary()

template<typename K , typename V , typename S = int>
virtual BF::Dictionary< K, V, S >::~Dictionary ( )
inlinevirtual

Member Function Documentation

◆ createIterator()

template<typename K , typename V , typename S = int>
int BF::Dictionary< K, V, S >::createIterator ( Iterator ** itr)
inline

◆ print()

template<typename K , typename V , typename S = int>
void BF::Dictionary< K, V, S >::print ( )
inline

Prints inorder traversal of tree

Here is the call graph for this function:

◆ removeValueForKey()

template<typename K , typename V , typename S = int>
int BF::Dictionary< K, V, S >::removeValueForKey ( K key)
inline

Removes key value pair

◆ setEntryReleaseCallback()

template<typename K , typename V , typename S = int>
void BF::Dictionary< K, V, S >::setEntryReleaseCallback ( void(* cb )(K *k, V *v))
inline

Defines how the keys and values memory gets deleted

◆ setEntryRetainCallback()

template<typename K , typename V , typename S = int>
void BF::Dictionary< K, V, S >::setEntryRetainCallback ( void(* cb )(K *k, V *v))
inline

Defines how the entry will retain the memory for keys and values

◆ setKeyCompareCallback()

template<typename K , typename V , typename S = int>
void BF::Dictionary< K, V, S >::setKeyCompareCallback ( int(* cb )(K a1, K a2))
inline

Defines how the entries will be organized in dictionary.

a1 == a2 -> 0 a1 < a2 -> -1 a1 > a2 -> 1

◆ setValueForKey()

template<typename K , typename V , typename S = int>
int BF::Dictionary< K, V, S >::setValueForKey ( K key,
V value )
inline

Pairs key to value and creates an entry in the dictionary

◆ size()

template<typename K , typename V , typename S = int>
S BF::Dictionary< K, V, S >::size ( ) const
inline

Returns number of key/value pairs

◆ valueForKey()

template<typename K , typename V , typename S = int>
V BF::Dictionary< K, V, S >::valueForKey ( K key)
inline

Returns value for key

Here is the call graph for this function:

Friends And Related Symbol Documentation

◆ Entry

template<typename K , typename V , typename S = int>
friend class Entry
friend

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