File indexing completed on 2025-07-05 08:54:30
0001
0002
0003
0004
0005
0006
0007
0008
0009
0010
0011 #ifndef GAUDIKERNEL_CONTAINEDOBJECT_H
0012 #define GAUDIKERNEL_CONTAINEDOBJECT_H
0013
0014
0015 #include <GaudiKernel/Kernel.h>
0016 #include <GaudiKernel/ObjectContainerBase.h>
0017 #include <GaudiKernel/StreamBuffer.h>
0018 #include <iostream>
0019
0020
0021 template <class TYPE>
0022 class ObjectVector;
0023 template <class TYPE>
0024 class ObjectList;
0025
0026
0027 typedef ObjectVector<ContainedObject> ContainedObjectVector;
0028 typedef ObjectList<ContainedObject> ContainedObjectList;
0029
0030
0031 static const CLID CLID_ContainedObject = 190;
0032
0033
0034
0035
0036
0037
0038
0039
0040
0041 class GAUDI_API ContainedObject {
0042
0043
0044 friend class ObjectVector<ContainedObject>;
0045 friend class ObjectList<ContainedObject>;
0046
0047 protected:
0048
0049 ContainedObject() = default;
0050
0051 ContainedObject( const ContainedObject& ) : ContainedObject() {}
0052
0053 ContainedObject& operator=( const ContainedObject& ) { return *this; }
0054
0055 virtual ~ContainedObject();
0056
0057 public:
0058
0059 virtual const CLID& clID() const { return classID(); }
0060 static const CLID& classID() { return CLID_ContainedObject; }
0061
0062
0063 const ObjectContainerBase* parent() const { return m_parent; }
0064
0065 void setParent( ObjectContainerBase* value ) { m_parent = value; }
0066
0067
0068 virtual long index() const { return m_parent ? m_parent->index( this ) : -1; }
0069
0070 virtual StreamBuffer& serialize( StreamBuffer& s ) const { return s; }
0071
0072 virtual StreamBuffer& serialize( StreamBuffer& s ) { return s; }
0073
0074 virtual std::ostream& fillStream( std::ostream& s ) const { return s; }
0075
0076 friend std::ostream& operator<<( std::ostream& s, const ContainedObject& obj ) { return obj.fillStream( s ); }
0077
0078 private:
0079
0080 ObjectContainerBase* m_parent = nullptr;
0081 };
0082
0083 #endif