The Gaudi Framework  v29r0 (ff2e7097)
ThreadGaudi.h File Reference
#include "GaudiKernel/System.h"
#include <map>
#include <memory>
#include <string>
Include dependency graph for ThreadGaudi.h:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Classes

class  ThreadGaudi
 singleton mapping the pthread ID to the Gaudi thread ID More...
 

Functions

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

Function Documentation

GAUDI_API 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 }
STL class.
const std::string threadSeparator
Definition: ThreadGaudi.cpp:9
T find(T...args)
T length(T...args)
T substr(T...args)
GAUDI_API 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 {
19  ost << threadSeparator << iCopy << std::ends;
20  return ost.str();
21 }
const std::string threadSeparator
Definition: ThreadGaudi.cpp:9
T ends(T...args)
GAUDI_API 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 }
STL class.
const std::string threadSeparator
Definition: ThreadGaudi.cpp:9
T find(T...args)
T length(T...args)
T substr(T...args)
GAUDI_API 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() ) ); }
std::string getGaudiThreadIDfromName(const std::string &name)
helper function to extract Gaudi Thread ID from thread copy name
Definition: ThreadGaudi.cpp:27