10#include "GaudiKernel/IMessageSvc.h"
11#include "GaudiKernel/MsgStream.h"
12#include "GaudiKernel/ISvcLocator.h"
15#include "GaudiKernel/IClassIDSvc.h"
28 const std::string& name,
29 const IInterface* parent) :
30 base_class(
type, name, parent ),
46 std::vector< std::string >::const_iterator
52 assert( !item.empty() );
56 std::cout <<
"Folder::decodeItem("<< item<<
") called" << std::endl;
58 std::string::size_type sep(item.rfind(
'#'));
59 std::string typeName (item.substr(0,sep));
61 if (sep != std::string::npos) skey = item.substr(sep+1);
64 CLID clid(atoi(typeName.c_str()));
68 add(typeName, skey).ignore();
69 }
else add(clid, skey, checkValid,
false).ignore();
73Folder::add(
const std::string& typeName,
const std::string& skey) {
75 std::string tn = typeName;
76 if (tn.size() > 0 && tn[tn.size()-1] ==
'!') {
78 tn.erase (tn.end()-1);
85 if (
sc.isSuccess())
sc=
add(clid, skey,
false, exact);
87 MsgStream log(msgSvc(), name());
88 log << MSG::ERROR <<
"add: can not find type ["
89 << typeName <<
"] in clid db" <<
endmsg;
96 bool checkValid,
bool exact)
98 StatusCode
sc(StatusCode::FAILURE);
99 if ( !checkValid ||
m_pCLIDSvc->isIDInUse(clid) ) {
101 sc = StatusCode::SUCCESS;
102 }
else if (0 != clid) {
103 MsgStream log(msgSvc(), name());
104 log << MSG::ERROR <<
"add: can not find clid "
105 << clid <<
" in clid db" <<
endmsg;
108 std::cout <<
"SG::Folder::add(" << clid <<
",\"" << skey <<
"\") returns "
109 << (
sc.isSuccess() ?
"SUCCESS" :
"FAILURE") << std::endl;
a traits class that associates a CLID to a type T It also detects whether T inherits from Gaudi DataO...
uint32_t CLID
The Class ID type.
a run-time configurable list of data objects
Folder(const DbConnection &theConnection, const FolderSpec &theFolder)
a Folder item (data object) is identified by the clid/key pair
virtual StatusCode add(const std::string &typeName, const std::string &skey) override
add a data object identifier to the list.
virtual void updateItemList(bool checkValidCLID) override final
update contents of the ItemList
virtual ~Folder() override
void decodeItem(const std::string &item, bool checkValidCLID)
ServiceHandle< IClassIDSvc > m_pCLIDSvc
virtual StatusCode initialize() override
StringArrayProperty m_itemList