25 : m_objects(), m_keys() {
53 return (itr !=
m_objects.end() ? itr->second :
nullptr);
62 ::Warning(
"xAOD::TStore::remove",
63 "Couldn't find object with key \"%s\"",
65 return StatusCode::RECOVERABLE;
76 return StatusCode::SUCCESS;
84 for( ; itr !=
end; ++itr ) {
87 if( itr->second->get() !=
ptr ) {
95 return StatusCode::SUCCESS;
99 ::Warning(
"xAOD::TStore::remove",
100 "Couldn't find object with pointer %p",
102 return StatusCode::RECOVERABLE;
110 for( ; itr !=
end; ++itr ) {
126 ::Info(
"xAOD::TStore::print",
"Contents of transient store:" );
127 Objects_t::const_iterator itr =
m_objects.begin();
129 for( ; itr !=
end; ++itr ) {
130 ::Info(
"xAOD::TStore::print",
"-----------------------------------" );
131 ::Info(
"xAOD::TStore::print",
" Name: %s", itr->first.c_str() );
132 const ::TClass*
cl = itr->second->getClass();
133 const std::type_info* ti = itr->second->getTypeInfo();
134 ::Info(
"xAOD::TStore::print",
" Type: %s",
135 (
cl ?
cl->GetName() :
138 ::Info(
"xAOD::TStore::print",
" Pointer: %p",
139 itr->second->get() );
140 ::Info(
"xAOD::TStore::print",
" IsOwner: %s",
141 ( itr->second->isOwner() ?
"Yes" :
"No" ) );
142 ::Info(
"xAOD::TStore::print",
" IsConst: %s",
143 ( itr->second->isConst() ?
"Yes" :
"No" ) );
144 ::Info(
"xAOD::TStore::print",
" HasDictionary: %s",
145 (
cl ?
"Yes" :
"No" ) );
147 ::Info(
"xAOD::TStore::print",
"-----------------------------------" );
153 const std::type_info& ti )
const {
162 return itr->second->getAsConst( ti, kTRUE );
166 const std::type_info& ti )
const {
171 ::Warning(
"xAOD::TStore::isConst",
172 "Object with key \"%s\" not available in store",
178 if( ! itr->second->getAsConst( ti, kTRUE ) ) {
180 ::Warning(
"xAOD::TStore::isConst",
181 "Object with key \"%s\" can't be retrieved as type: %s",
188 return ( ! itr->second->getAs( ti, kTRUE ) );
192 const std::type_info& ti )
const {
200 if( itr->second->isConst() ) {
201 ::Error(
"xAOD::TStore::getObject",
202 XAOD_MESSAGE(
"Cannot retrieve object with key \"%s\" of type %s as non-const" ),
208 return itr->second->getAs( ti );
212 const std::type_info& ti )
const {
221 return itr->second->getAsConst( ti );
235 const std::string& classname,
236 ::Bool_t isOwner, ::Bool_t isConst ) {
239 using clCache_t = CxxUtils::ConcurrentStrMap<::TClass*, CxxUtils::SimpleUpdater>;
244 auto clItr = clMap.find( classname );
245 if( clItr != clMap.end() ) {
247 if( ( ! clItr->second ) || ( ! clItr->second->IsLoaded() ) ) {
248 return StatusCode::RECOVERABLE;
256 cl = ::TClass::GetClass( classname.c_str(), kTRUE, kTRUE );
257 clMap.emplace( classname,
cl );
259 if( ( !
cl ) || ( !
cl->IsLoaded() ) ) {
260 return StatusCode::RECOVERABLE;
265 ::Error(
"xAOD::TStore::record",
266 XAOD_MESSAGE(
"Trying to overwrite object with key \"%s\"" ),
268 return StatusCode::FAILURE;
278 return StatusCode::SUCCESS;
282 const std::type_info& ti,
283 ::Bool_t isOwner, ::Bool_t isConst ) {
287 ::Error(
"xAOD::TStore::record",
288 XAOD_MESSAGE(
"Trying to overwrite object with key \"%s\"" ),
290 return StatusCode::FAILURE;
300 return StatusCode::SUCCESS;
307 ::Error(
"xAOD::TStore::record",
308 XAOD_MESSAGE(
"Trying to overwrite object with key \"%s\"" ),
314 return StatusCode::FAILURE;
320 return StatusCode::SUCCESS;
346 Objects_t::const_iterator itr =
m_objects.begin();
348 for( ; itr !=
end; ++itr ) {
350 if( itr->second->get() ==
ptr ) {
369 HashedKeys_t::const_iterator itr =
m_keys.find(
hash );
370 if( itr !=
m_keys.end() ) {
376 ::Warning(
"xAOD::TStore::getName",
"Key 0x%08x not known by the store",
378 static const std::string
dummy(
"" );
393 Objects_t::const_iterator itr =
m_objects.begin();
395 for( ; itr !=
end; ++itr ) {
397 if( itr->second->get() ==
ptr ) {
403 ::Warning(
"xAOD::TStore::getName",
"Object %p is not held by the store",
405 static const std::string
dummy(
"" );
410 std::vector< std::string >& vkeys )
const {
411 std::set< std::string >
keys;
414 const std::string&
key = pair.first;
415 const ::TClass*
cl = pair.second->getClass();
416 const std::type_info* ti = pair.second->getTypeInfo();
427 vkeys.insert( vkeys.end(),
keys.begin(),
keys.end() );