ATLAS Offline Software
Loading...
Searching...
No Matches
errorcheck Namespace Reference

Classes

class  ReportMessage
 Helper class to use to report a message. More...

Functions

std::string context_name (const INamedInterface *context)
 Return the context name from a context (this) pointer.
std::string context_name (const void *context)
 Return the context name from a context (this) pointer.
std::string munge_filename (const std::string &file, const std::string &pkg)
 Shorten filename.
std::string context_name (const SG::VarHandleBase *context)
 Return a context name for a VarHandle.

Function Documentation

◆ context_name() [1/3]

std::string errorcheck::context_name ( const INamedInterface * context)

Return the context name from a context (this) pointer.

Parameters
contextThe context from which to get the name.
Returns
The name of this context.

This is the specialization for an INamedInterface.

Definition at line 230 of file errorcheck.cxx.

231{
232 return context->name();
233}

◆ context_name() [2/3]

std::string errorcheck::context_name ( const SG::VarHandleBase * context)

Return a context name for a VarHandle.

Parameters
contextThe VarHandle.

For use with the CHECK and REPORT_MESSAGE macros.

Definition at line 70 of file StoreGate/src/VarHandleBase.cxx.

71 {
72 return std::format("VarHandle({}+{}[{}])", context->storeHandle().name(), context->key(), context->clid());
73 }
virtual const std::string & key() const override final
Return the StoreGate ID for the referenced object.
const ServiceHandle< IProxyDict > & storeHandle() const
Return handle to the referenced store.
CLID clid() const
Return the class ID for the referenced object.

◆ context_name() [3/3]

std::string errorcheck::context_name ( const void * context)

Return the context name from a context (this) pointer.

Parameters
contextThe context from which to get the name.
Returns
The name of this context.

This is the specialization for an unknown context type; it returns a blank name.

Definition at line 244 of file errorcheck.cxx.

245{
246 return "";
247}

◆ munge_filename()

std::string errorcheck::munge_filename ( const std::string & file,
const std::string & pkg )

Shorten filename.

Parameters
fileThe full file path
pkgThe package name (with optional version)
Returns
Returns the file path starting from the package name

Definition at line 38 of file errorcheck.cxx.

39{
40 // Extract package name in case there is a version (MyPackage-00-00-00)
41 const std::string p = pkg.substr(0, pkg.find('-'));
42 if (!p.empty()) {
43 // Find package name in path and remove any leading entries
44 std::string::size_type ipos = file.find("/"+p+"/");
45 if (ipos != std::string::npos) {
46 return file.substr(ipos+1, std::string::npos);
47 }
48 }
49 return file;
50}
TFile * file