File indexing completed on 2025-01-30 10:07:11
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 ContainedObject& operator=( const ContainedObject& ) { return *this; }
0053
0054 virtual ~ContainedObject();
0055
0056 public:
0057
0058 virtual const CLID& clID() const { return classID(); }
0059 static const CLID& classID() { return CLID_ContainedObject; }
0060
0061
0062 const ObjectContainerBase* parent() const { return m_parent; }
0063
0064 void setParent( ObjectContainerBase* value ) { m_parent = value; }
0065
0066
0067 virtual long index() const { return m_parent ? m_parent->index( this ) : -1; }
0068
0069 virtual StreamBuffer& serialize( StreamBuffer& s ) const { return s; }
0070
0071 virtual StreamBuffer& serialize( StreamBuffer& s ) { return s; }
0072
0073 virtual std::ostream& fillStream( std::ostream& s ) const { return s; }
0074
0075 friend std::ostream& operator<<( std::ostream& s, const ContainedObject& obj ) { return obj.fillStream( s ); }
0076
0077 private:
0078
0079 ObjectContainerBase* m_parent = nullptr;
0080 };
0081
0082 #endif