Loading [MathJax]/extensions/tex2jax.js
 |
ATLAS Offline Software
|
Go to the documentation of this file.
8 #include <boost/algorithm/string/trim.hpp>
9 #include <boost/algorithm/string/split.hpp>
11 #include "GaudiKernel/IIncidentSvc.h"
12 #include "GaudiKernel/Incident.h"
13 #include "GaudiKernel/ModuleIncident.h"
14 #include "GaudiKernel/System.h"
15 #include "GaudiKernel/MsgStream.h"
16 #include "GaudiKernel/ServiceHandle.h"
24 bool tryNumeric (
const std::string&
s,
CLID& clid)
27 char* endptr =
nullptr;
28 clid = strtol (
s.c_str(), &endptr, 10);
29 return clid != CLID_NULL && endptr == (
s.c_str() +
s.size());
34 #define ATH_MSG_LVL(lvl, x) \
36 if (msgLevel(lvl)) { \
37 msgStream(lvl) << x << endmsg; \
41 #define ATH_MSG_VERBOSE(x) ATH_MSG_LVL(MSG::VERBOSE, x)
42 #define ATH_MSG_DEBUG(x) ATH_MSG_LVL(MSG::DEBUG, x)
43 #define ATH_MSG_INFO(x) ATH_MSG_LVL(MSG::INFO, x)
44 #define ATH_MSG_WARNING(x) ATH_MSG_LVL(MSG::WARNING, x)
45 #define ATH_MSG_ERROR(x) ATH_MSG_LVL(MSG::ERROR, x)
47 #define ATH_CONST_MSG_VERBOSE(x) \
49 if (msgLevel(MSG::VERBOSE)) { \
50 verbose() << x << endmsg; \
71 throw std::runtime_error(
"ClassIDSvc::nextAvailableID: none in range");
101 CLIDMap::const_iterator iID =
m_clidMap.find(
id);
105 return StatusCode::SUCCESS;
109 return StatusCode::FAILURE;
121 CLIDMap::const_iterator iID =
m_clidMap.find(
id);
123 typeInfoName = iID->second.second;
125 ") type-info name is " << typeInfoName );
126 return StatusCode::SUCCESS;
130 ") no associated type-info name found" );
131 return StatusCode::FAILURE;
147 return StatusCode::SUCCESS;
149 else if (tryNumeric (
typeName,
id)) {
151 return StatusCode::SUCCESS;
155 return StatusCode::FAILURE;
167 NameMap::const_iterator iID =
m_tiNameMap.find(typeInfoName);
171 return StatusCode::SUCCESS;
175 return StatusCode::FAILURE;
184 const std::string& typeInfoName)
191 return StatusCode::FAILURE;
220 CHECK( pIncSvc.retrieve() );
227 return StatusCode::SUCCESS;
235 return StatusCode::SUCCESS;
246 return StatusCode::RECOVERABLE;
250 const std::string& tiName =
m_clidMap[clid].second;
264 const ModuleLoadedIncident& modInc(
dynamic_cast<const ModuleLoadedIncident&
>(inc));
273 m_clidDBPath(System::getEnv(
"DATAPATH"))
281 std::vector<CLID>
ids;
284 ids.push_back (
p.first);
286 std::sort (
ids.begin(),
ids.end());
298 if (clidDB.is_absolute()) {
304 <<
" using DATAPATH. Skipping it." );
306 for (
const auto&
p :
paths) {
326 unsigned int newEntries(0);
329 while (allOK && std::getline(
ifile,
line)) {
330 std::vector<std::string>
columns;
337 }
catch (
const std::logic_error&
e) {
351 <<
"' from CLIDDB file: " <<
fileName );
354 " entries from CLIDDB file: " <<
fileName );
367 size_t newEntries(0);
382 <<
" CLIDRegistry entries for module " << moduleName );
384 ATH_MSG_ERROR(
"getRegistryEntries: can not read CLIDRegistry entries for module "
395 const std::string& typeInfoName)
401 if (procName.empty()) {
403 return StatusCode::FAILURE;
407 std::string procTiName;
408 if (typeInfoName.empty()) {
409 procTiName = procName;
412 procTiName = typeInfoName;
417 const auto& [clid_it, clid_success] =
m_clidMap.try_emplace(
id, procName, procTiName);
418 if (!clid_success && clid_it->second!=std::make_pair(procName,procTiName)) {
419 ATH_MSG_ERROR(
"Cannot set type " << std::make_pair(procName,procTiName) <<
" for CLID " <<
420 id <<
": known type for this ID " << clid_it->second );
421 return StatusCode::FAILURE;
425 const auto& [name_it, name_success] =
m_nameMap.try_emplace(procName,
id);
426 if (!name_success && name_it->second!=
id) {
427 ATH_MSG_ERROR(
"Cannot set CLID " <<
id <<
" for type name '"
428 << procName <<
"': known CLID for this name " << name_it->second );
429 return StatusCode::FAILURE;
433 const auto& [info_it, info_success] =
m_tiNameMap.try_emplace(procTiName,
id);
434 if (!info_success && info_it->second!=
id) {
435 ATH_MSG_ERROR(
"Cannot set CLID " <<
id <<
" for type-info name '"
436 << procTiName <<
"' and type '" << procName
437 <<
"': known CLID for this type-info name " << info_it->second );
438 return StatusCode::FAILURE;
441 ATH_MSG_VERBOSE(
"Set type name '" << procName <<
"' for CLID " <<
id <<
442 " with type-info name '" << procTiName <<
"'" );
444 return StatusCode::SUCCESS;
457 bool status =
nc->getRegistryEntries (
"ALL");
def finalize(self)
_info( "content of StoreGate..." ) self.sg.dump()
static CLIDVector_t newEntries()
returns an iterator range over the entries added since last time newEntries was called
path
python interpreter configuration --------------------------------------—
const unsigned long MINCLID
virtual StatusCode getTypeInfoNameOfID(const CLID &id, std::string &typeInfoName) const override
get user assigned type-info name associated with clID
#define ATH_MSG_VERBOSE(x)
virtual bool isIDInUse(const CLID &id) const override
check if id is used
const unsigned long MAXCLID
2**31 - 1
StatusCode fillDB()
get clids from CLIDDB and from registry entries
void dump() const
dump to MsgStream contents of in memory DB
#define ATH_CONST_MSG_VERBOSE(x)
void handle(const Incident &inc) override
implement IIncidentListener
virtual StatusCode finalize() override
dump CLIDmap to outputFileName;
DirSearchPath m_clidDBPath
The path is which clid db files are to be searched (DATAPATH)
virtual StatusCode getTypeNameOfID(const CLID &id, std::string &typeName) const override
get type name associated with clID (if any)
::StatusCode StatusCode
StatusCode definition for legacy code.
virtual StatusCode initialize() override
Gaudi Service Implementation.
static bool hasNewEntries()
registry accessors (used by ClassIDSvc)
virtual StatusCode setTypeForID(const CLID &id, const std::string &typeName, const std::string &typeInfoName="") override
associate type name, package info and type-info name with clID
#define CHECK(...)
Evaluate an expression and check for errors.
virtual bool isNameInUse(const std::string &name) const override
check if id is used
AthROOTErrorHandlerSvc * svc
bool getRegistryEntries(const std::string &moduleName)
load clid/names from a DLL registry
bool processCLIDDB(const std::string &fileName)
load clid/names from a "db" file
uint32_t CLID
The Class ID type.
virtual StatusCode reinitialize() override
#define TYPE(CODE, TYP, IOTYP)
Helpers for checking error return status codes and reporting errors.
ClassIDSvc(const std::string &name, ISvcLocator *svc)
Standard Constructor.
std::vector< CLID > sortedIDs() const
Return all registered IDs in sorted order.
bool maybeRescan() const
Test to see if anything new has been added to the registry.
a static registry of CLID->typeName entries. NOT for general use. Use ClassIDSvc instead.
#define ATH_MSG_WARNING(x)
StatusCode uncheckedSetTypePackageForID(const CLID &id, const std::string &typeName, const std::string &typeInfoName)
associate type name with clID w/o checking CLID range
Gaudi::Property< std::string > m_outputFileName
void trim(std::string &input)
a service to manage and verify CLID assignments in athena.
virtual CLID nextAvailableID() const override
get next available CLID
#define ATLAS_THREAD_SAFE
virtual StatusCode getIDOfTypeName(const std::string &typeName, CLID &id) const override
get id associated with type name (if any)
std::lock_guard< mutex_t > lock_t
Gaudi::Property< std::vector< std::string > > m_DBFiles
Define macros for attributes used to control the static checker.
a service to manage and verify CLID assignments in athena
virtual StatusCode getIDOfTypeInfoName(const std::string &typeInfoName, CLID &id) const override
get id associated with type-info name (if any)