CMS 3D CMS Logo

List of all members | Public Member Functions | Private Attributes
mkfit::CcPool< T > Class Template Reference

#include <TrackStructures.h>

Public Member Functions

Tallocate (std::size_t n)
 
 CcPool (std::size_t size=0)
 
void deallocate (T *p, std::size_t n) noexcept
 
void release ()
 
void reset (std::size_t size)
 

Private Attributes

std::vector< Tm_mem
 
std::size_t m_pos = 0
 
std::size_t m_size = 0
 

Detailed Description

template<class T>
class mkfit::CcPool< T >

Definition at line 94 of file TrackStructures.h.

Constructor & Destructor Documentation

◆ CcPool()

template<class T>
mkfit::CcPool< T >::CcPool ( std::size_t  size = 0)
inline

Definition at line 110 of file TrackStructures.h.

110  {
111  if (size)
112  reset(size);
113  }
size
Write out results.
void reset(std::size_t size)

Member Function Documentation

◆ allocate()

template<class T>
T* mkfit::CcPool< T >::allocate ( std::size_t  n)
inline

Definition at line 115 of file TrackStructures.h.

115  {
116  if (m_pos + n > m_size)
117  throw std::bad_alloc();
118  T* ret = &m_mem[m_pos];
119  m_pos += n;
120  return ret;
121  }
ret
prodAgent to be discontinued
std::size_t m_pos
std::vector< T > m_mem
long double T
std::size_t m_size

◆ deallocate()

template<class T>
void mkfit::CcPool< T >::deallocate ( T p,
std::size_t  n 
)
inlinenoexcept

Definition at line 123 of file TrackStructures.h.

123  {
124  // we do not care, implied deallocation of the whole pool on reset().
125  }

◆ release()

template<class T>
void mkfit::CcPool< T >::release ( )
inline

Definition at line 103 of file TrackStructures.h.

103  {
104  std::vector<T> tmp;
105  m_mem.swap(tmp);
106  m_pos = 0;
107  m_size = 0;
108  }
std::size_t m_pos
std::vector< T > m_mem
tmp
align.sh
Definition: createJobs.py:716
std::size_t m_size

◆ reset()

template<class T>
void mkfit::CcPool< T >::reset ( std::size_t  size)
inline

Definition at line 96 of file TrackStructures.h.

Referenced by mkfit::CcPool< mkfit::TrackCand >::CcPool().

96  {
97  if (size > m_mem.size())
98  m_mem.resize(size);
99  m_pos = 0;
100  m_size = size;
101  }
size
Write out results.
std::size_t m_pos
std::vector< T > m_mem
std::size_t m_size

Member Data Documentation

◆ m_mem

template<class T>
std::vector<T> mkfit::CcPool< T >::m_mem
private

◆ m_pos

template<class T>
std::size_t mkfit::CcPool< T >::m_pos = 0
private

◆ m_size

template<class T>
std::size_t mkfit::CcPool< T >::m_size = 0
private