| # Gaudi Framework, version v21r7p1 |

Home |  | Generated: 15 Feb 2010

# 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
std::string | getGaudiThreadIDfromName (const std::string &name)
| helper function to extract Gaudi Thread ID from thread copy name
std::string | getGaudiThreadGenericName (const std::string &name)
| helper function to extract Gaudi instance name from thread copy name
bool | isGaudiThreaded (const std::string &name)
| test if current Gaudi object is running /will run in a thread
## Variables
const std::string | threadSeparator = "__"
const std::string | algToolSeparator = "."
ThreadGaudi * | ThreadGaudiInstance = 0

## 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.

    00052                                                            {
    00053   std::string genericName = name ;
    00054
    00055   // find parent if name of an AlgTool
    00056   std::string parent_name = name ;
    00057   std::string tool_name  = "" ;
    00058   size_t pp = name.find(".") ;
    00059   if ( (pp > 0) && (pp <= name.length()) ) {
    00060     parent_name = name.substr(0,name.find(".")-1) ;
    00061     tool_name = name.substr(name.find("."));
    00062   }
    00063
    00064   // construct gneric name
    00065   pp = parent_name.find(threadSeparator) ;
    00066   if ( (pp > 0) && (pp <= parent_name.length()) ) {
    00067     genericName = parent_name.substr(0,parent_name.find(threadSeparator))+tool_name ;
    00068   }
    00069   return genericName ;
    00070 }

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

helper function to extract Gaudi Thread ID from thread copy number

Definition at line 18 of file ThreadGaudi.cpp.

    00018                                             {
    00019   std::ostringstream ost;
    00020   ost << threadSeparator << iCopy << std::ends;
    00021   return ost.str();
    00022 }

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.

    00028                                                           {
    00029   std::string threadAppendix = "" ;
    00030
    00031   // find parent if name of an AlgTool
    00032   std::string parent_name = name ;
    00033   std::string tool_name  = "" ;
    00034   size_t pp = name.find(".") ;
    00035   if ( (pp > 0) && (pp <= name.length()) ) {
    00036     parent_name = name.substr(0,name.find(".")-1) ;
    00037     tool_name = name.substr(name.find("."));
    00038   }
    00039
    00040   // get from (parent_)name thread ID
    00041   pp = parent_name.find(threadSeparator) ;
    00042   if ( (pp > 0) && (pp <= parent_name.length()) ) {
    00043     threadAppendix = parent_name.substr(parent_name.find(threadSeparator)) ;
    00044   }
    00045   return threadAppendix ;
    00046 }

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.

    00075                                             {
    00076   return  (!(getGaudiThreadIDfromName(name).empty()));
    00077 }

## Variable Documentation

const std::string algToolSeparator = "."

Definition at line 12 of file ThreadGaudi.cpp.

ThreadGaudi* ThreadGaudiInstance = 0

Definition at line 83 of file ThreadGaudi.cpp.

const std::string threadSeparator = "__"

Definition at line 11 of file ThreadGaudi.cpp.