All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages
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. More...
 
const ObjectContainerBaseparent () const
 Access to parent object. More...
 
void setParent (ObjectContainerBase *value)
 Update parent member. More...
 
virtual long index () const
 Distance in the parent container. More...
 
virtual StreamBufferserialize (StreamBuffer &s) const
 Serialize the object for writing. More...
 
virtual StreamBufferserialize (StreamBuffer &s)
 Serialize the object for reading. More...
 
virtual std::ostream & fillStream (std::ostream &s) const
 Fill the output stream (ASCII) More...
 

Static Public Member Functions

static const CLIDclassID ()
 

Protected Member Functions

 ContainedObject ()
 Constructors. More...
 
 ContainedObject (const ContainedObject &)
 Copy constructor. More...
 
virtual ~ContainedObject ()
 Destructor. More...
 

Private Attributes

ObjectContainerBasem_parent
 Pointer to the parent. More...
 

Friends

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

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 30 of file ContainedObject.h.

Constructor & Destructor Documentation

ContainedObject::ContainedObject ( )
inlineprotected

Constructors.

Definition at line 38 of file ContainedObject.h.

38 : m_parent(0) { }
ObjectContainerBase * m_parent
Pointer to the parent.
ContainedObject::ContainedObject ( const ContainedObject )
inlineprotected

Copy constructor.

Definition at line 40 of file ContainedObject.h.

40 : m_parent(0) { }
ObjectContainerBase * m_parent
Pointer to the parent.
ContainedObject::~ContainedObject ( )
protectedvirtual

Destructor.

Definition at line 3 of file ContainedObject.cpp.

3  {
4  // If the object is contained in a container, remove it from there
5  if( 0 != m_parent ) {
6  m_parent->remove(this);
7  }
8 }
ObjectContainerBase * m_parent
Pointer to the parent.
virtual long remove(ContainedObject *value)=0
Release object from the container (the pointer will be removed from the container, but the object itself will remain alive).

Member Function Documentation

static const CLID& ContainedObject::classID ( )
inlinestatic

Definition at line 47 of file ContainedObject.h.

47 { return CLID_ContainedObject; }
virtual const CLID& ContainedObject::clID ( ) const
inlinevirtual

Retrieve pointer to class identifier.

Reimplemented in MyTrack, and MyVertex.

Definition at line 46 of file ContainedObject.h.

46 { return classID(); }
static const CLID & classID()
virtual std::ostream& ContainedObject::fillStream ( std::ostream &  s) const
inlinevirtual

Fill the output stream (ASCII)

Reimplemented in MyTrack.

Definition at line 64 of file ContainedObject.h.

64 { return s; }
string s
Definition: gaudirun.py:210
virtual long ContainedObject::index ( ) const
inlinevirtual

Distance in the parent container.

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

Definition at line 55 of file ContainedObject.h.

56  {
57  return (m_parent) ? m_parent->index(this) : -1;
58  }
ObjectContainerBase * m_parent
Pointer to the parent.
virtual long index(const ContainedObject *obj) const =0
Distance of a given object from the beginning of its container.
const ObjectContainerBase* ContainedObject::parent ( ) const
inline

Access to parent object.

Definition at line 50 of file ContainedObject.h.

50 { return m_parent; }
ObjectContainerBase * m_parent
Pointer to the parent.
virtual StreamBuffer& ContainedObject::serialize ( StreamBuffer s) const
inlinevirtual

Serialize the object for writing.

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

Definition at line 60 of file ContainedObject.h.

60 { return s; }
string s
Definition: gaudirun.py:210
virtual StreamBuffer& ContainedObject::serialize ( StreamBuffer s)
inlinevirtual

Serialize the object for reading.

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

Definition at line 62 of file ContainedObject.h.

62 { return s; }
string s
Definition: gaudirun.py:210
void ContainedObject::setParent ( ObjectContainerBase value)
inline

Update parent member.

Definition at line 52 of file ContainedObject.h.

52 { m_parent = value; }
ObjectContainerBase * m_parent
Pointer to the parent.

Friends And Related Function Documentation

friend class ObjectList< ContainedObject >
friend

Definition at line 34 of file ContainedObject.h.

Allow the container classes access to protected members.

Definition at line 33 of file ContainedObject.h.

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

Output operator (ASCII)

Definition at line 66 of file ContainedObject.h.

66  {
67  return obj.fillStream(s);
68  }
string s
Definition: gaudirun.py:210
virtual std::ostream & fillStream(std::ostream &s) const
Fill the output stream (ASCII)

Member Data Documentation

ObjectContainerBase* ContainedObject::m_parent
private

Pointer to the parent.

Definition at line 72 of file ContainedObject.h.


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