| The Gaudi Framework v32r1 (f65d50dc)

Public Member Functions | Static Public Member Functions | Protected Member Functions | Private Attributes | Friends | List of all members
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:
[legend]
Collaboration diagram for ContainedObject:
[legend]

## Public Member Functions
virtual const CLID & | clID () const
| Retrieve pointer to class identifier. More...
const ObjectContainerBase * | parent () 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 StreamBuffer & | serialize (StreamBuffer &s) const
| Serialize the object for writing. More...
virtual StreamBuffer & | serialize (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 CLID & | classID ()

## Protected Member Functions
| ContainedObject ()=default
| Constructors. More...
| ContainedObject (const ContainedObject &)
| Copy constructor – do NOT copy the parent reference... More...
virtual | ~ContainedObject ()
| Destructor. More...

## Private Attributes
ObjectContainerBase * | m_parent = nullptr
| 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 31 of file ContainedObject.h.

## Constructor & Destructor Documentation

## ◆ ContainedObject() [1/2]

ContainedObject::ContainedObject | ( |  | ) |
| protected default

Constructors.

## ◆ ContainedObject() [2/2]

ContainedObject::ContainedObject | ( | const ContainedObject & |  | ) |
| inline protected

Copy constructor – do NOT copy the parent reference...

Definition at line 41 of file ContainedObject.h.

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

## ◆ ~ContainedObject()

ContainedObject::~ContainedObject | ( |  | ) |
| protected virtual

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 ( m_parent ) m_parent->remove( this );
6 }
ContainedObject::m_parent
ObjectContainerBase * m_parent
Pointer to the parent.
Definition: ContainedObject.h:68
ObjectContainerBase::remove
virtual long remove(ContainedObject *value)=0
Release object from the container (the pointer will be removed from the container,...

## Member Function Documentation

## ◆ classID()

static const CLID& ContainedObject::classID | ( |  | ) |
| inline static

Definition at line 48 of file ContainedObject.h.

48 { return CLID_ContainedObject; }

## ◆ clID()

virtual const CLID& ContainedObject::clID | ( |  | ) | const
| inline virtual

Retrieve pointer to class identifier.

Definition at line 47 of file ContainedObject.h.

47 { return classID(); }
ContainedObject::classID
static const CLID & classID()
Definition: ContainedObject.h:48

## ◆ fillStream()

virtual std::ostream& ContainedObject::fillStream | ( | std::ostream & | s | ) | const
| inline virtual

Fill the output stream (ASCII)

Definition at line 62 of file ContainedObject.h.

62 { return s; }
gaudirun.s
string s
Definition: gaudirun.py:316

## ◆ index()

virtual long ContainedObject::index | ( |  | ) | const
| inline virtual

Distance in the parent container.

Reimplemented in KeyedObject< KEY >.

Definition at line 56 of file ContainedObject.h.

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

## ◆ parent()

const ObjectContainerBase* ContainedObject::parent | ( |  | ) | const
| inline

Access to parent object.

Definition at line 51 of file ContainedObject.h.

51 { return m_parent; }
ContainedObject::m_parent
ObjectContainerBase * m_parent
Pointer to the parent.
Definition: ContainedObject.h:68

## ◆ serialize() [1/2]

virtual StreamBuffer& ContainedObject::serialize | ( | StreamBuffer & | s | ) | const
| inline virtual

Serialize the object for writing.

Reimplemented in KeyedObject< KEY >.

Definition at line 58 of file ContainedObject.h.

58 { return s; }
gaudirun.s
string s
Definition: gaudirun.py:316

## ◆ serialize() [2/2]

virtual StreamBuffer& ContainedObject::serialize | ( | StreamBuffer & | s | ) |
| inline virtual

Serialize the object for reading.

Reimplemented in KeyedObject< KEY >.

Definition at line 60 of file ContainedObject.h.

60 { return s; }
gaudirun.s
string s
Definition: gaudirun.py:316

## ◆ setParent()

void ContainedObject::setParent | ( | ObjectContainerBase * | value | ) |
| inline

Update parent member.

Definition at line 53 of file ContainedObject.h.

53 { m_parent = value; }
ContainedObject::m_parent
ObjectContainerBase * m_parent
Pointer to the parent.
Definition: ContainedObject.h:68

## Friends And Related Function Documentation

## ◆ ObjectList< ContainedObject >

friend class ObjectList< ContainedObject >
| friend

Definition at line 35 of file ContainedObject.h.

## ◆ ObjectVector< ContainedObject >

friend class ObjectVector< ContainedObject >
| friend

Allow the container classes access to protected members.

Definition at line 34 of file ContainedObject.h.

## ◆ operator<<

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

Output operator (ASCII)

Definition at line 64 of file ContainedObject.h.

64 { return obj.fillStream( s ); }
ContainedObject::fillStream
virtual std::ostream & fillStream(std::ostream &s) const
Fill the output stream (ASCII)
Definition: ContainedObject.h:62
gaudirun.s
string s
Definition: gaudirun.py:316

## Member Data Documentation

## ◆ m_parent

ObjectContainerBase* ContainedObject::m_parent = nullptr
| private

Pointer to the parent.

Definition at line 68 of file ContainedObject.h.

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

- GaudiKernel/GaudiKernel/ContainedObject.h
- GaudiKernel/src/Lib/ContainedObject.cpp