| # Gaudi Framework, version v21r6 |

Home |  | Generated: 11 Nov 2009

# ContainedObject.h

Go to the documentation of this file.

    00001 // $Header: /tmp/svngaudi/tmp.jEpFh25751/Gaudi/GaudiKernel/GaudiKernel/ContainedObject.h,v 1.7 2004/01/19 16:56:44 mato Exp $
    00002 #ifndef GAUDIKERNEL_CONTAINEDOBJECT_H
    00003 #define GAUDIKERNEL_CONTAINEDOBJECT_H
    00004
    00005 // Include files
    00006 #include "GaudiKernel/Kernel.h"
    00007 #include "GaudiKernel/StreamBuffer.h"
    00008 #include "GaudiKernel/ObjectContainerBase.h"
    00009 #include <iostream>
    00010
    00011 // Forward declarations
    00012 template <class TYPE> class ObjectVector;
    00013 template <class TYPE> class ObjectList;
    00014
    00015 // Typedefs
    00016 typedef ObjectVector<ContainedObject> ContainedObjectVector;
    00017 typedef ObjectList<ContainedObject> ContainedObjectList;
    00018
    00019 // Definition of the CLID for this class
    00020 static const CLID CLID_ContainedObject = 190;
    00021
    00030 class GAUDI_API ContainedObject {
    00031
    00033   friend class ObjectVector<ContainedObject>;
    00034   friend class ObjectList<ContainedObject>;
    00035
    00036 protected:
    00038   ContainedObject() : m_parent(0)  { }
    00040   ContainedObject(const ContainedObject&) : m_parent(0)  { }
    00042   virtual ~ContainedObject();
    00043
    00044 public:
    00046   virtual const CLID& clID() const { return ContainedObject::classID(); }
    00047   static const CLID& classID()     { return CLID_ContainedObject; }
    00048
    00050   const ObjectContainerBase* parent () const  { return m_parent;        }
    00052   void setParent (ObjectContainerBase* value) { m_parent = value;       }
    00053
    00055   virtual long index() const
    00056   {
    00057     return (m_parent) ? m_parent->index(this) : -1;
    00058   }
    00060   virtual StreamBuffer& serialize( StreamBuffer& s ) const  { return s; }
    00062   virtual StreamBuffer& serialize( StreamBuffer& s )        { return s; }
    00064   virtual std::ostream& fillStream( std::ostream& s ) const { return s; }
    00066   friend std::ostream& operator<< ( std::ostream& s, const ContainedObject& obj ) {
    00067     return obj.fillStream(s);
    00068   }
    00069
    00070 private:
    00072   ObjectContainerBase*   m_parent;
    00073 };
    00074
    00075 #endif  // GAUDIKERNEL_CONTAINEDOBJECT_H