CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
List of all members | Public Member Functions | Private Member Functions | Private Attributes
edm::TrieFactory< T > Class Template Reference

#include <Trie.h>

Public Member Functions

void clear ()
 
TrieNode< T > * newNode (const T &value)
 
 TrieFactory (unsigned paquetSize)
 
 ~TrieFactory ()
 

Private Member Functions

TrieFactoryoperator= (const TrieFactory &e)
 avoid affectation operator More...
 
 TrieFactory ()
 avoid default constructor More...
 
 TrieFactory (const TrieFactory &e)
 avoid copy constructor More...
 

Private Attributes

std::list< TrieNode< T > * > _allocatedNodes
 
TrieNode< T > * _lastNodes
 
unsigned _nbUsedInLastNodes
 
unsigned _paquetSize
 

Detailed Description

template<typename T>
class edm::TrieFactory< T >

The goal of this class is to allocate Trie node by paquet of X element in order to reduce heap-admin size

Definition at line 41 of file Trie.h.

Constructor & Destructor Documentation

template<typename T >
edm::TrieFactory< T >::TrieFactory ( unsigned  paquetSize)

Definition at line 319 of file Trie.h.

References edm::TrieFactory< T >::_lastNodes.

319  :
320  _paquetSize(paquetSize), _lastNodes(0x0), _nbUsedInLastNodes(0)
321 {
322  _lastNodes = new TrieNode<T>[paquetSize];
323 }
TrieNode< T > * _lastNodes
Definition: Trie.h:62
unsigned _nbUsedInLastNodes
Definition: Trie.h:63
unsigned _paquetSize
Definition: Trie.h:60
template<typename T >
edm::TrieFactory< T >::~TrieFactory ( )

Definition at line 326 of file Trie.h.

327 {
328  typename std::list<TrieNode<T>*>::const_iterator it;
329 
330  for (it = _allocatedNodes.begin(); it != _allocatedNodes.end(); ++it)
331  delete[] *it;
332  if (_lastNodes)
333  delete[] _lastNodes;
334 }
TrieNode< T > * _lastNodes
Definition: Trie.h:62
std::list< TrieNode< T > * > _allocatedNodes
Definition: Trie.h:61
template<typename T>
edm::TrieFactory< T >::TrieFactory ( )
private

avoid default constructor

template<typename T>
edm::TrieFactory< T >::TrieFactory ( const TrieFactory< T > &  e)
private

avoid copy constructor

Member Function Documentation

template<typename T >
void edm::TrieFactory< T >::clear ( void  )
template<typename T >
edm::TrieNode< T > * edm::TrieFactory< T >::newNode ( const T value)

Definition at line 337 of file Trie.h.

References edm::TrieNode< T >::clear(), and edm::TrieNode< T >::setValue().

338 {
340  {
341  _allocatedNodes.push_back(_lastNodes);
342  _nbUsedInLastNodes = 0;
343  _lastNodes = new TrieNode<T>[_paquetSize];
344  }
345  TrieNode<T> *res = &_lastNodes[_nbUsedInLastNodes];
347  res->setValue(value);
348  res->clear();
349  return res;
350 }
TrieNode< T > * _lastNodes
Definition: Trie.h:62
std::list< TrieNode< T > * > _allocatedNodes
Definition: Trie.h:61
unsigned _nbUsedInLastNodes
Definition: Trie.h:63
unsigned _paquetSize
Definition: Trie.h:60
template<typename T>
TrieFactory& edm::TrieFactory< T >::operator= ( const TrieFactory< T > &  e)
private

avoid affectation operator

Member Data Documentation

template<typename T>
std::list<TrieNode<T>*> edm::TrieFactory< T >::_allocatedNodes
private

Definition at line 61 of file Trie.h.

template<typename T>
TrieNode<T>* edm::TrieFactory< T >::_lastNodes
private

Definition at line 62 of file Trie.h.

Referenced by edm::TrieFactory< T >::TrieFactory().

template<typename T>
unsigned edm::TrieFactory< T >::_nbUsedInLastNodes
private

Definition at line 63 of file Trie.h.

template<typename T>
unsigned edm::TrieFactory< T >::_paquetSize
private

Definition at line 60 of file Trie.h.