The Gaudi Framework  v30r3 (a5ef0a68)
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"
8 #include <iostream>
9 
10 // Forward declarations
11 template <class TYPE>
13 template <class TYPE>
14 class ObjectList;
15 
16 // Typedefs
19 
20 // Definition of the CLID for this class
21 static const CLID CLID_ContainedObject = 190;
22 
32 {
33 
36  friend class ObjectList<ContainedObject>;
37 
38 protected:
40  ContainedObject() = default;
44  virtual ~ContainedObject();
45 
46 public:
48  virtual const CLID& clID() const { return classID(); }
49  static const CLID& classID() { return CLID_ContainedObject; }
50 
52  const ObjectContainerBase* parent() const { return m_parent; }
54  void setParent( ObjectContainerBase* value ) { m_parent = value; }
55 
57  virtual long index() const { return m_parent ? m_parent->index( this ) : -1; }
59  virtual StreamBuffer& serialize( StreamBuffer& s ) const { return s; }
61  virtual StreamBuffer& serialize( StreamBuffer& s ) { return s; }
63  virtual std::ostream& fillStream( std::ostream& s ) const { return s; }
65  friend std::ostream& operator<<( std::ostream& s, const ContainedObject& obj ) { return obj.fillStream( s ); }
66 
67 private:
69  ObjectContainerBase* m_parent = nullptr;
70 };
71 
72 #endif // GAUDIKERNEL_CONTAINEDOBJECT_H
ObjectList< ContainedObject > ContainedObjectList
virtual StreamBuffer & serialize(StreamBuffer &s)
Serialize the object for reading.
The stream buffer is a small object collecting object data.
Definition: StreamBuffer.h:41
ObjectVector< ContainedObject > ContainedObjectVector
friend std::ostream & operator<<(std::ostream &s, const ContainedObject &obj)
Output operator (ASCII)
ObjectVector is one of the basic Gaudi container classes capable of being registered in Data Stores...
virtual const CLID & clID() const
Retrieve pointer to class identifier.
virtual long index() const
Distance in the parent container.
ContainedObject(const ContainedObject &)
Copy constructor – do NOT copy the parent reference...
virtual StreamBuffer & serialize(StreamBuffer &s) const
Serialize the object for writing.
static const CLID & classID()
const ObjectContainerBase * parent() const
Access to parent object.
ObjectList is one of the basic Gaudi container classes capable of being registered in Data Stores...
unsigned int CLID
Class ID definition.
Definition: ClassID.h:8
static const CLID & classID()
Definition: ObjectList.h:71
All classes that their objects may be contained in an LHCb ObjectContainer (e.g.
void setParent(ObjectContainerBase *value)
Update parent member.
string s
Definition: gaudirun.py:253
ObjectContainerBase is the base class for Gaudi container classes.
virtual std::ostream & fillStream(std::ostream &s) const
Fill the output stream (ASCII)
#define GAUDI_API
Definition: Kernel.h:104
STL class.