CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups 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)=delete
 avoid affectation operator More...
 
 TrieFactory ()=delete
 avoid default constructor More...
 
 TrieFactory (const TrieFactory &e)=delete
 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 39 of file Trie.h.

Constructor & Destructor Documentation

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

Definition at line 288 of file Trie.h.

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

289  : _paquetSize(paquetSize), _lastNodes(nullptr), _nbUsedInLastNodes(0) {
290  _lastNodes = new TrieNode<T>[paquetSize];
291 }
TrieNode< T > * _lastNodes
Definition: Trie.h:59
unsigned _nbUsedInLastNodes
Definition: Trie.h:60
unsigned _paquetSize
Definition: Trie.h:57
template<typename T >
edm::TrieFactory< T >::~TrieFactory ( )

Definition at line 294 of file Trie.h.

294  {
295  typename std::list<TrieNode<T> *>::const_iterator it;
296 
297  for (it = _allocatedNodes.begin(); it != _allocatedNodes.end(); ++it)
298  delete[] * it;
299  if (_lastNodes)
300  delete[] _lastNodes;
301 }
std::list< TrieNode< T > * > _allocatedNodes
Definition: Trie.h:58
TrieNode< T > * _lastNodes
Definition: Trie.h:59
template<typename T>
edm::TrieFactory< T >::TrieFactory ( )
privatedelete

avoid default constructor

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

avoid copy constructor

Member Function Documentation

template<typename T >
void edm::TrieFactory< T >::clear ( void  )

Definition at line 318 of file Trie.h.

Referenced by BeautifulSoup.Tag::setString().

318  {
319  typename std::list<TrieNode<T> *>::const_iterator it;
320  for (it = _allocatedNodes.begin(); it != _allocatedNodes.end(); ++it)
321  delete[] * it;
322  _allocatedNodes.clear();
323  _nbUsedInLastNodes = 0;
324 }
std::list< TrieNode< T > * > _allocatedNodes
Definition: Trie.h:58
unsigned _nbUsedInLastNodes
Definition: Trie.h:60
template<typename T >
edm::TrieNode< T > * edm::TrieFactory< T >::newNode ( const T value)

Definition at line 304 of file Trie.h.

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

304  {
306  _allocatedNodes.push_back(_lastNodes);
307  _nbUsedInLastNodes = 0;
308  _lastNodes = new TrieNode<T>[_paquetSize];
309  }
310  TrieNode<T> *res = &_lastNodes[_nbUsedInLastNodes];
312  res->setValue(value);
313  res->clear();
314  return res;
315 }
std::list< TrieNode< T > * > _allocatedNodes
Definition: Trie.h:58
TrieNode< T > * _lastNodes
Definition: Trie.h:59
unsigned _nbUsedInLastNodes
Definition: Trie.h:60
unsigned _paquetSize
Definition: Trie.h:57
template<typename T>
TrieFactory& edm::TrieFactory< T >::operator= ( const TrieFactory< T > &  e)
privatedelete

avoid affectation operator

Member Data Documentation

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

Definition at line 58 of file Trie.h.

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

Definition at line 59 of file Trie.h.

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

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

Definition at line 60 of file Trie.h.

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

Definition at line 57 of file Trie.h.