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 321 of file Trie.h.

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

321  :
322  _paquetSize(paquetSize), _lastNodes(0x0), _nbUsedInLastNodes(0)
323 {
324  _lastNodes = new TrieNode<T>[paquetSize];
325 }
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 328 of file Trie.h.

329 {
330  typename std::list<TrieNode<T>*>::const_iterator it;
331 
332  for (it = _allocatedNodes.begin(); it != _allocatedNodes.end(); ++it)
333  delete[] *it;
334  if (_lastNodes)
335  delete[] _lastNodes;
336 }
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 339 of file Trie.h.

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

340 {
342  {
343  _allocatedNodes.push_back(_lastNodes);
344  _nbUsedInLastNodes = 0;
345  _lastNodes = new TrieNode<T>[_paquetSize];
346  }
347  TrieNode<T> *res = &_lastNodes[_nbUsedInLastNodes];
349  res->setValue(value);
350  res->clear();
351  return res;
352 }
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.