Bayeux  3.4.1
Core Foundation library for SuperNEMO
Public Types | Public Member Functions | Protected Attributes | List of all members
datatools::handle_pool< T > Class Template Reference

A pool of handles on a given class. More...

#include <bayeux/datatools/handle_pool.h>

Public Types

typedef T element_type
 
typedef datatools::handle< element_typehandle_type
 

Public Member Functions

 handle_pool ()
 Construct an empty pool. More...
 
 handle_pool (size_t size_)
 Construct a pool with a default size. More...
 
virtual ~handle_pool ()
 Destructor. More...
 
void clear ()
 Empty the pool. More...
 
size_t get_capacity () const
 Return the number of handles the pool can contain. More...
 
size_t get_number_of_used_item () const
 Return the number of handles currently in use. More...
 
void reset ()
 Set the number of used handles in the pool to zero. More...
 
void resize (size_t size_)
 Change number of handles pool can contain. More...
 
const handle_typecreate ()
 Return a const reference to a new handle. More...
 
void dump (std::ostream &out_=std::clog, const std::string &title_="", const std::string &indent_="", bool abridged_=true) const
 Input pool capacity and used handles to an output stream. More...
 
void resize_impl (size_t size_)
 Implementation for public resize method. More...
 

Protected Attributes

std::vector< handle_type_buffer_
 
size_t _number_of_used_item_
 

Detailed Description

template<class T>
class datatools::handle_pool< T >

A pool of handles on a given class.

Member Typedef Documentation

◆ element_type

template<class T >
typedef T datatools::handle_pool< T >::element_type

◆ handle_type

Constructor & Destructor Documentation

◆ handle_pool() [1/2]

template<typename T >
datatools::handle_pool< T >::handle_pool ( )

Construct an empty pool.

◆ handle_pool() [2/2]

template<typename T >
datatools::handle_pool< T >::handle_pool ( size_t  size_)
explicit

Construct a pool with a default size.

◆ ~handle_pool()

template<typename T >
datatools::handle_pool< T >::~handle_pool ( )
virtual

Destructor.

Member Function Documentation

◆ clear()

template<typename T >
void datatools::handle_pool< T >::clear ( )

Empty the pool.

◆ create()

template<typename T >
const handle_pool< T >::handle_type & datatools::handle_pool< T >::create ( )

Return a const reference to a new handle.

◆ dump()

template<typename T >
void datatools::handle_pool< T >::dump ( std::ostream &  out_ = std::clog,
const std::string &  title_ = "",
const std::string &  indent_ = "",
bool  abridged_ = true 
) const

Input pool capacity and used handles to an output stream.

◆ get_capacity()

template<typename T >
size_t datatools::handle_pool< T >::get_capacity ( ) const

Return the number of handles the pool can contain.

◆ get_number_of_used_item()

template<typename T >
size_t datatools::handle_pool< T >::get_number_of_used_item ( ) const

Return the number of handles currently in use.

◆ reset()

template<typename T >
void datatools::handle_pool< T >::reset ( )

Set the number of used handles in the pool to zero.

◆ resize()

template<typename T >
void datatools::handle_pool< T >::resize ( size_t  size_)

Change number of handles pool can contain.

◆ resize_impl()

template<typename T >
void datatools::handle_pool< T >::resize_impl ( size_t  size_)

Implementation for public resize method.

Member Data Documentation

◆ _buffer_

template<class T >
std::vector<handle_type> datatools::handle_pool< T >::_buffer_
protected

◆ _number_of_used_item_

template<class T >
size_t datatools::handle_pool< T >::_number_of_used_item_
protected

The documentation for this class was generated from the following file: