Visualization Library 2.0.0

A lightweight C++ OpenGL middleware for 2D/3D graphics

VL     Star     Watch     Fork     Issue

[Download] [Tutorials] [All Classes] [Grouped Classes]
Public Member Functions | Protected Attributes | List of all members
vl::NaryQuickMap< KeyType, ValueType, MaxMapType > Class Template Reference

Simple map used to add, remove, iterate, clear elements efficiently (all O(1)). More...

#include <NaryQuickMap.hpp>

+ Inheritance diagram for vl::NaryQuickMap< KeyType, ValueType, MaxMapType >:

Public Member Functions

 NaryQuickMap ()
 
void reset ()
 
void clear ()
 
int size () const
 
ValueType * begin ()
 
ValueType * end ()
 
const ValueType * begin () const
 
const ValueType * end () const
 
void append (KeyType key)
 
void append (KeyType key, ValueType value)
 
void insert (KeyType key)
 
void insert (KeyType key, const ValueType &value)
 
void erase (KeyType key)
 
int find (KeyType key) const
 
bool hasKey (KeyType key) const
 
const ValueType & valueFromKey (KeyType key) const
 
const ValueType & valueFromIndex (int i) const
 
KeyType key (int i) const
 
- Public Member Functions inherited from vl::Object
 Object ()
 Constructor. More...
 
 Object (const Object &other)
 Copy constructor: copies the name, ref count mutex and user data. More...
 
Objectoperator= (const Object &other)
 Copy operator: copies the object's name, ref count mutex and user data. More...
 
const std::string & objectName () const
 The name of the object, by default set to the object's class name. More...
 
void setObjectName (const char *name)
 The name of the object, by default set to the object's class name in debug builds. More...
 
void setObjectName (const std::string &name)
 The name of the object, by default set to the object's class name in debug builds. More...
 
void setRefCountMutex (IMutex *mutex)
 The mutex used to protect the reference counting of an Object across multiple threads. More...
 
IMutexrefCountMutex ()
 The mutex used to protect the reference counting of an Object across multiple threads. More...
 
const IMutexrefCountMutex () const
 The mutex used to protect the reference counting of an Object across multiple threads. More...
 
int referenceCount () const
 Returns the number of references of an object. More...
 
void incReference () const
 Increments the reference count of an object. More...
 
void decReference ()
 Decrements the reference count of an object and deletes it if both automaticDelete() is true the count reaches 0. More...
 
void setAutomaticDelete (bool autodel_on)
 If set to true the Object is deleted when its reference count reaches 0. More...
 
bool automaticDelete () const
 If set to true the Object is deleted when its reference count reaches 0. More...
 
template<class T >
T * as ()
 Casts an Object to the specified class. More...
 
template<class T >
const T * as () const
 Casts an Object to the specified class. More...
 

Protected Attributes

ValueType mValues [MaxMapType]
 
KeyType mValueToKey [MaxMapType]
 
int mMapSize
 
int mKeyToValue [MaxMapType]
 
- Protected Attributes inherited from vl::Object
std::string mObjectName
 
IMutexmRefCountMutex
 
int mReferenceCount
 
bool mAutomaticDelete
 

Additional Inherited Members

- Protected Member Functions inherited from vl::Object
virtual ~Object ()
 

Detailed Description

template<typename KeyType, typename ValueType, int MaxMapType>
class vl::NaryQuickMap< KeyType, ValueType, MaxMapType >

Simple map used to add, remove, iterate, clear elements efficiently (all O(1)).

To be used only when the number of keys is well defined and not too big. Internally used by VL to deal with enables and render states.

Definition at line 43 of file NaryQuickMap.hpp.

Constructor & Destructor Documentation

◆ NaryQuickMap()

template<typename KeyType, typename ValueType, int MaxMapType>
vl::NaryQuickMap< KeyType, ValueType, MaxMapType >::NaryQuickMap ( )
inline

Definition at line 46 of file NaryQuickMap.hpp.

Member Function Documentation

◆ append() [1/2]

template<typename KeyType, typename ValueType, int MaxMapType>
void vl::NaryQuickMap< KeyType, ValueType, MaxMapType >::append ( KeyType  key)
inline

◆ append() [2/2]

template<typename KeyType, typename ValueType, int MaxMapType>
void vl::NaryQuickMap< KeyType, ValueType, MaxMapType >::append ( KeyType  key,
ValueType  value 
)
inline

Definition at line 77 of file NaryQuickMap.hpp.

◆ begin() [1/2]

