#include <Trie.h>
Public Member Functions | |
void | clear () |
TrieNode< T > * | newNode (const T &value) |
TrieFactory (unsigned paquetSize) | |
~TrieFactory () | |
Private Member Functions | |
TrieFactory & | operator= (const TrieFactory &e) |
avoid affectation operator | |
TrieFactory () | |
avoid default constructor | |
TrieFactory (const TrieFactory &e) | |
avoid copy constructor | |
Private Attributes | |
std::list< TrieNode< T > * > | _allocatedNodes |
TrieNode< T > * | _lastNodes |
unsigned | _nbUsedInLastNodes |
unsigned | _paquetSize |
The goal of this class is to allocate Trie node by paquet of X element in order to reduce heap-admin size
edm::TrieFactory< T >::TrieFactory | ( | unsigned | paquetSize | ) |
Definition at line 321 of file Trie.h.
References edm::TrieFactory< T >::_lastNodes.
: _paquetSize(paquetSize), _lastNodes(0x0), _nbUsedInLastNodes(0) { _lastNodes = new TrieNode<T>[paquetSize]; }
edm::TrieFactory< T >::~TrieFactory | ( | ) |
Definition at line 328 of file Trie.h.
{ typename std::list<TrieNode<T>*>::const_iterator it; for (it = _allocatedNodes.begin(); it != _allocatedNodes.end(); ++it) delete[] *it; if (_lastNodes) delete[] _lastNodes; }
edm::TrieFactory< T >::TrieFactory | ( | ) | [private] |
avoid default constructor
edm::TrieFactory< T >::TrieFactory | ( | const TrieFactory< T > & | e | ) | [private] |
avoid copy constructor
void edm::TrieFactory< T >::clear | ( | void | ) |
Definition at line 355 of file Trie.h.
{ typename std::list<TrieNode<T>*>::const_iterator it; for (it = _allocatedNodes.begin(); it != _allocatedNodes.end(); ++it) delete[] *it; _allocatedNodes.clear(); _nbUsedInLastNodes = 0; }
edm::TrieNode< T > * edm::TrieFactory< T >::newNode | ( | const T & | value | ) |
Definition at line 339 of file Trie.h.
References edm::TrieNode< T >::clear(), and edm::TrieNode< T >::setValue().
{ if (_nbUsedInLastNodes == _paquetSize) { _allocatedNodes.push_back(_lastNodes); _nbUsedInLastNodes = 0; _lastNodes = new TrieNode<T>[_paquetSize]; } TrieNode<T> *res = &_lastNodes[_nbUsedInLastNodes]; ++_nbUsedInLastNodes; res->setValue(value); res->clear(); return res; }
TrieFactory& edm::TrieFactory< T >::operator= | ( | const TrieFactory< T > & | e | ) | [private] |
avoid affectation operator
std::list<TrieNode<T>*> edm::TrieFactory< T >::_allocatedNodes [private] |
TrieNode<T>* edm::TrieFactory< T >::_lastNodes [private] |
Definition at line 62 of file Trie.h.
Referenced by edm::TrieFactory< T >::TrieFactory().
unsigned edm::TrieFactory< T >::_nbUsedInLastNodes [private] |
unsigned edm::TrieFactory< T >::_paquetSize [private] |