| The Gaudi Framework v32r1 (f65d50dc)

ContainedObject.h
Go to the documentation of this file.
1 #ifndef GAUDIKERNEL_CONTAINEDOBJECT_H
2 #define GAUDIKERNEL_CONTAINEDOBJECT_H
3
4 // Include files
5 #include "GaudiKernel/Kernel.h"
6 #include "GaudiKernel/ObjectContainerBase.h"
7 #include "GaudiKernel/StreamBuffer.h"
8 #include <iostream>
9
10 // Forward declarations
11 template <class TYPE>
12 class ObjectVector;
13 template <class TYPE>
14 class ObjectList;
15
16 // Typedefs
17 typedef ObjectVector<ContainedObject> ContainedObjectVector;
18 typedef ObjectList<ContainedObject> ContainedObjectList;
19
20 // Definition of the CLID for this class
21 static const CLID CLID_ContainedObject = 190;
22
31 class GAUDI_API ContainedObject {
32
34 friend class ObjectVector<ContainedObject>;
35 friend class ObjectList<ContainedObject>;
36
37 protected:
39 ContainedObject() = default;
41 ContainedObject( const ContainedObject& ) : ContainedObject() {}
43 virtual ~ContainedObject();
44
45 public:
47 virtual const CLID& clID() const { return classID(); }
48 static const CLID& classID() { return CLID_ContainedObject; }
49
51 const ObjectContainerBase* parent() const { return m_parent; }
53 void setParent( ObjectContainerBase* value ) { m_parent = value; }
54
56 virtual long index() const { return m_parent ? m_parent->index( this ) : -1; }
58 virtual StreamBuffer& serialize( StreamBuffer& s ) const { return s; }
60 virtual StreamBuffer& serialize( StreamBuffer& s ) { return s; }
62 virtual std::ostream& fillStream( std::ostream& s ) const { return s; }
64 friend std::ostream& operator<<( std::ostream& s, const ContainedObject& obj ) { return obj.fillStream( s ); }
65
66 private:
68 ObjectContainerBase* m_parent = nullptr;
69 };
70
71 #endif // GAUDIKERNEL_CONTAINEDOBJECT_H
ContainedObject::serialize
virtual StreamBuffer & serialize(StreamBuffer &s) const
Serialize the object for writing.
Definition: ContainedObject.h:58
Kernel.h
ContainedObjectList
ObjectList< ContainedObject > ContainedObjectList
Definition: ContainedObject.h:18
ContainedObject::serialize
virtual StreamBuffer & serialize(StreamBuffer &s)
Serialize the object for reading.
Definition: ContainedObject.h:60
StreamBuffer
The stream buffer is a small object collecting object data.
Definition: StreamBuffer.h:41
ContainedObjectVector
ObjectVector< ContainedObject > ContainedObjectVector
Definition: ContainedObject.h:14
ContainedObject::operator<<
friend std::ostream & operator<<(std::ostream &s, const ContainedObject &obj)
Output operator (ASCII)
Definition: ContainedObject.h:64
ObjectVector
ObjectVector is one of the basic Gaudi container classes capable of being registered in Data Stores.
Definition: ContainedObject.h:12
ObjectContainerBase.h
ContainedObject::ContainedObject
ContainedObject(const ContainedObject &)
Copy constructor – do NOT copy the parent reference...
Definition: ContainedObject.h:41
ContainedObject::classID
static const CLID & classID()
Definition: ContainedObject.h:48
StreamBuffer.h
ObjectList
ObjectList is one of the basic Gaudi container classes capable of being registered in Data Stores.
Definition: ContainedObject.h:14
CLID
unsigned int CLID
Class ID definition.
Definition: ClassID.h:8
ContainedObject::index
virtual long index() const
Distance in the parent container.
Definition: ContainedObject.h:56
ObjectList::classID
static const CLID & classID()
Definition: ObjectList.h:70
ContainedObject
All classes that their objects may be contained in an LHCb ObjectContainer (e.g.
Definition: ContainedObject.h:31
ContainedObject::fillStream
virtual std::ostream & fillStream(std::ostream &s) const
Fill the output stream (ASCII)
Definition: ContainedObject.h:62
ContainedObject::clID
virtual const CLID & clID() const
Retrieve pointer to class identifier.
Definition: ContainedObject.h:47
ContainedObject::setParent
void setParent(ObjectContainerBase *value)
Update parent member.
Definition: ContainedObject.h:53
gaudirun.s
string s
Definition: gaudirun.py:316
ContainedObject::parent
const ObjectContainerBase * parent() const
Access to parent object.
Definition: ContainedObject.h:51
ObjectContainerBase
ObjectContainerBase is the base class for Gaudi container classes.
Definition: ObjectContainerBase.h:19
GAUDI_API
#define GAUDI_API
Definition: Kernel.h:71
std::ostream
STL class.