All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages
ThreadGaudi.h File Reference
#include "GaudiKernel/System.h"
#include <string>
#include <map>
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.

52  {
53  std::string genericName = name ;
54 
55  // find parent if name of an AlgTool
56  std::string parent_name = name ;
57  std::string tool_name = "" ;
58  size_t pp = name.find(".") ;
59  if ( (pp > 0) && (pp <= name.length()) ) {
60  parent_name = name.substr(0,name.find(".")-1) ;
61  tool_name = name.substr(name.find("."));
62  }
63 
64  // construct gneric name
65  pp = parent_name.find(threadSeparator) ;
66  if ( (pp > 0) && (pp <= parent_name.length()) ) {
67  genericName = parent_name.substr(0,parent_name.find(threadSeparator))+tool_name ;
68  }
69  return genericName ;
70 }
const std::string threadSeparator
Definition: ThreadGaudi.cpp:11
GAUDI_API std::string getGaudiThreadIDfromID ( int  iCopy)

helper function to extract Gaudi Thread ID from thread copy number

Definition at line 18 of file ThreadGaudi.cpp.

18  {
19  std::ostringstream ost;
20  ost << threadSeparator << iCopy << std::ends;
21  return ost.str();
22 }
const std::string threadSeparator
Definition: ThreadGaudi.cpp:11
GAUDI_API std::string getGaudiThreadIDfromName ( const std::string &  name)

helper function to extract Gaudi Thread ID from thread copy name

Definition at line 28 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 }
const std::string threadSeparator
Definition: ThreadGaudi.cpp:11
GAUDI_API bool isGaudiThreaded ( const std::string &  name)

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

Definition at line 75 of file ThreadGaudi.cpp.

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