TalanSoft Toolkits  201707
 All Classes Namespaces Functions Variables Typedefs Enumerations Enumerator Groups Pages
Public Types | Public Member Functions | List of all members
IndexedMap< KEYT, ITEMT, > Class Template Reference

Public Types

typedef astl::map< KEYT, tU32,
KEYCMP, allocator_indexed_map
< astl::pair< KEYT, tU32 > > > 
tKeyIdxMap
 
typedef niTypename
tKeyIdxMap::iterator 
iterator
 
typedef niTypename
tKeyIdxMap::const_iterator 
const_iterator
 
typedef niTypename
tKeyIdxMap::iterator 
tKeyIdxMapIt
 
typedef niTypename
tKeyIdxMap::const_iterator 
tKeyIdxMapCIt
 

Public Member Functions

 IndexedMap ()
 
 ~IndexedMap ()
 
tU32 Set (const tKey &aKey, const tItem &aItem)
 Set value of an item. If the item don't exists it's added. More...
 
void Reserve (tSize anCount)
 Reserve memory for N items. More...
 
tBool IsEmpty () const
 Get whether the container is empty. More...
 
tSize GetSize () const
 Get the size of the container. More...
 
tBool HasKey (const tKey &aKey) const
 Get whether an item with the specified key is in the container. More...
 
tBool HasIndex (tU32 anIndex) const
 Get whether an item with the specified index is in the container. More...
 
const tKey * GetKeyPtr (tU32 anIndex) const
 Get the key of the item with the given index. More...
 
const tKey & GetKey (tU32 anIndex) const
 Get the key of the item with the given index. More...
 
tU32 GetKeyIndex (const tKey &aKey) const
 Get the index of the item with the given name. More...
 
tItem & GetItem (tU32 nIndex)
 Get a reference to the item with the given index. More...
 
tItem & GetItem (const tKey &aKey)
 Get a reference to the item from the given key. More...
 
tItem * GetItemPtr (tU32 nIndex)
 Get a pointer to the item with the given index. More...
 
tItem * GetItemPtr (const tKey &aKey)
 Get a pointer to the item with the given key. More...
 
__forceinline const tItem & GetItem (tU32 anIndex) const
 
__forceinline const tItem & GetItem (const tKey &aKey) const
 
__forceinline const tItem * GetItemPtr (tU32 anIndex) const
 
__forceinline const tItem * GetItemPtr (const tKey &aKey) const
 
tBool EraseIndex (tU32 nIndex)
 Remove the item with the given index. More...
 
tBool EraseKey (const tKey &aKey)
 Remove the item with the given name. More...
 
void Clear ()
 Remove all items in the MapIndex. More...
 
tItem & operator[] (tU32 nIndex)
 Return a reference of the item with the given index. More...
 
const tItem & operator[] (tU32 nIndex) const
 Return a constant reference of the item with the given index. More...
 
tItem & operator[] (const tKey &aKey)
 Return a reference of the item with the given name. More...
 
const tItem & operator[] (const tKey &aKey) const
 Return a reference of the item with the given name. More...
 

Member Typedef Documentation

typedef astl::map<KEYT,tU32, KEYCMP, allocator_indexed_map<astl::pair<KEYT,tU32> > > tKeyIdxMap

Constructor & Destructor Documentation

~IndexedMap ( )

Member Function Documentation

tU32 Set ( const tKey &  aKey,
const tItem &  aItem 
)

Set value of an item. If the item don't exists it's added.

Parameters
aKeyis the name of the item to add.
aItemis the value of the item to add.
Returns
The index of the added item, return eInvalidHandle if set failed.
void Reserve ( tSize  anCount)

Reserve memory for N items.

tBool IsEmpty ( ) const

Get whether the container is empty.

tSize GetSize ( ) const

Get the size of the container.

tBool HasKey ( const tKey &  aKey) const

Get whether an item with the specified key is in the container.

tBool HasIndex ( tU32  anIndex) const

Get whether an item with the specified index is in the container.

const tKey* GetKeyPtr ( tU32  anIndex) const

Get the key of the item with the given index.

Returns
NULL if the index is invalid.
const tKey& GetKey ( tU32  anIndex) const

Get the key of the item with the given index.

tU32 GetKeyIndex ( const tKey &  aKey) const

Get the index of the item with the given name.

Returns
eInvalidHandle if the item is not in the MapIndex.
tItem& GetItem ( tU32  nIndex)

Get a reference to the item with the given index.

Remarks
Assert if the index is invalid.
tItem& GetItem ( const tKey &  aKey)

Get a reference to the item from the given key.

Remarks
Assert if the index is invalid.
tItem* GetItemPtr ( tU32  nIndex)

Get a pointer to the item with the given index.

Remarks
return NULL if the index is invalid.
tItem* GetItemPtr ( const tKey &  aKey)

Get a pointer to the item with the given key.

Remarks
return NULL if the key is invalid.
__forceinline const tItem& GetItem ( tU32  anIndex) const
__forceinline const tItem& GetItem ( const tKey &  aKey) const
__forceinline const tItem* GetItemPtr ( tU32  anIndex) const
__forceinline const tItem* GetItemPtr ( const tKey &  aKey) const
tBool EraseIndex ( tU32  nIndex)

Remove the item with the given index.

Returns
eFalse if the index is invalid, else eTrue.
tBool EraseKey ( const tKey &  aKey)

Remove the item with the given name.

Returns
eFalse if the item don't exists, else eTrue.
void Clear ( )

Remove all items in the MapIndex.

tItem& operator[] ( tU32  nIndex)

Return a reference of the item with the given index.

const tItem& operator[] ( tU32  nIndex) const

Return a constant reference of the item with the given index.

tItem& operator[] ( const tKey &  aKey)

Return a reference of the item with the given name.

const tItem& operator[] ( const tKey &  aKey) const

Return a reference of the item with the given name.