ThreadGaudi.h File Reference
#include "GaudiKernel/System.h"
#include <string>
#include <map>
#include <memory>
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 50 of file ThreadGaudi.cpp.

50  {
51  std::string genericName = name ;
52 
53  // find parent if name of an AlgTool
54  std::string parent_name = name ;
55  std::string tool_name = "" ;
56  size_t pp = name.find(".") ;
57  if ( (pp > 0) && (pp <= name.length()) ) {
58  parent_name = name.substr(0,name.find(".")-1) ;
59  tool_name = name.substr(name.find("."));
60  }
61 
62  // construct gneric name
63  pp = parent_name.find(threadSeparator) ;
64  if ( (pp > 0) && (pp <= parent_name.length()) ) {
65  genericName = parent_name.substr(0,parent_name.find(threadSeparator))+tool_name ;
66  }
67  return genericName ;
68 }
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.

16  {
18  ost << threadSeparator << iCopy << std::ends;
19  return ost.str();
20 }
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 26 of file ThreadGaudi.cpp.

26  {
27  std::string threadAppendix = "" ;
28 
29  // find parent if name of an AlgTool
30  std::string parent_name = name ;
31  std::string tool_name = "" ;
32  size_t pp = name.find(".") ;
33  if ( (pp > 0) && (pp <= name.length()) ) {
34  parent_name = name.substr(0,name.find(".")-1) ;
35  tool_name = name.substr(name.find("."));
36  }
37 
38  // get from (parent_)name thread ID
39  pp = parent_name.find(threadSeparator) ;
40  if ( (pp > 0) && (pp <= parent_name.length()) ) {
41  threadAppendix = parent_name.substr(parent_name.find(threadSeparator)) ;
42  }
43  return threadAppendix ;
44 }
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 73 of file ThreadGaudi.cpp.

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