![]() |
Elm
2
ELM is a library providing generic data structures, OS-independent interface, plugins and XML.
|
#include <elm/data/FragTable.h>
Inheritance diagram for FragTable< T, E, A >:Classes | |
| class | BaseIter |
| class | Iter |
| class | MutIter |
Public Types | |
| typedef T | t |
| typedef FragTable< T, E, A > | self_t |
Public Types inherited from Equiv< T > | |
| typedef T | t |
Public Member Functions | |
| FragTable (int size_pow=8) | |
| FragTable (const FragTable &t) | |
| ~FragTable (void) | |
| int | pageSize () const |
| int | pagePower () const |
| bool | pageFull () const |
| Iter | begin () const |
| Iter | end () const |
| int | count (void) const |
| bool | contains (const T &v) const |
| template<class C > | |
| bool | containsAll (const C &c) const |
| bool | isEmpty () const |
| operator bool (void) const | |
| Iter | items (void) const |
| Iter | operator* (void) const |
| operator Iter (void) const | |
| bool | equals (const self_t &t) const |
| bool | operator== (const self_t &t) const |
| bool | operator!= (const self_t &t) const |
| MutIter | begin () |
| MutIter | end () |
| void | clear (void) |
| void | add (const T &value) |
| template<template< class _ > class C> | |
| void | addAll (const C< T > &items) |
| void | remove (const T &item) |
| template<template< class _ > class C> | |
| void | removeAll (const C< T > &items) |
| void | remove (const Iter &iter) |
| self_t & | operator+= (const T &v) |
| self_t & | operator-= (const T &v) |
| int | length (void) const |
| const T & | get (int index) const |
| int | indexOf (const T &value, int start=0) const |
| int | lastIndexOf (const T &value, int start=-1) const |
| const T & | operator[] (int index) const |
| void | shrink (int length) |
| void | set (int index, const T &value) |
| void | set (const Iter &iter, const T &item) |
| T & | get (int index) |
| T & | operator[] (int index) |
| void | insert (int index, const T &item) |
| void | insert (const Iter &iter, const T &item) |
| void | removeAt (int index) |
| void | removeAt (const Iter &iter) |
| int | alloc (int count) |
Public Member Functions inherited from Equiv< T > | |
| bool | isEqual (const T &v1, const T &v2) const |
Public Member Functions inherited from DefaultAllocatorDelegate | |
| t::ptr | allocate (t::size size) const |
| void | free (t::ptr p) const |
| template<class T > | |
| T * | alloc () const |
Additional Inherited Members | |
Static Public Member Functions inherited from Equiv< T > | |
| static bool | equals (const T &v1, const T &v2) |
Static Public Attributes inherited from Equiv< T > | |
| static Equiv< T > | def |
This container class allows indexed access to its data. It is implemented as expandable fragmented table using a two-level table traversal. The first level table selects a sub-table that contains the actual stored items.
Complexity information (N items, chunks of size S):
Implemented concepts:
| T | Type of stored items. |
| M | Type of the data structure manager (default to EquivManager). |
| typedef T t |
|
inline |
The constructor of a fragmented table.
| chunk_size | 2^chunk_size is the size of sub-tables (default to 256). |
Build a fragmented table by copy.
| tab | Table to copy. |
References FragTable< T, E, A >::addAll().
References FragTable< T, E, A >::clear().
|
inline |
Add an item to the table.
| value | Value of the item to add. |
Referenced by FragTable< T, E, A >::addAll(), and FragTable< T, E, A >::operator+=().
|
inline |
Add a collection of item to the table.
| items | Items to add. |
References FragTable< T, E, A >::add(), and FragTable< T, E, A >::items().
Referenced by FragTable< T, E, A >::FragTable().
|
inline |
Allocate the given count of items in sequence in the table and return the index of the first item.
| count | Count of items to allocate. |
References FragTable< T, E, A >::count(), and FragTable< T, E, A >::length().
References FragTable< T, E, A >::items().
Referenced by FragTable< T, E, A >::equals().
Remove all items from the fragmeted table and release as many memory as possible.
Referenced by FragTable< T, E, A >::~FragTable().
|
inline |
Test if the table contains the given item.
| item | Item to look for. |
References FragTable< T, E, A >::get(), and FragTable< T, E, A >::length().
Referenced by FragTable< T, E, A >::containsAll(), and elm::operator<=().
|
inline |
References FragTable< T, E, A >::contains().
|
inline |
Same as @length().
References FragTable< T, E, A >::length().
Referenced by FragTable< T, E, A >::alloc(), and FragTable< T, E, A >::end().
References FragTable< T, E, A >::count().
References FragTable< T, E, A >::count().
References FragTable< T, E, A >::begin().
Referenced by FragTable< T, E, A >::operator!=(), and FragTable< T, E, A >::operator==().
|
inline |
Same as FragTable::get() const but return a mutable reference.
| index | Index of the looked item. |
References FragTable< T, E, A >::length().
|
inline |
Get the item at the given index.
| index | Index of the looked item. |
References FragTable< T, E, A >::length().
Referenced by FragTable< T, E, A >::contains(), FragTable< T, E, A >::insert(), FragTable< T, E, A >::MutIter::item(), FragTable< T, E, A >::BaseIter::item(), FragTable< T, E, A >::Iter::item(), FragTable< T, E, A >::lastIndexOf(), FragTable< T, E, A >::operator[](), and FragTable< T, E, A >::removeAt().
|
inline |
Get the first index of a value in the array.
| value | Value to look for. |
| start | Start index to look at (default to 0). |
References FragTable< T, E, A >::insert().
|
inline |
Insert an item at the given position and move the following item in the next indexes.
| index | Index to insert to. |
| item | Item to insert. |
References DefaultAllocatorDelegate::alloc(), FragTable< T, E, A >::get(), FragTable< T, E, A >::length(), and FragTable< T, E, A >::set().
Referenced by FragTable< T, E, A >::insert().
Test if the fragmented table is empty.
Referenced by FragTable< T, E, A >::operator bool().
|
inline |
Get the last index of a value in the array.
| value | Value to look for. |
| start | Start index to look back (default to -1 for end of array). |
References FragTable< T, E, A >::get(), and FragTable< T, E, A >::length().
|
inline |
Get the length / item count of the table.
Referenced by FragTable< T, E, A >::alloc(), FragTable< T, E, A >::contains(), FragTable< T, E, A >::count(), FragTable< T, E, A >::get(), FragTable< T, E, A >::insert(), FragTable< T, E, A >::lastIndexOf(), FragTable< T, E, A >::removeAt(), FragTable< T, E, A >::set(), and FragTable< T, E, A >::shrink().
References FragTable< T, E, A >::items().
References FragTable< T, E, A >::equals().
References FragTable< T, E, A >::items().
|
inline |
Operator implementing FragTable::add().
Operator implementing FragTable::add().
References FragTable< T, E, A >::add().
|
inline |
References FragTable< T, E, A >::remove().
References FragTable< T, E, A >::equals().
|
inline |
Operator implementing FragTable::get().
References FragTable< T, E, A >::get().
|
inline |
References FragTable< T, E, A >::get().
|
inline |
Test if the current page is full.
|
inline |
Get the page size as a power of 2.
|
inline |
Get the page size (in elements).
References FragTable< T, E, A >::removeAt().
|
inline |
Remove an item from the table.
| item | Item to remove. |
Referenced by FragTable< T, E, A >::operator-=(), and FragTable< T, E, A >::removeAll().
|
inline |
Remove a collection of items.
| items | Items to remove. |
References FragTable< T, E, A >::items(), and FragTable< T, E, A >::remove().
References FragTable< T, E, A >::removeAt().
Referenced by FragTable< T, E, A >::removeAt().
|
inline |
Remove the item at the given index and shift back following items.
| index | Index of the item to remove. |
References FragTable< T, E, A >::get(), FragTable< T, E, A >::length(), and FragTable< T, E, A >::set().
Referenced by FragTable< T, E, A >::remove().
References FragTable< T, E, A >::set().
Referenced by FragTable< T, E, A >::set().
|
inline |
References FragTable< T, E, A >::length().
Referenced by FragTable< T, E, A >::insert(), and FragTable< T, E, A >::removeAt().
|
inline |
Shrink the size of the table.
| length | New length of the table. |
References FragTable< T, E, A >::length().