Defined in file: hzProcess.h
Internal class to facilitate registration of a function call to the calling thread. The macro _hzfunc is placed at the top of most HadronZoo functions (both independent and class members). This macro takes a char* argument, the value of which is assumed to be the fully qualified name of the function or a close variant of it. The macro declares an instance of _hz_func_reg called _thisfn and assigns the function name to it. The _hz_func_reg assignment operator calls GetThreadInfo to obtain a pointer to the hzProcess instance for the current thread and stores in the the public member _phz. Then it uses the pointer to call hzProcess::PushFunction - which pushes the function name on to the stack. In any function with the _hzfunc macro, the current thread is available without a further call to GetThreadInfo, as _thisfn._phz - not that a GetThreadInfo call is onerous. The ready availablity of the hzProcess instance has a lot of potential for holding data 'private to the thread'. The _hzfunc macro must not be called outside the scope of a function even though the compiler would allow it. Doing so would place a false entry in the hzProcess stack. The macro when called at the top of a function as intended, creates the _hz_func_reg instance _thisfn as an automatic variable. This is deleted when the function returns so the call to hzProcess::PullFunction which pulls the function name from the hzProcess stack, is placed in the _hz_func_reg destructor.
Constructors/Detructors
| _hz_func_reg* | _hz_func_reg | (void) | |
| void | ~_hz_func_reg | (void) | This destructor is called as any function starting with a call to _hzfunc() ends. As the latter pushes a function name onto the function stack for the thread, this must be pulled here. |
Public Methods:
| char* | ScratchPad | (int32_t nSize) |
Overloaded operators:
| void | operator= | (const char* fnName) | Set the function name and push it onto the function stack for the thread. Returns: None |
Member Variables:
| hzProcess* | _phz | Pointer to hzProcess instance (process information) |