| The Gaudi Framework v29r0 (ff2e7097)

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

- File List
- File Members

Functions | Variables
ThreadGaudi.cpp File Reference
`#include "GaudiKernel/ThreadGaudi.h"`
`#include <sstream>`
`#include <iostream>`
Include dependency graph for ThreadGaudi.cpp:

Go to the source code of this file.

## Functions
std::string | getGaudiThreadIDfromID (int iCopy)
| helper function to extract Gaudi Thread ID from thread copy number More...
std::string | getGaudiThreadIDfromName (const std::string &name)
| helper function to extract Gaudi Thread ID from thread copy name More...
std::string | getGaudiThreadGenericName (const std::string &name)
| helper function to extract Gaudi instance name from thread copy name More...
bool | isGaudiThreaded (const std::string &name)
| test if current Gaudi object is running /will run in a thread More...

## Variables
const std::string | threadSeparator = "__"
const std::string | algToolSeparator = "."
ThreadGaudi * | ThreadGaudiInstance = nullptr

## Function Documentation

std::string getGaudiThreadGenericName | ( | const std::string & | name | ) |

helper function to extract Gaudi instance name from thread copy name

Definition at line 52 of file ThreadGaudi.cpp.

53 {
54 std::string genericName = name;
55
56 // find parent if name of an AlgTool
57 std::string parent_name = name;
58 std::string tool_name = "";
59 size_t pp = name.find( "." );
60 if ( ( pp > 0 ) && ( pp <= name.length() ) ) {
61 parent_name = name.substr( 0, name.find( "." ) - 1 );
62 tool_name = name.substr( name.find( "." ) );
63 }
64
65 // construct gneric name
66 pp = parent_name.find( threadSeparator );
67 if ( ( pp > 0 ) && ( pp <= parent_name.length() ) ) {
68 genericName = parent_name.substr( 0, parent_name.find( threadSeparator ) ) + tool_name;
69 }
70 return genericName;
71 }
gaudiComponentHelp.name
name
Definition: gaudiComponentHelp.py:32
std::string
STL class.
threadSeparator
const std::string threadSeparator
Definition: ThreadGaudi.cpp:9
std::string::find
T find(T...args)
std::string::length
T length(T...args)
compareOutputFiles.pp
pp
Definition: compareOutputFiles.py:465
std::string::substr
T substr(T...args)

std::string getGaudiThreadIDfromID | ( | int | iCopy | ) |

helper function to extract Gaudi Thread ID from thread copy number

Definition at line 16 of file ThreadGaudi.cpp.

17 {
18 std::ostringstream ost;
19 ost << threadSeparator << iCopy << std::ends;
20 return ost.str();
21 }
std::ostringstream
STL class.
std::ostringstream::str
T str(T...args)
threadSeparator
const std::string threadSeparator
Definition: ThreadGaudi.cpp:9
std::ends
T ends(T...args)

std::string getGaudiThreadIDfromName | ( | const std::string & | name | ) |

helper function to extract Gaudi Thread ID from thread copy name

Definition at line 27 of file ThreadGaudi.cpp.

28 {
29 std::string threadAppendix = "";
30
31 // find parent if name of an AlgTool
32 std::string parent_name = name;
33 std::string tool_name = "";
34 size_t pp = name.find( "." );
35 if ( ( pp > 0 ) && ( pp <= name.length() ) ) {
36 parent_name = name.substr( 0, name.find( "." ) - 1 );
37 tool_name = name.substr( name.find( "." ) );
38 }
39
40 // get from (parent_)name thread ID
41 pp = parent_name.find( threadSeparator );
42 if ( ( pp > 0 ) && ( pp <= parent_name.length() ) ) {
43 threadAppendix = parent_name.substr( parent_name.find( threadSeparator ) );
44 }
45 return threadAppendix;
46 }
gaudiComponentHelp.name
name
Definition: gaudiComponentHelp.py:32
std::string
STL class.
threadSeparator
const std::string threadSeparator
Definition: ThreadGaudi.cpp:9
std::string::find
T find(T...args)
std::string::length
T length(T...args)
compareOutputFiles.pp
pp
Definition: compareOutputFiles.py:465
std::string::substr
T substr(T...args)

bool isGaudiThreaded | ( | const std::string & | name | ) |

test if current Gaudi object is running /will run in a thread

Definition at line 76 of file ThreadGaudi.cpp.

76 { return ( !( getGaudiThreadIDfromName( name ).empty() ) ); }
getGaudiThreadIDfromName
std::string getGaudiThreadIDfromName(const std::string &name)
helper function to extract Gaudi Thread ID from thread copy name
Definition: ThreadGaudi.cpp:27

## Variable Documentation

const std::string algToolSeparator = "."

Definition at line 10 of file ThreadGaudi.cpp.

ThreadGaudi* ThreadGaudiInstance = nullptr

Definition at line 82 of file ThreadGaudi.cpp.

const std::string threadSeparator = "__"

Definition at line 9 of file ThreadGaudi.cpp.