Skip to content
Snippets Groups Projects
Commit 46bf8c07 authored by Vakhtang Tsulaia's avatar Vakhtang Tsulaia
Browse files

Merge branch 'numericCLID.CLIDComps-20190509' into 'master'

CLIDComps: Extend getIDOfTypeName() to handle numeric CLIDs.

See merge request atlas/athena!23307
parents 97885e63 98b9614d
No related branches found
No related tags found
No related merge requests found
......@@ -32,6 +32,15 @@ namespace {
boost::replace_all(s, string(";"), string());
}
bool tryNumeric (const std::string& s, CLID& clid)
{
clid = CLID_NULL;
char* endptr = nullptr;
clid = strtol (s.c_str(), &endptr, 10);
return clid != CLID_NULL && endptr == (s.c_str() + s.size());
}
// HACK LIFTED FROM AthenaBaseComps/AthMsgStreamMacros.h to remove dep loop
#define ATH_MSG_LVL(lvl, x) \
do { \
......@@ -358,6 +367,10 @@ ClassIDSvc::getIDOfTypeNameInternal(const std::string& typeName, CLID& id) const
ATH_CONST_MSG_VERBOSE( "getIDOfTypeName(" << typeName << ") CLID is " << id);
sc = StatusCode::SUCCESS;
}
else if (tryNumeric (typeName, id)) {
ATH_CONST_MSG_VERBOSE( "getIDOfTypeName(" << typeName << ") is a numeric CLID");
sc = StatusCode::SUCCESS;
}
else {
ATH_CONST_MSG_VERBOSE( "getIDOfTypeName(" << typeName << ") no associated CLID found " );
}
......
......@@ -105,6 +105,8 @@ void basic_test(ISvcLocator* pSvcLoc) {
assert(pClassIDSvc->getIDOfTypeName("Blu", id).isSuccess());
assert(id == 9943);
assert(pClassIDSvc->getIDOfTypeName("NotExist", id).isFailure());
assert(pClassIDSvc->getIDOfTypeName("12345", id).isSuccess());
assert(id == 12345);
assert(pClassIDSvc->isIDInUse(9942));
// assert(!pClassIDSvc->isIDInUse(9945));
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment