#include <GaudiKernel/TransientFastContainer.h>
Inheritance diagram for TransientFastContainer< T, CLEANER >:
inline code of class DataObject | |
void | setRegistry (IRegistry *pRegistry) |
Set pointer to Registry. | |
IRegistry * | registry () const |
Get pointer to Registry. | |
LinkManager * | linkMgr () const |
Retrieve Link manager. | |
unsigned char | version () const |
Retrieve version number of this object representation. | |
void | setVersion (unsigned char vsn) |
Set version number of this object representation. | |
unsigned long | refCount () const |
Return the refcount. | |
virtual std::ostream & | fillStream (std::ostream &s) const |
Fill the output stream (ASCII). | |
std::ostream & | operator<< (std::ostream &s, const DataObject &obj) |
Output operator (ASCII). | |
Public Types | |
typedef T | contained_type |
typedef contained_type * | value_type |
typedef value_type | pointer |
typedef const value_type | const_pointer |
typedef value_type | reference |
typedef const value_type | const_reference |
typedef std::vector< value_type > | storage_type |
typedef storage_type::size_type | size_type |
typedef storage_type::iterator | iterator |
typedef storage_type::const_iterator | const_iterator |
typedef CLEANER | cleaner_type |
Public Member Functions | |
TransientFastContainer (size_type n=0) | |
Standard constructor. If the agument n is not zero, n objects are instantiated. | |
virtual | ~TransientFastContainer () |
Delete all the recorded objects. | |
virtual void | clear () |
Set the internal conter to 0 without actually deleting the objects. | |
virtual void | free () |
Delete all the contained objects to free memory. | |
virtual const std::type_info & | containedType () const |
Return type information on the contained objetcs. | |
pointer | New () |
Add a new object to the container or reuse one of the already available objects (after cleaning), and return a pointer to it. | |
pointer | Add (const T &rhs) |
Add a new object to the container or reuse one of the already available objects (after cleaning), and return a pointer to it. | |
pointer | NewPointer () |
Get a pointer to a non-initialized chunk of memory either destructing an already existing object or creating a new one and destructing it. | |
iterator | begin () |
Iterator pointing to the first object of the container. | |
const_iterator | begin () const |
Const iterator pointing to the first object of the container. | |
iterator | end () |
Iterator pointing after the last used object in the container. | |
const_iterator | end () const |
Const iterator pointing after the last used object in the container. | |
size_type | size () const |
Returns the number of used objects in the container. | |
pointer | operator[] (size_type index) |
Accessor to the object at the given index. Throws std::out_of_range if index is greater than size(). | |
const contained_type * | operator[] (size_type index) const |
Const accessor to the object at the given index. Throws std::out_of_range if index is greater than size(). | |
pointer | at (size_type index) |
Same as operator[](). | |
const contained_type * | at (size_type index) const |
Same as operator[]() const. | |
virtual unsigned long | addRef () |
Add reference to object. | |
virtual unsigned long | release () |
release reference to object | |
virtual const CLID & | clID () const |
Retrieve reference to class definition structure. | |
const std::string & | name () const |
Retreive DataObject name. It is the name when registered in the store. | |
virtual StreamBuffer & | serialize (StreamBuffer &s) |
Serialization mechanism: Serialize the object for reading. | |
virtual StreamBuffer & | serialize (StreamBuffer &s) const |
Serialization mechanism: Serialize the object for writing. | |
Static Public Member Functions | |
static const CLID & | classID () |
Retrieve reference to class definition structure (static access). | |
Private Member Functions | |
pointer | i_new () |
Implementation function that instantiate a new object. | |
pointer | i_new (const T &rhs) |
Implementation function that instantiate a new object using the copy constructor. | |
Private Attributes | |
size_type | m_counter |
Internal counter. | |
size_type | m_current_size |
Number of already allocated objects. | |
storage_type | m_storage |
Repository of allocated objects. | |
iterator | m_end |
Iterator that is returned by end(). | |
cleaner_type | m_cleaner |
Instance of the class that cleans new objects. |
New objects ar added to the container using the member function New(). Those are not deleted until destruction of the container. When the method clear() is called, the internal of the container is set to 0 and it behaves as if it is, but it still has memory of all the created object. When the New() is invoked on a "cleared" container, it returns the pointer of the first non-used of the known objects after calling an instance of CLEANER on it, or a new object if all the know objects are already in use.
Definition at line 83 of file TransientFastContainer.h.
typedef T TransientFastContainer< T, CLEANER >::contained_type |
Definition at line 86 of file TransientFastContainer.h.
typedef contained_type* TransientFastContainer< T, CLEANER >::value_type |
Definition at line 87 of file TransientFastContainer.h.
typedef value_type TransientFastContainer< T, CLEANER >::pointer |
Definition at line 89 of file TransientFastContainer.h.
typedef const value_type TransientFastContainer< T, CLEANER >::const_pointer |
Definition at line 90 of file TransientFastContainer.h.
typedef value_type TransientFastContainer< T, CLEANER >::reference |
Definition at line 92 of file TransientFastContainer.h.
typedef const value_type TransientFastContainer< T, CLEANER >::const_reference |
Definition at line 93 of file TransientFastContainer.h.
typedef std::vector<value_type> TransientFastContainer< T, CLEANER >::storage_type |
Definition at line 95 of file TransientFastContainer.h.
typedef storage_type::size_type TransientFastContainer< T, CLEANER >::size_type |
Definition at line 97 of file TransientFastContainer.h.
typedef storage_type::iterator TransientFastContainer< T, CLEANER >::iterator |
Definition at line 99 of file TransientFastContainer.h.
typedef storage_type::const_iterator TransientFastContainer< T, CLEANER >::const_iterator |
Definition at line 100 of file TransientFastContainer.h.
typedef CLEANER TransientFastContainer< T, CLEANER >::cleaner_type |
Definition at line 102 of file TransientFastContainer.h.
TransientFastContainer< T, CLEANER >::TransientFastContainer | ( | size_type | n = 0 |
) |
Standard constructor. If the agument n is not zero, n objects are instantiated.
Definition at line 186 of file TransientFastContainer.h.
00186 : 00187 TransientFastContainerBase(), 00188 m_counter(0), 00189 m_current_size(0), 00190 m_storage(), 00191 m_end(m_storage.begin()), 00192 m_cleaner() 00193 { 00194 if (n>0) { 00195 m_storage.reserve(n); 00196 for(;n>0;--n) New(); 00197 clear(); 00198 } 00199 }
TransientFastContainer< T, CLEANER >::~TransientFastContainer | ( | ) | [virtual] |
Delete all the recorded objects.
Definition at line 202 of file TransientFastContainer.h.
00203 { 00204 free(); 00205 }
void TransientFastContainer< T, CLEANER >::clear | ( | ) | [virtual] |
Set the internal conter to 0 without actually deleting the objects.
Implements TransientFastContainerBase.
Definition at line 209 of file TransientFastContainer.h.
void TransientFastContainer< T, CLEANER >::free | ( | ) | [virtual] |
Delete all the contained objects to free memory.
Implements TransientFastContainerBase.
Definition at line 215 of file TransientFastContainer.h.
00215 { 00216 for( typename storage_type::iterator i = m_storage.begin(); 00217 i != m_storage.end(); 00218 ++i ) { 00219 delete *i; 00220 } 00221 m_storage.clear(); 00222 m_counter = m_current_size = 0; 00223 m_end = m_storage.begin(); 00224 }
virtual const std::type_info& TransientFastContainer< T, CLEANER >::containedType | ( | ) | const [inline, virtual] |
Return type information on the contained objetcs.
Implements TransientFastContainerBase.
Definition at line 119 of file TransientFastContainer.h.
00119 { return typeid(contained_type); }
pointer TransientFastContainer< T, CLEANER >::New | ( | ) | [inline] |
Add a new object to the container or reuse one of the already available objects (after cleaning), and return a pointer to it.
Definition at line 125 of file TransientFastContainer.h.
00125 { return ( m_counter++ < m_current_size ) ? m_cleaner(*(m_end++)) : i_new(); }
pointer TransientFastContainer< T, CLEANER >::Add | ( | const T & | rhs | ) | [inline] |
Add a new object to the container or reuse one of the already available objects (after cleaning), and return a pointer to it.
Definition at line 129 of file TransientFastContainer.h.
00129 { return ( m_counter++ < m_current_size ) ? m_cleaner(*(m_end++),rhs) : i_new(rhs); }
pointer TransientFastContainer< T, CLEANER >::NewPointer | ( | ) | [inline] |
Get a pointer to a non-initialized chunk of memory either destructing an already existing object or creating a new one and destructing it.
Definition at line 133 of file TransientFastContainer.h.
00134 { return ( m_counter++ < m_current_size ) ? m_cleaner.destruct(*(m_end++)) : m_cleaner.destruct(i_new()); }
iterator TransientFastContainer< T, CLEANER >::begin | ( | ) | [inline] |
Iterator pointing to the first object of the container.
Definition at line 137 of file TransientFastContainer.h.
00137 { return m_storage.begin(); }
const_iterator TransientFastContainer< T, CLEANER >::begin | ( | ) | const [inline] |
Const iterator pointing to the first object of the container.
Definition at line 139 of file TransientFastContainer.h.
00139 { return m_storage.begin(); }
iterator TransientFastContainer< T, CLEANER >::end | ( | ) | [inline] |
Iterator pointing after the last used object in the container.
Definition at line 142 of file TransientFastContainer.h.
00142 { return m_end; }
const_iterator TransientFastContainer< T, CLEANER >::end | ( | ) | const [inline] |
Const iterator pointing after the last used object in the container.
Definition at line 144 of file TransientFastContainer.h.
00144 { return m_end; }
size_type TransientFastContainer< T, CLEANER >::size | ( | ) | const [inline] |
Returns the number of used objects in the container.
Definition at line 147 of file TransientFastContainer.h.
00147 { return m_counter; }
pointer TransientFastContainer< T, CLEANER >::operator[] | ( | size_type | index | ) | [inline] |
const contained_type* TransientFastContainer< T, CLEANER >::operator[] | ( | size_type | index | ) | const [inline] |
Const accessor to the object at the given index. Throws std::out_of_range if index is greater than size().
Definition at line 153 of file TransientFastContainer.h.
00154 { return (index < size()) ? m_storage[index] : throw std::out_of_range("index out of range"), (const_pointer)NULL; }
pointer TransientFastContainer< T, CLEANER >::at | ( | size_type | index | ) | [inline] |
Same as operator[]().
Definition at line 157 of file TransientFastContainer.h.
00157 { return operator[] (index); }
const contained_type* TransientFastContainer< T, CLEANER >::at | ( | size_type | index | ) | const [inline] |
Same as operator[]() const.
Definition at line 159 of file TransientFastContainer.h.
00159 { return operator[] (index); }
TransientFastContainer< T, CLEANER >::pointer TransientFastContainer< T, CLEANER >::i_new | ( | ) | [private] |
Implementation function that instantiate a new object.
Definition at line 227 of file TransientFastContainer.h.
00227 { 00228 //++m_counter; // already incremented in New() 00229 ++m_current_size; 00230 pointer ptr = new T(); 00231 m_storage.push_back(ptr); 00232 m_end = m_storage.end(); 00233 return ptr; 00234 }
TransientFastContainer< T, CLEANER >::pointer TransientFastContainer< T, CLEANER >::i_new | ( | const T & | rhs | ) | [private] |
Implementation function that instantiate a new object using the copy constructor.
Definition at line 237 of file TransientFastContainer.h.
00237 { 00238 //++m_counter; // already incremented in New() 00239 ++m_current_size; 00240 pointer ptr = new T(rhs); 00241 m_storage.push_back(ptr); 00242 m_end = m_storage.end(); 00243 return ptr; 00244 }
virtual unsigned long DataObject::addRef | ( | ) | [virtual, inherited] |
Add reference to object.
virtual unsigned long DataObject::release | ( | ) | [virtual, inherited] |
release reference to object
virtual const CLID& DataObject::clID | ( | ) | const [virtual, inherited] |
Retrieve reference to class definition structure.
Reimplemented in AlgorithmHistory, AlgToolHistory, DataHistory, HistoryObj, JobHistory, KeyedContainer< DATATYPE, MAPPING >, NTuple::Directory, NTuple::File, NTuple::ColumnWiseTuple, NTuple::RowWiseTuple, ObjectList< TYPE >, ObjectVector< TYPE >, RefTable1to1< FROM, TO >, RefTable1toN< FROM, TO >, ServiceHistory, and SharedObjectsContainer< TYPE >.
static const CLID& DataObject::classID | ( | ) | [static, inherited] |
Retrieve reference to class definition structure (static access).
Reimplemented in AlgorithmHistory, AlgToolHistory, DataHistory, HistoryObj, JobHistory, KeyedContainer< DATATYPE, MAPPING >, NTuple::Directory, NTuple::File, NTuple::ColumnWiseTuple, NTuple::RowWiseTuple, ObjectList< TYPE >, ObjectVector< TYPE >, ServiceHistory, and SharedObjectsContainer< TYPE >.
const std::string& DataObject::name | ( | ) | const [inherited] |
Retreive DataObject name. It is the name when registered in the store.
Reimplemented in NTuple::File, and ServiceHistory.
virtual StreamBuffer& DataObject::serialize | ( | StreamBuffer & | s | ) | [virtual, inherited] |
Serialization mechanism: Serialize the object for reading.
Reimplemented in RefTableBase< FROM, MAPENTRY >, RefTableBase< FROM, SmartRefVector< TO > >, and RefTableBase< FROM, SmartRef< TO > >.
virtual StreamBuffer& DataObject::serialize | ( | StreamBuffer & | s | ) | const [virtual, inherited] |
Serialization mechanism: Serialize the object for writing.
Reimplemented in RefTableBase< FROM, MAPENTRY >, RefTableBase< FROM, SmartRefVector< TO > >, and RefTableBase< FROM, SmartRef< TO > >.
void DataObject::setRegistry | ( | IRegistry * | pRegistry | ) | [inline, inherited] |
Set pointer to Registry.
Definition at line 67 of file DataObject.h.
00067 { 00068 m_pRegistry = pRegistry; 00069 }
IRegistry* DataObject::registry | ( | ) | const [inline, inherited] |
Get pointer to Registry.
Definition at line 71 of file DataObject.h.
00071 { 00072 return m_pRegistry; 00073 }
LinkManager* DataObject::linkMgr | ( | ) | const [inline, inherited] |
Retrieve Link manager.
Definition at line 75 of file DataObject.h.
00075 { 00076 return m_pLinkMgr; 00077 }
unsigned char DataObject::version | ( | ) | const [inline, inherited] |
Retrieve version number of this object representation.
Definition at line 79 of file DataObject.h.
00079 { 00080 return m_version; 00081 }
void DataObject::setVersion | ( | unsigned char | vsn | ) | [inline, inherited] |
Set version number of this object representation.
Definition at line 83 of file DataObject.h.
00083 { 00084 m_version = vsn; 00085 }
unsigned long DataObject::refCount | ( | ) | const [inline, inherited] |
Return the refcount.
Definition at line 87 of file DataObject.h.
00087 { 00088 return m_refCount; 00089 }
virtual std::ostream& DataObject::fillStream | ( | std::ostream & | s | ) | const [inline, virtual, inherited] |
Fill the output stream (ASCII).
Reimplemented in ObjectList< TYPE >, and ObjectVector< TYPE >.
Definition at line 91 of file DataObject.h.
std::ostream& operator<< | ( | std::ostream & | s, | |
const DataObject & | obj | |||
) | [friend, inherited] |
Output operator (ASCII).
Definition at line 96 of file DataObject.h.
00096 { 00097 return obj.fillStream(s); 00098 }
size_type TransientFastContainer< T, CLEANER >::m_counter [private] |
size_type TransientFastContainer< T, CLEANER >::m_current_size [private] |
storage_type TransientFastContainer< T, CLEANER >::m_storage [private] |
iterator TransientFastContainer< T, CLEANER >::m_end [private] |
cleaner_type TransientFastContainer< T, CLEANER >::m_cleaner [private] |
Instance of the class that cleans new objects.
Definition at line 182 of file TransientFastContainer.h.