LRAUV  revA
FastMap< S, T > Class Template Reference

Simple class for providing key-pointer mappings. More...

#include <Slate.h>

Collaboration diagram for FastMap< S, T >:

Public Member Functions

 FastMap (bool allowDups=false, const unsigned short initialSize=32)
 
virtual ~FastMap ()
 
bool put (S &key, T item, bool deleteOnCleanup=false)
 
get (const S &key, bool andPop=false)
 
pop (S &key)
 
getIndexed (unsigned int index, bool andPop=false)
 
MapEntry< S, T > * getIndexedEntry (unsigned int index, bool andPop=false)
 
popIndexed (unsigned int index)
 
S & findKey (T item, const S &defaultValue)
 
int findIndex (const S &key, int minIndex=0, int maxIndex=-1)
 
unsigned int size ()
 
FlexArray< MapEntry< S, T > * > getArray ()
 
void clear (bool andDeleteValues=false)
 

Protected Attributes

FlexArray< MapEntry< S, T > * > array_
 
bool allowDups_
 
nullItem_
 

Private Member Functions

 FastMap (const FastMap< S, T > &old)
 

Detailed Description

template<typename S, typename T>
class FastMap< S, T >

Simple class for providing key-pointer mappings.

Keys are sorted as they are added, to allow for quick (~log(entries)) lookups.

Multiple pointers per key may be allowed.

Keys must have a compare() method that allows one to compare keys for sorting.

Constructor & Destructor Documentation

template<typename S, typename T>
FastMap< S, T >::FastMap ( bool  allowDups = false,
const unsigned short  initialSize = 32 
)
inline
template<typename S, typename T>
virtual FastMap< S, T >::~FastMap ( )
inlinevirtual
template<typename S, typename T>
FastMap< S, T >::FastMap ( const FastMap< S, T > &  old)
private

Member Function Documentation

template<typename S, typename T>
void FastMap< S, T >::clear ( bool  andDeleteValues = false)
inline
template<typename S, typename T>
int FastMap< S, T >::findIndex ( const S &  key,
int  minIndex = 0,
int  maxIndex = -1 
)
inline
template<typename S, typename T>
S& FastMap< S, T >::findKey ( item,
const S &  defaultValue 
)
inline
template<typename S, typename T>
T FastMap< S, T >::get ( const S &  key,
bool  andPop = false 
)
inline
template<typename S, typename T>
FlexArray<MapEntry<S, T>*> FastMap< S, T >::getArray ( )
inline
template<typename S, typename T>
T FastMap< S, T >::pop ( S &  key)
inline

Member Data Documentation

template<typename S, typename T>
bool FastMap< S, T >::allowDups_
protected
template<typename S, typename T>
T FastMap< S, T >::nullItem_
protected

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