template<typename KeyType, typename ValueType, int MaxMapType>
ValueType* vl::NaryQuickMap< KeyType, ValueType, MaxMapType >::begin ( )
inline

Definition at line 66 of file NaryQuickMap.hpp.

◆ begin() [2/2]

template<typename KeyType, typename ValueType, int MaxMapType>
const ValueType* vl::NaryQuickMap< KeyType, ValueType, MaxMapType >::begin ( ) const
inline

Definition at line 68 of file NaryQuickMap.hpp.

◆ clear()

template<typename KeyType, typename ValueType, int MaxMapType>
void vl::NaryQuickMap< KeyType, ValueType, MaxMapType >::clear ( )
inline

Definition at line 58 of file NaryQuickMap.hpp.

◆ end() [1/2]

template<typename KeyType, typename ValueType, int MaxMapType>
ValueType* vl::NaryQuickMap< KeyType, ValueType, MaxMapType >::end ( )
inline

Definition at line 67 of file NaryQuickMap.hpp.

◆ end() [2/2]

template<typename KeyType, typename ValueType, int MaxMapType>
const ValueType* vl::NaryQuickMap< KeyType, ValueType, MaxMapType >::end ( ) const
inline

Definition at line 69 of file NaryQuickMap.hpp.

◆ erase()

template<typename KeyType, typename ValueType, int MaxMapType>
void vl::NaryQuickMap< KeyType, ValueType, MaxMapType >::erase ( KeyType  key)
inline

Definition at line 105 of file NaryQuickMap.hpp.

◆ find()

template<typename KeyType, typename ValueType, int MaxMapType>
int vl::NaryQuickMap< KeyType, ValueType, MaxMapType >::find ( KeyType  key) const
inline

◆ hasKey()

template<typename KeyType, typename ValueType, int MaxMapType>
bool vl::NaryQuickMap< KeyType, ValueType, MaxMapType >::hasKey ( KeyType  key) const
inline

Definition at line 144 of file NaryQuickMap.hpp.

◆ insert() [1/2]

template<typename KeyType, typename ValueType, int MaxMapType>
void vl::NaryQuickMap< KeyType, ValueType, MaxMapType >::insert ( KeyType  key)
inline

◆ insert() [2/2]

template<typename KeyType, typename ValueType, int MaxMapType>
void vl::NaryQuickMap< KeyType, ValueType, MaxMapType >::insert ( KeyType  key,
const ValueType &  value 
)
inline

Definition at line 91 of file NaryQuickMap.hpp.

◆ key()

template<typename KeyType, typename ValueType, int MaxMapType>
KeyType vl::NaryQuickMap< KeyType, ValueType, MaxMapType >::key ( int  i) const
inline

◆ reset()

template<typename KeyType, typename ValueType, int MaxMapType>
void vl::NaryQuickMap< KeyType, ValueType, MaxMapType >::reset ( )
inline

◆ size()

template<typename KeyType, typename ValueType, int MaxMapType>
int vl::NaryQuickMap< KeyType, ValueType, MaxMapType >::size ( ) const
inline

Definition at line 64 of file NaryQuickMap.hpp.

◆ valueFromIndex()

template<typename KeyType, typename ValueType, int MaxMapType>
const ValueType& vl::NaryQuickMap< KeyType, ValueType, MaxMapType >::valueFromIndex ( int  i) const
inline

Definition at line 158 of file NaryQuickMap.hpp.

◆ valueFromKey()

template<typename KeyType, typename ValueType, int MaxMapType>
const ValueType& vl::NaryQuickMap< KeyType, ValueType, MaxMapType >::valueFromKey ( KeyType  key) const
inline

Definition at line 149 of file NaryQuickMap.hpp.

Member Data Documentation

◆ mKeyToValue

template<typename KeyType, typename ValueType, int MaxMapType>
int vl::NaryQuickMap< KeyType, ValueType, MaxMapType >::mKeyToValue[MaxMapType]
protected

◆ mMapSize

template<typename KeyType, typename ValueType, int MaxMapType>
int vl::NaryQuickMap< KeyType, ValueType, MaxMapType >::mMapSize
protected

◆ mValues

template<typename KeyType, typename ValueType, int MaxMapType>
ValueType vl::NaryQuickMap< KeyType, ValueType, MaxMapType >::mValues[MaxMapType]
protected

◆ mValueToKey

template<typename KeyType, typename ValueType, int MaxMapType>
KeyType vl::NaryQuickMap< KeyType, ValueType, MaxMapType >::mValueToKey[MaxMapType]
protected

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