#include <GaudiKernel/ObjectList.h>
Inheritance diagram for ObjectList< TYPE >:
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. | |
std::ostream & | operator<< (std::ostream &s, const DataObject &obj) |
Output operator (ASCII). | |
Public Types | |
typedef TYPE | contained_type |
typedef std::list< TYPE * >::value_type | value_type |
typedef std::list< TYPE * >::reference | reference |
typedef std::list< TYPE * >::const_reference | const_reference |
typedef std::list< TYPE * >::iterator | iterator |
typedef std::list< TYPE * >::const_iterator | const_iterator |
typedef std::list< TYPE * >::reverse_iterator | reverse_iterator |
typedef std::list< TYPE * >::const_reverse_iterator | const_reverse_iterator |
typedef std::vector< TYPE * >::pointer | pointer |
typedef std::vector< TYPE * >::const_pointer | const_pointer |
typedef size_t | size_type |
size_type, to conform the STL container interface | |
Public Member Functions | |
ObjectList () | |
Constructors. | |
ObjectList (const char *name) | |
ObjectList (const ObjectList< TYPE > &value) | |
Copy Constructor. | |
virtual | ~ObjectList () |
Destructor. | |
virtual const CLID & | clID () const |
Retrieve pointer to class defininition structure. | |
const ObjectList< TYPE > & | operator= (const ObjectList< TYPE > &right) |
Clone operator. | |
ObjectList< TYPE >::iterator | begin () |
Return an iterator pointing to the beginning of the container. | |
ObjectList< TYPE >::const_iterator | begin () const |
Return a const_iterator pointing to the beginning of the container. | |
ObjectList< TYPE >::iterator | end () |
Return an iterator pointing to the end of the container. | |
ObjectList< TYPE >::const_iterator | end () const |
Return a const_iterator pointing to the end of the container. | |
ObjectList< TYPE >::reverse_iterator | rbegin () |
Return a reverse_iterator pointing to the beginning of the reversed container. | |
ObjectList< TYPE >::const_reverse_iterator | rbegin () const |
Return a const_reverse_iterator pointing to the beginning of the reversed container. | |
ObjectList< TYPE >::reverse_iterator | rend () |
Return a reverse_iterator pointing to the end of the reversed container. | |
ObjectList< TYPE >::const_reverse_iterator | rend () const |
Return a const_reverse_iterator pointing to the end of the reversed container. | |
ObjectList< TYPE >::size_type | size () const |
Return the size of the container Size means the number of objects stored in the container, independently on the amount of information stored in each object. | |
virtual ObjectList< TYPE >::size_type | numberOfObjects () const |
The same as size(), return number of objects in the container. | |
ObjectList< TYPE >::size_type | max_size () const |
Return the largest possible size of the container. | |
bool | empty () const |
Return true if the size of the container is 0. | |
ObjectList< TYPE >::reference | front () |
Return reference to the first element. | |
ObjectList< TYPE >::const_reference | front () const |
Return const_reference to the first element. | |
ObjectList< TYPE >::reference | back () |
Return reference to the last element. | |
ObjectList< TYPE >::const_reference | back () const |
Return const_reference to the last element. | |
void | push_back (typename ObjectList< TYPE >::const_reference value) |
push_back = append = insert a new element at the end of the container | |
virtual long | add (ContainedObject *pObject) |
Add an object to the container. | |
void | pop_back () |
pop_back = remove the last element from the container The removed object will be deleted (see the method release) | |
virtual long | remove (ContainedObject *value) |
Release object from the container (the poiter will be removed from the container, but the object itself will remain alive) (see the method pop_back). | |
ObjectList< TYPE >::iterator | insert (typename ObjectList< TYPE >::iterator position, typename ObjectList< TYPE >::const_reference value) |
Insert "value" before "position". | |
void | erase (typename ObjectList< TYPE >::iterator position) |
Erase the object at "position" from the container. The removed object will be deleted. | |
void | erase (typename ObjectList< TYPE >::iterator first, typename ObjectList< TYPE >::iterator last) |
Erase the range [first, last) from the container. The removed object will be deleted. | |
void | clear () |
Clear the entire content of the container and delete all contained objects. | |
virtual long | index (const ContainedObject *obj) const |
Return distance of a given object from the beginning of its container It correcponds to the "index" ( from 0 to size()-1 ) If "obj" not fount, return -1. | |
virtual ContainedObject * | containedObject (long dist) const |
Return const pointer to an object of a given distance. | |
virtual std::ostream & | fillStream (std::ostream &s) const |
Fill the output stream (ASCII). | |
virtual unsigned long | addRef () |
Add reference to object. | |
virtual unsigned long | release () |
release reference to object | |
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 Attributes | |
std::list< TYPE * > | m_list |
The STL list. |
It is based on Standard Library (STL) std::list (see STL Programmer's Guide) ObjectList has all functions of the std::list interface,
Each object is allowed to belong into a single container only. After inserting the object into the container, it takes over all responsibilities for the object. E.g. erasing the object from its container causes removing the object's pointer from the container and deleting the object itself.
Pere Mato
Definition at line 38 of file ObjectList.h.
typedef TYPE ObjectList< TYPE >::contained_type |
Definition at line 41 of file ObjectList.h.
typedef std::list<TYPE*>::value_type ObjectList< TYPE >::value_type |
Definition at line 42 of file ObjectList.h.
typedef std::list<TYPE*>::reference ObjectList< TYPE >::reference |
Definition at line 44 of file ObjectList.h.
typedef std::list<TYPE*>::const_reference ObjectList< TYPE >::const_reference |
Definition at line 45 of file ObjectList.h.
typedef std::list<TYPE*>::iterator ObjectList< TYPE >::iterator |
Definition at line 47 of file ObjectList.h.
typedef std::list<TYPE*>::const_iterator ObjectList< TYPE >::const_iterator |
Definition at line 48 of file ObjectList.h.
typedef std::list<TYPE*>::reverse_iterator ObjectList< TYPE >::reverse_iterator |
Definition at line 50 of file ObjectList.h.
typedef std::list<TYPE*>::const_reverse_iterator ObjectList< TYPE >::const_reverse_iterator |
Definition at line 51 of file ObjectList.h.
typedef std::vector<TYPE*>::pointer ObjectList< TYPE >::pointer |
Definition at line 57 of file ObjectList.h.
typedef std::vector<TYPE*>::const_pointer ObjectList< TYPE >::const_pointer |
Definition at line 58 of file ObjectList.h.
typedef size_t ObjectContainerBase::size_type [inherited] |
size_type, to conform the STL container interface
Reimplemented in SharedObjectsContainer< TYPE >.
Definition at line 33 of file ObjectContainerBase.h.
ObjectList< TYPE >::ObjectList | ( | ) | [inline] |
ObjectList< TYPE >::ObjectList | ( | const char * | name | ) | [inline] |
ObjectList< TYPE >::ObjectList | ( | const ObjectList< TYPE > & | value | ) | [inline] |
virtual ObjectList< TYPE >::~ObjectList | ( | ) | [inline, virtual] |
virtual const CLID& ObjectList< TYPE >::clID | ( | ) | const [inline, virtual] |
Retrieve pointer to class defininition structure.
Reimplemented from DataObject.
Definition at line 77 of file ObjectList.h.
00077 { 00078 return ObjectList<TYPE>::classID(); 00079 }
static const CLID& ObjectList< TYPE >::classID | ( | ) | [inline, static] |
Retrieve reference to class definition structure (static access).
Reimplemented from DataObject.
Definition at line 80 of file ObjectList.h.
00080 { 00081 static CLID clid = TYPE::classID() + CLID_ObjectList; 00082 return clid; 00083 }
const ObjectList<TYPE>& ObjectList< TYPE >::operator= | ( | const ObjectList< TYPE > & | right | ) | [inline] |
Clone operator.
Definition at line 86 of file ObjectList.h.
00086 { 00087 this->processingVersion = right.m_processingVersion; 00088 this->detectorDataObject = right.m_detectorDataObject; 00089 m_list = right.m_list; 00090 return *this; 00091 }
ObjectList<TYPE>::iterator ObjectList< TYPE >::begin | ( | ) | [inline] |
Return an iterator pointing to the beginning of the container.
Definition at line 94 of file ObjectList.h.
00094 { 00095 return m_list.begin(); 00096 }
ObjectList<TYPE>::const_iterator ObjectList< TYPE >::begin | ( | ) | const [inline] |
Return a const_iterator pointing to the beginning of the container.
Definition at line 99 of file ObjectList.h.
00099 { 00100 return m_list.begin(); 00101 }
ObjectList<TYPE>::iterator ObjectList< TYPE >::end | ( | ) | [inline] |
Return an iterator pointing to the end of the container.
Definition at line 104 of file ObjectList.h.
00104 { 00105 return m_list.end(); 00106 }
ObjectList<TYPE>::const_iterator ObjectList< TYPE >::end | ( | ) | const [inline] |
Return a const_iterator pointing to the end of the container.
Definition at line 109 of file ObjectList.h.
00109 { 00110 return m_list.end(); 00111 }
ObjectList<TYPE>::reverse_iterator ObjectList< TYPE >::rbegin | ( | ) | [inline] |
Return a reverse_iterator pointing to the beginning of the reversed container.
Definition at line 115 of file ObjectList.h.
00115 { 00116 return m_list.rbegin(); 00117 }
ObjectList<TYPE>::const_reverse_iterator ObjectList< TYPE >::rbegin | ( | ) | const [inline] |
Return a const_reverse_iterator pointing to the beginning of the reversed container.
Definition at line 120 of file ObjectList.h.
00120 { 00121 return m_list.rbegin(); 00122 }
ObjectList<TYPE>::reverse_iterator ObjectList< TYPE >::rend | ( | ) | [inline] |
Return a reverse_iterator pointing to the end of the reversed container.
Definition at line 125 of file ObjectList.h.
00125 { 00126 return m_list.rend(); 00127 }
ObjectList<TYPE>::const_reverse_iterator ObjectList< TYPE >::rend | ( | ) | const [inline] |
Return a const_reverse_iterator pointing to the end of the reversed container.
Definition at line 130 of file ObjectList.h.
00130 { 00131 return m_list.rend(); 00132 }
ObjectList<TYPE>::size_type ObjectList< TYPE >::size | ( | ) | const [inline] |
Return the size of the container Size means the number of objects stored in the container, independently on the amount of information stored in each object.
Definition at line 136 of file ObjectList.h.
00136 { 00137 return m_list.size(); 00138 }
virtual ObjectList<TYPE>::size_type ObjectList< TYPE >::numberOfObjects | ( | ) | const [inline, virtual] |
The same as size(), return number of objects in the container.
Implements ObjectContainerBase.
Definition at line 140 of file ObjectList.h.
00140 { 00141 return m_list.size(); 00142 }
ObjectList<TYPE>::size_type ObjectList< TYPE >::max_size | ( | ) | const [inline] |
Return the largest possible size of the container.
Definition at line 145 of file ObjectList.h.
00145 { 00146 return m_list.max_size(); 00147 }
bool ObjectList< TYPE >::empty | ( | ) | const [inline] |
Return true if the size of the container is 0.
Definition at line 150 of file ObjectList.h.
00150 { 00151 return m_list.empty(); 00152 }
ObjectList<TYPE>::reference ObjectList< TYPE >::front | ( | ) | [inline] |
Return reference to the first element.
Definition at line 155 of file ObjectList.h.
00155 { 00156 return m_list.front(); 00157 }
ObjectList<TYPE>::const_reference ObjectList< TYPE >::front | ( | ) | const [inline] |
Return const_reference to the first element.
Definition at line 160 of file ObjectList.h.
00160 { 00161 return m_list.front(); 00162 }
ObjectList<TYPE>::reference ObjectList< TYPE >::back | ( | ) | [inline] |
Return reference to the last element.
Definition at line 165 of file ObjectList.h.
00165 { 00166 return m_list.back(); 00167 }
ObjectList<TYPE>::const_reference ObjectList< TYPE >::back | ( | ) | const [inline] |
Return const_reference to the last element.
Definition at line 170 of file ObjectList.h.
00170 { 00171 return m_list.back(); 00172 }
void ObjectList< TYPE >::push_back | ( | typename ObjectList< TYPE >::const_reference | value | ) | [inline] |
push_back = append = insert a new element at the end of the container
Definition at line 175 of file ObjectList.h.
00175 { 00176 if( 0 != value->parent() ) { 00177 const_cast<ObjectContainerBase*>(value->parent())->remove(value); 00178 } 00179 value->setParent(this); 00180 m_list.push_back(value); 00181 }
virtual long ObjectList< TYPE >::add | ( | ContainedObject * | pObject | ) | [inline, virtual] |
Add an object to the container.
Implements ObjectContainerBase.
Definition at line 184 of file ObjectList.h.
00184 { 00185 try { 00186 typename ObjectList<TYPE>::value_type ptr = 00187 dynamic_cast<typename ObjectList<TYPE>::value_type>(pObject); 00188 if ( 0 != ptr ) { 00189 push_back(ptr); 00190 return m_list.size()-1; 00191 } 00192 } 00193 catch(...) { 00194 } 00195 return -1; 00196 }
void ObjectList< TYPE >::pop_back | ( | ) | [inline] |
pop_back = remove the last element from the container The removed object will be deleted (see the method release)
Definition at line 200 of file ObjectList.h.
00200 { 00201 typename ObjectList<TYPE>::value_type position = m_list.back(); 00202 // Set the back pointer to 0 to avoid repetitional searching 00203 // for the object in the container, and deleting the object 00204 position->setParent (0); 00205 delete position; 00206 // Removing from the container itself 00207 m_list.pop_back(); 00208 }
virtual long ObjectList< TYPE >::remove | ( | ContainedObject * | value | ) | [inline, virtual] |
Release object from the container (the poiter will be removed from the container, but the object itself will remain alive) (see the method pop_back).
Implements ObjectContainerBase.
Definition at line 212 of file ObjectList.h.
00212 { 00213 // Find the object of value value 00214 long idx = 0; 00215 typename ObjectList<TYPE>::iterator iter; 00216 for( iter = begin(); iter != end(); iter++, idx++ ) { 00217 if( value == *iter ) { 00218 break; 00219 } 00220 } 00221 if( end() == iter ) { 00222 // Object cannot be released from the conatiner, 00223 // as it is not contained in it 00224 return -1; 00225 } 00226 else { 00227 // Set the back pointer to 0 to avoid repetitional searching 00228 // for the object in the container and deleting the object 00229 (*iter)->setParent (0); 00230 erase(iter); 00231 return idx; 00232 } 00233 }
ObjectList<TYPE>::iterator ObjectList< TYPE >::insert | ( | typename ObjectList< TYPE >::iterator | position, | |
typename ObjectList< TYPE >::const_reference | value | |||
) | [inline] |
Insert "value" before "position".
Definition at line 236 of file ObjectList.h.
00237 { 00238 value->setParent(this); 00239 typename ObjectList<TYPE>::iterator i = m_list.insert(position, value); 00240 return i; 00241 }
void ObjectList< TYPE >::erase | ( | typename ObjectList< TYPE >::iterator | position | ) | [inline] |
Erase the object at "position" from the container. The removed object will be deleted.
Definition at line 244 of file ObjectList.h.
00244 { 00245 if( 0 != (*position)->parent() ) { 00246 // Set the back pointer to 0 to avoid repetitional searching 00247 // for the object in the container, and deleting the object 00248 (*position)->setParent (0); 00249 delete *position; 00250 } 00251 // Removing from the container itself 00252 m_list.erase(position); 00253 }
void ObjectList< TYPE >::erase | ( | typename ObjectList< TYPE >::iterator | first, | |
typename ObjectList< TYPE >::iterator | last | |||
) | [inline] |
Erase the range [first, last) from the container. The removed object will be deleted.
Definition at line 256 of file ObjectList.h.
00257 { 00258 for( typename ObjectList<TYPE>::iterator iter = first; iter != last; iter++ ) { 00259 // Set the back pointer to 0 to avoid repetitional searching 00260 // for the object in the container, and deleting the object 00261 (*iter)->setParent (0); 00262 delete *iter; 00263 } 00264 // Removing from the container itself 00265 m_list.erase(first, last); 00266 }
void ObjectList< TYPE >::clear | ( | ) | [inline] |
Clear the entire content of the container and delete all contained objects.
Definition at line 269 of file ObjectList.h.
virtual long ObjectList< TYPE >::index | ( | const ContainedObject * | obj | ) | const [inline, virtual] |
Return distance of a given object from the beginning of its container It correcponds to the "index" ( from 0 to size()-1 ) If "obj" not fount, return -1.
Implements ObjectContainerBase.
Definition at line 275 of file ObjectList.h.
00275 { 00276 long i = 0; 00277 typename ObjectList<TYPE>::const_iterator iter; 00278 for( iter = begin(); iter != end(); iter++ ) { 00279 if( *iter == obj ) { 00280 return i; 00281 } 00282 i++; 00283 } 00284 return -1; 00285 }
virtual ContainedObject* ObjectList< TYPE >::containedObject | ( | long | dist | ) | const [inline, virtual] |
Return const pointer to an object of a given distance.
Implements ObjectContainerBase.
Definition at line 288 of file ObjectList.h.
00288 { 00289 long i = 0; 00290 typename ObjectList<TYPE>::const_iterator iter; 00291 for( iter = begin(); iter != end(); iter++ ) { 00292 if( dist == i ) { 00293 return *iter; 00294 } 00295 i++; 00296 } 00297 return 0; 00298 }
virtual std::ostream& ObjectList< TYPE >::fillStream | ( | std::ostream & | s | ) | const [inline, virtual] |
Fill the output stream (ASCII).
Reimplemented from DataObject.
Definition at line 301 of file ObjectList.h.
00301 { 00302 s << "class ObjectList : size = " 00303 << std::setw(12) 00304 << size() << "\n"; 00305 // Output the base class 00306 //ObjectContainerBase::fillStream(s); 00307 if ( 0 != size() ) { 00308 s << "\nContents of the STL list :"; 00309 long count = 0; 00310 typename ObjectList<TYPE>::const_iterator iter; 00311 for( iter = m_list.begin(); iter != m_list.end(); iter++, count++ ) { 00312 s << "\nIndex " 00313 << std::setw(12) 00314 << count 00315 << " of object of type "<< **iter; 00316 } 00317 } 00318 return s; 00319 }
virtual unsigned long DataObject::addRef | ( | ) | [virtual, inherited] |
Add reference to object.
virtual unsigned long DataObject::release | ( | ) | [virtual, inherited] |
release reference to object
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 }
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 }
std::list<TYPE*> ObjectList< TYPE >::m_list [private] |