| The Gaudi Framework v32r1 (f65d50dc)

Public Types | Public Member Functions | Protected Member Functions | Private Attributes | List of all members
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]

## Public Types
using | PropertyType = GaudiHandleProperty

## Public Member Functions
std::string | typeAndName () const
| The full type and name: "type/name". More...
std::string | type () const
| The concrete component class name: the part before the '/'. More...
std::string | name () const
| The instance name: the part after the '/'. More...
bool | empty () const
| Check if the handle has been set to empty string (i.e. More...
void | setTypeAndName (std::string myTypeAndName)
| The component "type/name" string. More...
void | setName (const std::string &myName)
| Set the instance name (part after the '/') without changing the class type. More...
std::string | pythonPropertyClassName () const override
| Name of the componentType with "Handle" appended. More...
std::string | messageName () const
| name used for printing messages More...
std::string | pythonRepr () const override
| Python representation of handle, i.e. More...
Public Member Functions inherited from GaudiHandleInfo
virtual | ~GaudiHandleInfo ()=default
| virtual destructor so that derived class destructor is called. More...
const std::string & | componentType () const
const std::string & | propertyName () const
| name as used in declareProperty(name,gaudiHandle) More...
void | setPropertyName (std::string propName)
| set name as used in declareProperty(name,gaudiHandle). More...
const std::string & | parentName () const
| The name of the parent. More...

## Protected Member Functions
| GaudiHandleBase (std::string myTypeAndName, std::string myComponentType, std::string myParentName)
| Create a handle ('smart pointer') to a gaudi component. More...
Protected Member Functions inherited from GaudiHandleInfo
| GaudiHandleInfo (std::string myComponentType, std::string myParentName)
| Some basic information and helper functions shared between various handles/arrays. More...
void | setComponentType (const std::string &componentType)
| The component type. More...
void | setParentName (const std::string &parent)
| The name of the parent. More...

## 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
  Marti.nosp@m.n.Wo.nosp@m.udstr.nosp@m.a@ce.nosp@m.rn.ch

Definition at line 89 of file GaudiHandle.h.

## Member Typedef Documentation

## ◆ PropertyType

using GaudiHandleBase::PropertyType = GaudiHandleProperty

Definition at line 145 of file GaudiHandle.h.

## Constructor & Destructor Documentation

## ◆ GaudiHandleBase()

GaudiHandleBase::GaudiHandleBase | ( | std::string | myTypeAndName,
|  | std::string | myComponentType,
|  | 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 105 of file GaudiHandle.h.

106 : GaudiHandleInfo( std::move( myComponentType ), std::move( myParentName ) ) {
107 setTypeAndName( std::move( myTypeAndName ) );
108 }
GaudiHandleBase::setTypeAndName
void setTypeAndName(std::string myTypeAndName)
The component "type/name" string.
Definition: GaudiHandle.cpp:9
std::move
T move(T... args)
GaudiHandleInfo::GaudiHandleInfo
GaudiHandleInfo(std::string myComponentType, std::string myParentName)
Some basic information and helper functions shared between various handles/arrays.
Definition: GaudiHandle.h:35

## Member Function Documentation

## ◆ empty()

bool GaudiHandleBase::empty | ( |  | ) | const
| inline

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

typeAndName string is empty).

Definition at line 124 of file GaudiHandle.h.

124 { return m_typeAndName.empty(); }
std::string::empty
T empty(T... args)
GaudiHandleBase::m_typeAndName
std::string m_typeAndName
Definition: GaudiHandle.h:151

## ◆ messageName()

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

name used for printing messages

Definition at line 42 of file GaudiHandle.cpp.

42 {
43 std::string propName = propertyName();
44 if ( propName.empty() ) { propName = pythonPropertyClassName() + "('" + m_typeAndName + "')"; }
45 return parentName() + "." + propName;
46 }
std::string::empty
T empty(T... args)
GaudiHandleInfo::propertyName
const std::string & propertyName() const
name as used in declareProperty(name,gaudiHandle)
Definition: GaudiHandle.h:47
GaudiHandleBase::pythonPropertyClassName
std::string pythonPropertyClassName() const override
Name of the componentType with "Handle" appended.
Definition: GaudiHandle.cpp:40
std::string
STL class.
GaudiHandleInfo::parentName
const std::string & parentName() const
The name of the parent.
Definition: GaudiHandle.h:53
GaudiHandleBase::m_typeAndName
std::string m_typeAndName
Definition: GaudiHandle.h:151

## ◆ name()

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

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

Definition at line 22 of file GaudiHandle.cpp.

22 {
23 auto slash = m_typeAndName.find( '/' );
24 if ( slash == std::string::npos ) {
25 // only type is given, or string is empty.
26 // return default name (=type or empty, in this case full string)
27 return m_typeAndName;
28 } else if ( slash != m_typeAndName.length() - 1 ) {
29 // an explicit name is given, so return it
30 return m_typeAndName.substr( slash + 1 );
31 } else {
32 // ends with /, i.e. explicit empty name.
33 // Should probably never happen.
34 return "";
35 }
36 }
GaudiHandleBase::m_typeAndName
std::string m_typeAndName
Definition: GaudiHandle.h:151
std::string::find
T find(T... args)
std::string::length
T length(T... args)
std::string::substr
T substr(T... args)

## ◆ pythonPropertyClassName()

std::string GaudiHandleBase::pythonPropertyClassName | ( |  | ) | const
| override 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 40 of file GaudiHandle.cpp.

40 { return componentType() + "Handle"; }
GaudiHandleInfo::componentType
const std::string & componentType() const
Definition: GaudiHandle.h:44

## ◆ pythonRepr()

std::string GaudiHandleBase::pythonRepr | ( |  | ) | const
| override 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 48 of file GaudiHandle.cpp.

48 { return pythonPropertyClassName() + "('" + m_typeAndName + "')"; }
GaudiHandleBase::pythonPropertyClassName
std::string pythonPropertyClassName() const override
Name of the componentType with "Handle" appended.
Definition: GaudiHandle.cpp:40
GaudiHandleBase::m_typeAndName
std::string m_typeAndName
Definition: GaudiHandle.h:151

## ◆ setName()

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

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

Definition at line 38 of file GaudiHandle.cpp.

38 { m_typeAndName = type() + '/' + myName; }
GaudiHandleBase::m_typeAndName
std::string m_typeAndName
Definition: GaudiHandle.h:151
GaudiHandleBase::type
std::string type() const
The concrete component class name: the part before the '/'.
Definition: GaudiHandle.cpp:11

## ◆ setTypeAndName()

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

The component "type/name" string.

Definition at line 9 of file GaudiHandle.cpp.

9 { m_typeAndName = std::move( myTypeAndName ); }
GaudiHandleBase::m_typeAndName
std::string m_typeAndName
Definition: GaudiHandle.h:151
std::move
T move(T... args)

## ◆ type()

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

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

Definition at line 11 of file GaudiHandle.cpp.

11 {
12 std::string::size_type slash = m_typeAndName.find( '/' );
13 if ( slash != std::string::npos ) {
14 // return only part before /
15 return m_typeAndName.substr( 0, slash );
16 } else {
17 // return full string
18 return m_typeAndName;
19 }
20 }
GaudiHandleBase::m_typeAndName
std::string m_typeAndName
Definition: GaudiHandle.h:151
std::string::find
T find(T... args)
std::string::substr
T substr(T... args)

## ◆ typeAndName()

std::string GaudiHandleBase::typeAndName | ( |  | ) | const
| inline

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

Definition at line 115 of file GaudiHandle.h.

115 { return m_typeAndName; }
GaudiHandleBase::m_typeAndName
std::string m_typeAndName
Definition: GaudiHandle.h:151

## Member Data Documentation

## ◆ m_typeAndName

std::string GaudiHandleBase::m_typeAndName
| private

Definition at line 151 of file GaudiHandle.h.

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

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