| # Gaudi Framework, version v20r2
Generated: 18 Jul 2008

- Main Page
- Namespaces
- Classes
- Files
- Directories
- Related Pages

- Search for |

- Alphabetical List
- Class List
- Class Hierarchy
- Class Members

# ContainedObject Class Reference

`#include <GaudiKernel/ContainedObject.h>`

Inheritance diagram for ContainedObject:

[legend]
Collaboration diagram for ContainedObject:

[legend]
List of all members.

## 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.

## Public Member Functions
virtual const CLID & | clID () const
| Retrieve pointer to class identifier.
const ObjectContainerBase * | parent () const
| Access to parent object.
void | setParent (ObjectContainerBase *value)
| Update parent member.
virtual long | index () const
| Distance in the parent container.
virtual StreamBuffer & | serialize (StreamBuffer &s) const
| Serialize the object for writing.
virtual StreamBuffer & | serialize (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 CLID & | classID ()
## Protected Member Functions
| ContainedObject ()
| Constructors.
| ContainedObject (const ContainedObject &)
| Copy constructor.
virtual | ~ContainedObject ()
| Destructor.
## Private Attributes
ObjectContainerBase * | m_parent
| 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).

## Constructor & Destructor Documentation

ContainedObject::ContainedObject | ( |  | ) | `[inline, protected]`

Constructors.

Definition at line 38 of file ContainedObject.h.

    00038 : m_parent(0)  { }

ContainedObject::ContainedObject | ( | const ContainedObject & |  | ) | `[inline, protected]`

Copy constructor.

Definition at line 40 of file ContainedObject.h.

    00040 : m_parent(0)  { }

ContainedObject::~ContainedObject | ( |  | ) | `[protected, virtual]`

Destructor.

Definition at line 3 of file ContainedObject.cpp.

References m_parent, and ObjectContainerBase::remove().

    00003                                   {
    00004   // If the object is contained in a container, remove it from there
    00005   if( 0 != m_parent ) {
    00006     m_parent->remove(this);
    00007   }
    00008 }

## Member Function Documentation

virtual const CLID& ContainedObject::clID | ( |  | ) | const`[inline, virtual]`

Retrieve pointer to class identifier.

Definition at line 46 of file ContainedObject.h.

References classID().

    00046 { return ContainedObject::classID(); }

static const CLID& ContainedObject::classID | ( |  | ) | `[inline, static]`

Definition at line 47 of file ContainedObject.h.

References CLID_ContainedObject.

Referenced by clID().

    00047 { return CLID_ContainedObject; }

const ObjectContainerBase* ContainedObject::parent | ( |  | ) | const`[inline]`

Access to parent object.

Definition at line 50 of file ContainedObject.h.

References m_parent.

Referenced by Objects::access(), SmartRefBase::accessData(), Containers::KeyedObjectManager< SETUP >::insert(), Containers::KeyedObjectManager< SETUP >::insertDirect(), SmartRefBase::isEqualEx(), SmartRefVector< TYPE >::operator()(), SmartRef< KeyType >::operator()(), SmartRefBase::path(), PoolDbIOHandler< T >::put(), KeyedContainer< DATATYPE, MAPPING >::remove(), SmartRef< KeyType >::SmartRef(), and KeyedObject< KEY >::~KeyedObject().

    00050 { return m_parent;        }

void ContainedObject::setParent | ( | ObjectContainerBase * | value | ) | `[inline]`

Update parent member.

Definition at line 52 of file ContainedObject.h.

References m_parent.

Referenced by PoolDbIOHandler< T >::get(), Containers::KeyedObjectManager< SETUP >::insert(), Containers::KeyedObjectManager< SETUP >::insertDirect(), and KeyedObject< KEY >::~KeyedObject().

    00052 { m_parent = value;       }

virtual long ContainedObject::index | ( |  | ) | const`[inline, virtual]`

Distance in the parent container.

Reimplemented in KeyedObject< KEY >.

Definition at line 55 of file ContainedObject.h.

References ObjectContainerBase::index(), and m_parent.

Referenced by Objects::access(), SmartRefBase::isEqualEx(), and PoolDbIOHandler< T >::put().

    00056   {
    00057     return (m_parent) ? m_parent->index(this) : -1;
    00058   }

virtual StreamBuffer& ContainedObject::serialize | ( | StreamBuffer & | s | ) | const`[inline, virtual]`

Serialize the object for writing.

Reimplemented in KeyedObject< KEY >.

Definition at line 60 of file ContainedObject.h.

References Gaudi::Units::s.

Referenced by KeyedObject< KEY >::serialize().

    00060 { return s; }

virtual StreamBuffer& ContainedObject::serialize | ( | StreamBuffer & | s | ) | `[inline, virtual]`

Serialize the object for reading.

Reimplemented in KeyedObject< KEY >.

Definition at line 62 of file ContainedObject.h.

References Gaudi::Units::s.

    00062 { return s; }

virtual std::ostream& ContainedObject::fillStream | ( | std::ostream & | s | ) | const`[inline, virtual]`

Fill the output stream (ASCII).

Definition at line 64 of file ContainedObject.h.

References Gaudi::Units::s.

Referenced by GaudiPython::Printer< ContainedObject >::print().

    00064 { return s; }

## Friends And Related Function Documentation

friend class ObjectVector< ContainedObject >`[friend]`

Allow the container classes access to protected members.

Definition at line 33 of file ContainedObject.h.

friend class ObjectList< ContainedObject >`[friend]`

Definition at line 34 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.

    00066                                                                               {
    00067     return obj.fillStream(s);
    00068   }

## Member Data Documentation

ObjectContainerBase* ContainedObject::m_parent`[private]`

Pointer to the parent.

Definition at line 72 of file ContainedObject.h.

Referenced by index(), parent(), setParent(), and ~ContainedObject().

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

- /afs/cern.ch/sw/Gaudi/releases/GAUDI/GAUDI_v20r2/GaudiKernel/v25r2/GaudiKernel/ContainedObject.h
- /afs/cern.ch/sw/Gaudi/releases/GAUDI/GAUDI_v20r2/GaudiKernel/v25r2/src/Lib/ContainedObject.cpp