The Gaudi Framework  master (ff829712)
Loading...
Searching...
No Matches
ContainedObject Class Reference

All classes that their objects may be contained in an LHCb ObjectContainer (e.g. More...

#include <GaudiKernel/ContainedObject.h>

Inheritance diagram for ContainedObject:
Collaboration diagram for ContainedObject:

Public Member Functions

virtual const CLIDclID () const
 Retrieve pointer to class identifier.
 
const ObjectContainerBaseparent () const
 Access to parent object.
 
void setParent (ObjectContainerBase *value)
 Update parent member.
 
virtual long index () const
 Distance in the parent container.
 
virtual StreamBufferserialize (StreamBuffer &s) const
 Serialize the object for writing.
 
virtual StreamBufferserialize (StreamBuffer &s)
 Serialize the object for reading.
 
virtual std::ostream & fillStream (std::ostream &s) const
 Fill the output stream (ASCII)
 

Static Public Member Functions

static const CLIDclassID ()
 

Protected Member Functions

 ContainedObject ()=default
 Constructors.
 
 ContainedObject (const ContainedObject &)
 Copy constructor and assignement: do NOT copy the parent reference...
 
ContainedObjectoperator= (const ContainedObject &)
 
virtual ~ContainedObject ()
 Destructor.
 

Private Attributes

ObjectContainerBasem_parent = nullptr
 Pointer to the parent.
 

Friends

class ObjectVector< ContainedObject >
 Allow the container classes access to protected members.
 
class ObjectList< ContainedObject >
 
std::ostream & operator<< (std::ostream &s, const ContainedObject &obj)
 Output operator (ASCII)
 

Detailed Description

All classes that their objects may be contained in an LHCb ObjectContainer (e.g.

ObjectVector, or ObjectList), have to inherit from the class ContainedObject. It guarantees the navigability from the contained object back to its container.

Author
Pavel Binko

Definition at line 37 of file ContainedObject.h.

Constructor & Destructor Documentation

◆ ContainedObject() [1/2]

ContainedObject::ContainedObject ( )
protecteddefault

Constructors.

◆ ContainedObject() [2/2]

ContainedObject::ContainedObject ( const ContainedObject & )
inlineprotected

Copy constructor and assignement: do NOT copy the parent reference...

Definition at line 47 of file ContainedObject.h.

47: ContainedObject() {}
ContainedObject()=default
Constructors.

◆ ~ContainedObject()

ContainedObject::~ContainedObject ( )
protectedvirtual

Destructor.

Definition at line 13 of file ContainedObject.cpp.

13 {
14 // If the object is contained in a container, remove it from there
15 if ( m_parent ) m_parent->remove( this );
16}
ObjectContainerBase * m_parent
Pointer to the parent.

Member Function Documentation

◆ classID()

static const CLID & ContainedObject::classID ( )
inlinestatic

Definition at line 56 of file ContainedObject.h.

56{ return CLID_ContainedObject; }

◆ clID()

virtual const CLID & ContainedObject::clID ( ) const
inlinevirtual

Retrieve pointer to class identifier.

Reimplemented in Gaudi::TestSuite::MyTrack, and Gaudi::TestSuite::MyVertex.

Definition at line 55 of file ContainedObject.h.

55{ return classID(); }
static const CLID & classID()

◆ fillStream()

virtual std::ostream & ContainedObject::fillStream ( std::ostream & s) const
inlinevirtual

Fill the output stream (ASCII)

Definition at line 70 of file ContainedObject.h.

70{ return s; }

◆ index()

virtual long ContainedObject::index ( ) const
inlinevirtual

Distance in the parent container.

Reimplemented in KeyedObject< KEY >, KeyedObject< int >, KeyedObject< key_type >, and KeyedObject< key_type >.

Definition at line 64 of file ContainedObject.h.

64{ return m_parent ? m_parent->index( this ) : -1; }

◆ operator=()

ContainedObject & ContainedObject::operator= ( const ContainedObject & )
inlineprotected

Definition at line 49 of file ContainedObject.h.

49{ return *this; }

◆ parent()

const ObjectContainerBase * ContainedObject::parent ( ) const
inline

Access to parent object.

Definition at line 59 of file ContainedObject.h.

59{ return m_parent; }

◆ serialize() [1/2]

virtual StreamBuffer & ContainedObject::serialize ( StreamBuffer & s)
inlinevirtual

Serialize the object for reading.

Reimplemented in Gaudi::TestSuite::MyTrack, Gaudi::TestSuite::MyVertex, KeyedObject< KEY >, KeyedObject< int >, KeyedObject< key_type >, and KeyedObject< key_type >.

Definition at line 68 of file ContainedObject.h.

68{ return s; }

◆ serialize() [2/2]

virtual StreamBuffer & ContainedObject::serialize ( StreamBuffer & s) const
inlinevirtual

Serialize the object for writing.

Reimplemented in Gaudi::TestSuite::MyTrack, Gaudi::TestSuite::MyVertex, KeyedObject< KEY >, KeyedObject< int >, KeyedObject< key_type >, and KeyedObject< key_type >.

Definition at line 66 of file ContainedObject.h.

66{ return s; }

◆ setParent()

void ContainedObject::setParent ( ObjectContainerBase * value)
inline

Update parent member.

Definition at line 61 of file ContainedObject.h.

61{ m_parent = value; }

Friends And Related Symbol Documentation

◆ ObjectList< ContainedObject >

friend class ObjectList< ContainedObject >
friend

Definition at line 37 of file ContainedObject.h.

◆ ObjectVector< ContainedObject >

Allow the container classes access to protected members.

Definition at line 37 of file ContainedObject.h.

◆ operator<<

std::ostream & operator<< ( std::ostream & s,
const ContainedObject & obj )
friend

Output operator (ASCII)

Definition at line 72 of file ContainedObject.h.

72{ return obj.fillStream( s ); }
virtual std::ostream & fillStream(std::ostream &s) const
Fill the output stream (ASCII)

Member Data Documentation

◆ m_parent

ObjectContainerBase* ContainedObject::m_parent = nullptr
private

Pointer to the parent.

Definition at line 76 of file ContainedObject.h.


The documentation for this class was generated from the following files: