| # Gaudi Framework, version v22r4 |

Home |  | Generated: Fri Sep 2 2011

Classes | Functions

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

                                                               {
      std::string genericName = name ;

      // find parent if name of an AlgTool
      std::string parent_name = name ;
      std::string tool_name  = "" ;
      size_t pp = name.find(".") ;
      if ( (pp > 0) && (pp <= name.length()) ) {
        parent_name = name.substr(0,name.find(".")-1) ;
        tool_name = name.substr(name.find("."));
      }

      // construct gneric name
      pp = parent_name.find(threadSeparator) ;
      if ( (pp > 0) && (pp <= parent_name.length()) ) {
        genericName = parent_name.substr(0,parent_name.find(threadSeparator))+tool_name ;
      }
      return genericName ;
    }

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.

                                                {
      std::ostringstream ost;
      ost << threadSeparator << iCopy << std::ends;
      return ost.str();
    }

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.

                                                              {
      std::string threadAppendix = "" ;

      // find parent if name of an AlgTool
      std::string parent_name = name ;
      std::string tool_name  = "" ;
      size_t pp = name.find(".") ;
      if ( (pp > 0) && (pp <= name.length()) ) {
        parent_name = name.substr(0,name.find(".")-1) ;
        tool_name = name.substr(name.find("."));
      }

      // get from (parent_)name thread ID
      pp = parent_name.find(threadSeparator) ;
      if ( (pp > 0) && (pp <= parent_name.length()) ) {
        threadAppendix = parent_name.substr(parent_name.find(threadSeparator)) ;
      }
      return threadAppendix ;
    }

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.

                                                {
      return  (!(getGaudiThreadIDfromName(name).empty()));
    }

All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Defines