| # Gaudi Framework, version v21r7 |

Home |  | Generated: 22 Jan 2010

# 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
GAUDI_API std::string | getGaudiThreadIDfromName (const std::string &name)
| helper function to extract Gaudi Thread ID from thread copy name
GAUDI_API std::string | getGaudiThreadGenericName (const std::string &name)
| helper function to extract Gaudi instance name from thread copy name
GAUDI_API bool | isGaudiThreaded (const std::string &name)
| test if current Gaudi object is running /will run in a thread

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

    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 }

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.

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

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.

    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 }

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.

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