| # Gaudi Framework, version v21r7p1 |

Home |  | Generated: 15 Feb 2010

# GaudiHandleBase Class Reference

Base class to handles to be used in lieu of naked pointers to various Gaudi components. More...

`#include <GaudiKernel/GaudiHandle.h>`

Inheritance diagram for GaudiHandleBase:

[legend]
Collaboration diagram for GaudiHandleBase:

[legend]

List of all members.

## Public Member Functions
std::string | typeAndName () const
| The full type and name: "type/name".
std::string | type () const
| The concrete component class name: the part before the '/'.
std::string | name () const
| The instance name: the part after the '/'.
bool | empty () const
| Check if the handle has been set to empty string (i.e.
void | setTypeAndName (const std::string &myTypeAndName)
| The component "type/name" string.
void | setName (const std::string &myName)
| Set the instance name (part after the '/') without changing the class type.
const std::string | pythonPropertyClassName () const
| Name of the componentType with "Handle" appended.
const std::string | messageName () const
| name used for printing messages
virtual const std::string | pythonRepr () const
| Python representation of handle, i.e.
## Protected Member Functions
| GaudiHandleBase (const std::string &myTypeAndName, const std::string &myComponentType, const std::string &myParentName)
| Create a handle ('smart pointer') to a gaudi component.
## Private Attributes
std::string | m_typeAndName

## Detailed Description

Base class to handles to be used in lieu of naked pointers to various Gaudi components.

This allows better control through the framework of component loading, configuration and usage. This base class implements common features.

Author:
  Martin.Woudstra@cern.ch

Definition at line 80 of file GaudiHandle.h.

## Constructor & Destructor Documentation

GaudiHandleBase::GaudiHandleBase | ( | const std::string & | myTypeAndName,
|  | const std::string & | myComponentType,
|  | const std::string & | myParentName |
| ) |  |  | `[inline, protected]`

Create a handle ('smart pointer') to a gaudi component.

Parameters:

  | myTypeAndName,: | "MyType/MyName" ("MyType" is short for "MyType/MyType") 'MyType' is the name of the concrete class of the component 'MyName' is to distinguish several instances of the same concrete class
  | myComponentType,: | string indicating what type of component the handle is pointing to. For example: "PublicTool", "PrivateTool", "Service". This is used for printout and on the python side for type checking. On the python side there are classes with these names with "Handle" appended: PublicToolHandle,PrivateToolHandle,ServiceHandle
  | myParentName,: | Name of the parent that has this handle as a member. Used in printout.

Definition at line 96 of file GaudiHandle.h.

    00098     : GaudiHandleInfo(myComponentType,myParentName)
    00099   {
    00100     setTypeAndName(myTypeAndName);
    00101   }

## Member Function Documentation

std::string GaudiHandleBase::typeAndName | ( |  | ) | const`[inline]`

The full type and name: "type/name".

Definition at line 107 of file GaudiHandle.h.

    00107                                 {
    00108      return m_typeAndName;
    00109   }

std::string GaudiHandleBase::type | ( |  | ) | const

The concrete component class name: the part before the '/'.

Definition at line 13 of file GaudiHandle.cpp.

    00013                                       {
    00014   std::string::size_type slash = m_typeAndName.find('/');
    00015   if ( slash != std::string::npos ) {
    00016     // return only part before /
    00017     return m_typeAndName.substr(0,slash);
    00018   } else {
    00019     // return full string
    00020     return m_typeAndName;
    00021   }
    00022 }

std::string GaudiHandleBase::name | ( |  | ) | const

The instance name: the part after the '/'.

Definition at line 24 of file GaudiHandle.cpp.

    00024                                       {
    00025   std::string::size_type slash = m_typeAndName.find('/');
    00026   if ( slash == std::string::npos ) {
    00027     // only type is given, or string is empty.
    00028     // return default name (=type or empty, in this case full string)
    00029     return m_typeAndName;
    00030   } else if ( slash != m_typeAndName.length() -1 ) {
    00031     // an explicit name is given, so return it
    00032     return m_typeAndName.substr(slash+1);
    00033   } else {
    00034     // ends with /, i.e. explicit empty name.
    00035     // Should probably never happen.
    00036     return "";
    00037   }
    00038 }

bool GaudiHandleBase::empty | ( | void |  | ) | const`[inline]`

Check if the handle has been set to empty string (i.e.

typeAndName string is empty).

Definition at line 118 of file GaudiHandle.h.

    00118                      {
    00119     return m_typeAndName.empty();
    00120   }

void GaudiHandleBase::setTypeAndName | ( | const std::string & | myTypeAndName | ) |

The component "type/name" string.

Definition at line 9 of file GaudiHandle.cpp.

    00009                                                                      {
    00010   m_typeAndName = myTypeAndName;
    00011 }

void GaudiHandleBase::setName | ( | const std::string & | myName | ) |

Set the instance name (part after the '/') without changing the class type.

Definition at line 40 of file GaudiHandle.cpp.

    00040                                                        {
    00041   m_typeAndName = type() + '/' + myName;
    00042 }

const std::string GaudiHandleBase::pythonPropertyClassName | ( |  | ) | const`[virtual]`

Name of the componentType with "Handle" appended.

Used as the python class name for the property in the genconf-generated configurables. The python class is defined in GaudiPython/python/GaudiHandles.py.

Implements GaudiHandleInfo.

Definition at line 44 of file GaudiHandle.cpp.

    00044                                                                {
    00045   return componentType() + "Handle";
    00046 }

const std::string GaudiHandleBase::messageName | ( |  | ) | const

name used for printing messages

Definition at line 48 of file GaudiHandle.cpp.

    00048                                                    {
    00049   std::string propName = propertyName();
    00050   if ( propName.empty() ) {
    00051     propName = pythonPropertyClassName() + "('" + m_typeAndName + "')";
    00052   }
    00053   return parentName() + "." + propName;
    00054 }

const std::string GaudiHandleBase::pythonRepr | ( |  | ) | const`[virtual]`

Python representation of handle, i.e.

python class name and argument. Can be used in the genconf-generated configurables. The corresponding python classes are defined in GaudiPython/GaudiHandles.py

Implements GaudiHandleInfo.

Definition at line 56 of file GaudiHandle.cpp.

    00056                                                   {
    00057   return pythonPropertyClassName() + "('" + m_typeAndName + "')";
    00058 }

## Member Data Documentation

std::string GaudiHandleBase::m_typeAndName`[private]`

Definition at line 145 of file GaudiHandle.h.

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

- /afs/cern.ch/sw/Gaudi/releases/GAUDI/GAUDI_v21r7p1/GaudiKernel/GaudiKernel/GaudiHandle.h
- /afs/cern.ch/sw/Gaudi/releases/GAUDI/GAUDI_v21r7p1/GaudiKernel/src/Lib/GaudiHandle.cpp