ContainedObject.h
Go to the documentation of this file.
1 // $Header: /tmp/svngaudi/tmp.jEpFh25751/Gaudi/GaudiKernel/GaudiKernel/ContainedObject.h,v 1.7 2004/01/19 16:56:44 mato Exp $
2 #ifndef GAUDIKERNEL_CONTAINEDOBJECT_H
3 #define GAUDIKERNEL_CONTAINEDOBJECT_H
4 
5 // Include files
6 #include "GaudiKernel/Kernel.h"
7 #include "GaudiKernel/StreamBuffer.h"
8 #include "GaudiKernel/ObjectContainerBase.h"
9 #include <iostream>
10 
11 // Forward declarations
12 template <class TYPE> class ObjectVector;
13 template <class TYPE> class ObjectList;
14 
15 // Typedefs
18 
19 // Definition of the CLID for this class
20 static const CLID CLID_ContainedObject = 190;
21 
31 
33  friend class ObjectVector<ContainedObject>;
34  friend class ObjectList<ContainedObject>;
35 
36 protected:
38  ContainedObject() : m_parent(0) { }
40  ContainedObject(const ContainedObject&) : m_parent(0) { }
42  virtual ~ContainedObject();
43 
44 public:
46  virtual const CLID& clID() const { return classID(); }
47  static const CLID& classID() { return CLID_ContainedObject; }
48 
50  const ObjectContainerBase* parent () const { return m_parent; }
52  void setParent (ObjectContainerBase* value) { m_parent = value; }
53 
55  virtual long index() const
56  {
57  return (m_parent) ? m_parent->index(this) : -1;
58  }
60  virtual StreamBuffer& serialize( StreamBuffer& s ) const { return s; }
62  virtual StreamBuffer& serialize( StreamBuffer& s ) { return s; }
64  virtual std::ostream& fillStream( std::ostream& s ) const { return s; }
66  friend std::ostream& operator<< ( std::ostream& s, const ContainedObject& obj ) {
67  return obj.fillStream(s);
68  }
69 
70 private:
72  ObjectContainerBase* m_parent;
73 };
74 
75 #endif // GAUDIKERNEL_CONTAINEDOBJECT_H
ObjectVector< ContainedObject > ContainedObjectVector
std::ostream & operator<<(std::ostream &str, const GaudiAlg::ID &id)
Operator overloading for ostream.
Definition: GaudiHistoID.h:136
virtual std::ostream & fillStream(std::ostream &s) const
Fill the output stream (ASCII)
Definition: ObjectList.h:291
#define GAUDI_API
Definition: Kernel.h:108
The stream buffer is a small object collecting object data.
Definition: StreamBuffer.h:40
ObjectVector is one of the basic Gaudi container classes capable of being registered in Data Stores...
ObjectList is one of the basic Gaudi container classes capable of being registered in Data Stores...
virtual long index(const ContainedObject *obj) const
Return distance of a given object from the beginning of its container It corresponds to the "index" (...
Definition: ObjectList.h:265
virtual const CLID & clID() const
Retrieve pointer to class definition structure.
Definition: ObjectList.h:75
unsigned int CLID
Class ID definition.
Definition: ClassID.h:9
static const CLID & classID()
Definition: ObjectList.h:78
All classes that their objects may be contained in an LHCb ObjectContainer (e.g.
string s
Definition: gaudirun.py:244
ObjectList< ContainedObject > ContainedObjectList
ObjectContainerBase is the base class for Gaudi container classes.
virtual std::ostream & fillStream(std::ostream &s) const
Fill the output stream (ASCII)