ATLAS Offline Software
AuxTypeRegistry.cxx
Go to the documentation of this file.
1 /*
2  Copyright (C) 2002-2024 CERN for the benefit of the ATLAS collaboration
3 */
17 #include <cassert>
18 #include <sstream>
19 #include <cstring>
20 
21 
22 namespace SG {
23 
24 
29 bool AuxTypeRegistry::typeinfo_t::checkAlloc (const std::type_info* ti_alloc,
30  const std::string* alloc_name) const
31 {
32  if (ti_alloc && m_ti_alloc) {
33  if (ti_alloc == m_ti_alloc) return true;
34  return strcmp (ti_alloc->name(), m_ti_alloc->name()) == 0;
35  }
36  if (alloc_name) {
37  return *alloc_name == m_alloc_name;
38  }
39  if (ti_alloc) {
40  return SG::normalizedTypeinfoName (*ti_alloc) == m_alloc_name;
41  }
42  return true;
43 }
44 
45 
50 {
51  static AuxTypeRegistry auxTypeRegistry ATLAS_THREAD_SAFE;
52  return auxTypeRegistry;
53 }
54 
55 
62 {
63  return m_types.size();
64 }
65 
66 
80 SG::auxid_t AuxTypeRegistry::getAuxID (const std::type_info& ti,
81  const std::string& name,
82  const std::string& clsname /*= ""*/,
83  const Flags flags /*= Flags::None*/)
84 {
85  return findAuxID (name, clsname, flags, ti, nullptr, nullptr,
87 }
88 
89 
104 SG::auxid_t AuxTypeRegistry::getAuxID (const std::type_info& ti_alloc,
105  const std::type_info& ti,
106  const std::string& name,
107  const std::string& clsname /*= ""*/,
108  const Flags flags /*= Flags::None*/)
109 {
110  return findAuxID (name, clsname, flags, ti, &ti_alloc, nullptr,
112 }
113 
114 
129 SG::auxid_t AuxTypeRegistry::getAuxID (const std::string& alloc_type,
130  const std::type_info& ti,
131  const std::string& name,
132  const std::string& clsname /*= ""*/,
133  const Flags flags /*= Flags::None*/)
134 {
135  return findAuxID (name, clsname, flags, ti, nullptr, &alloc_type,
137 }
138 
139 
150 AuxTypeRegistry::findAuxID( const std::string& name,
151  const std::string& clsname ) const
152 {
153  // No locking needed here.
154  // The extra test here is to avoid having to copy a string
155  // in the common case where clsname is blank.
156  id_map_t::const_iterator i = m_auxids.find (clsname.empty() ?
157  name :
158  makeKey (name, clsname));
159  if (i != m_auxids.end()) {
160  return i->second;
161  }
162  return null_auxid;
163 }
164 
165 
178  const std::type_info& ti,
179  const std::type_info& ti_alloc,
180  const Flags flags)
181 {
182  typeinfo_t& m = m_types.at (auxid);
183 
184  if ( ! ((&ti == m.m_ti || strcmp(ti.name(), m.m_ti->name()) == 0) &&
185  m.checkAlloc (&ti_alloc, nullptr)))
186  {
187  throw SG::ExcAuxTypeMismatch (auxid, ti, *m.m_ti,
188  SG::normalizedTypeinfoName (ti_alloc),
189  m.m_alloc_name);
190  }
191  if (CxxUtils::test (m.m_flags, Flags::Atomic) &&
193  {
194  throw SG::ExcAtomicMismatch (auxid, ti);
195  }
196 }
197 
198 
205 std::unique_ptr<IAuxTypeVector>
207  size_t size,
208  size_t capacity) const
209 {
210  const SG::IAuxTypeVectorFactory* factory = getFactory (auxid);
211  assert (factory != 0);
212  return factory->create (auxid, size, capacity);
213 }
214 
215 
230 std::unique_ptr<IAuxTypeVector>
232  void* data,
233  bool isPacked,
234  bool ownMode) const
235 {
236  const SG::IAuxTypeVectorFactory* factory = getFactory (auxid);
237  assert (factory != 0);
238  return factory->createFromData (auxid, data, isPacked, ownMode);
239 }
240 
241 
247 std::string AuxTypeRegistry::makeKey (const std::string& name,
248  const std::string& clsname)
249 {
250  if (clsname.empty()) {
251  return name;
252  }
253  return clsname + "::" + name;
254 }
255 
256 
257 
262 std::string AuxTypeRegistry::getName (SG::auxid_t auxid) const
263 {
264  if (auxid >= m_types.size())
265  return "";
266  return m_types[auxid].m_name;
267 }
268 
269 
276 {
277  if (auxid >= m_types.size())
278  return "";
279  return m_types[auxid].m_clsname;
280 }
281 
282 
287 const std::type_info* AuxTypeRegistry::getType (SG::auxid_t auxid) const
288 {
289  if (auxid >= m_types.size())
290  return 0;
291  return m_types[auxid].m_ti;
292 }
293 
294 
301 std::string AuxTypeRegistry::getTypeName (SG::auxid_t auxid) const
302 {
303  if (auxid >= m_types.size())
304  return "";
305  return normalizedTypeinfoName (*m_types[auxid].m_ti);
306 }
307 
308 
313 const std::type_info* AuxTypeRegistry::getVecType (SG::auxid_t auxid) const
314 {
315  const SG::IAuxTypeVectorFactory* factory = getFactory (auxid);
316  if (factory)
317  return factory->tiVec();
318  return 0;
319 }
320 
321 
329 {
330  const SG::IAuxTypeVectorFactory* factory = getFactory (auxid);
331  if (factory)
332  return normalizedTypeinfoName (*factory->tiVec());
333  return "";
334 }
335 
336 
341 const std::type_info* AuxTypeRegistry::getAllocType (SG::auxid_t auxid) const
342 {
343  if (auxid >= m_types.size())
344  return 0;
345  return m_types[auxid].m_ti_alloc;
346 }
347 
348 
354 {
355  const SG::IAuxTypeVectorFactory* factory = getFactory (auxid);
356  if (factory)
357  return factory->getEltSize();
358  return 0;
359 }
360 
361 
374  AuxVectorData& dst, size_t dst_index,
375  const AuxVectorData& src, size_t src_index,
376  size_t n) const
377 {
378  const SG::IAuxTypeVectorFactory* factory = getFactory (auxid);
379  if (factory)
380  factory->copy (auxid, dst, dst_index, src, src_index, n);
381 }
382 
383 
397  AuxVectorData& dst, size_t dst_index,
398  const AuxVectorData& src, size_t src_index,
399  size_t n) const
400 {
401  const SG::IAuxTypeVectorFactory* factory = getFactory (auxid);
402  if (factory) {
403  factory->copyForOutput (auxid, dst, dst_index, src, src_index, n);
404  }
405 }
406 
407 
421  AuxVectorData& a, size_t aindex,
422  AuxVectorData& b, size_t bindex,
423  size_t n) const
424 {
425  const SG::IAuxTypeVectorFactory* factory = getFactory (auxid);
426  if (factory)
427  factory->swap (auxid, a, aindex, b, bindex, n);
428 }
429 
430 
439  AuxVectorData& dst, size_t dst_index,
440  size_t n) const
441 {
442  const SG::IAuxTypeVectorFactory* factory = getFactory (auxid);
443  if (factory)
444  factory->clear (auxid, dst, dst_index, n);
445 }
446 
447 
457 AuxTypeRegistry::getFactory (const std::type_info& ti,
458  const std::type_info& ti_alloc)
459 {
460  lock_t lock (m_mutex);
461  return getFactory (lock, ti, ti_alloc);
462 }
463 
464 
477  const std::type_info& ti,
478  const std::type_info& ti_alloc)
479 {
480  std::string key = std::string (ti.name()) + ";TI;" + ti_alloc.name();
481  ti_map_t::const_iterator it = m_factories.find (key);
482  if (it != m_factories.end())
483  return it->second;
484 
485  std::string name = SG::normalizedTypeinfoName (ti_alloc);
486  const IAuxTypeVectorFactory* fac = getFactory (ti, name);
487  if (fac) {
488  // We only really need to be holding the lock here, but doing things
489  // otherwise would require some code duplication.
490  addFactory (lock, ti, ti_alloc, fac);
491  }
492  return fac;
493 }
494 
495 
505 AuxTypeRegistry::getFactory (const std::type_info& ti,
506  const std::string& alloc_name)
507 {
508  std::string key = std::string (ti.name()) + ";" + alloc_name;
509  ti_map_t::const_iterator it = m_factories.find (key);
510  if (it != m_factories.end()) {
511  return it->second;
512  }
513 
514  return nullptr;
515 }
516 
517 
530 AuxTypeRegistry::addFactory (const std::type_info& ti,
531  const std::type_info& ti_alloc,
532  std::unique_ptr<const IAuxTypeVectorFactory> factory)
533 {
534  lock_t lock (m_mutex);
535  std::string name = SG::normalizedTypeinfoName (ti_alloc);
536  const IAuxTypeVectorFactory* fac =
537  addFactory (lock, ti, name, std::move(factory));
538  return addFactory (lock, ti, ti_alloc, fac);
539 }
540 
541 
554 AuxTypeRegistry::addFactory (const std::type_info& ti,
555  const std::string& ti_alloc_name,
556  std::unique_ptr<const IAuxTypeVectorFactory> factory)
557 {
558  lock_t lock (m_mutex);
559  return addFactory (lock, ti, ti_alloc_name, std::move (factory));
560 }
561 
562 
577  const std::type_info& ti,
578  const std::type_info& ti_alloc,
579  const IAuxTypeVectorFactory* factory)
580 {
581  std::string key = std::string (ti.name()) + ";TI;" + ti_alloc.name();
582  ti_map_t::const_iterator it = m_factories.find (key);
583  if (it != m_factories.end()) {
584  if (it->second->isDynamic() && !factory->isDynamic()) {
585  // Replacing a dynamic factory with a non-dynamic one.
586  // The string version should put it to m_oldFactories.
587  m_factories.insert_or_assign (key, factory);
588  }
589  else {
590  factory = it->second;
591  }
592  }
593  else
594  m_factories.insert_or_assign (key, factory);
595 
598  {
599  m_allocMap.insert_or_assign (ti.name(), &ti_alloc);
600  }
601 
602  return factory;
603 }
604 
605 
620  const std::type_info& ti,
621  const std::string& ti_alloc_name,
622  std::unique_ptr<const IAuxTypeVectorFactory> factory)
623 {
624  std::string key = std::string (ti.name()) + ";" + ti_alloc_name;
625  ti_map_t::const_iterator it = m_factories.find (key);
626  const IAuxTypeVectorFactory* fac = factory.get();
627  if (it != m_factories.end()) {
628  if (it->second->isDynamic() && !factory->isDynamic()) {
629  // Replacing a dynamic factory with a non-dynamic one.
630  // But don't delete the old one, since it might still be referenced.
631  // Instead, push it on a vector to remember it so we can delete
632  // it later.
633  m_oldFactories.push_back (it->second);
634  m_factories.insert_or_assign (key, factory.release());
635  }
636  else {
637  fac = it->second;
638  }
639  }
640  else
641  m_factories.insert_or_assign (key, factory.release());
642 
643  // cppcheck-suppress returnDanglingLifetime; false positive
644  return fac;
645 }
646 
647 
654  : m_auxids (id_map_t::Updater_t()),
655  m_factories (ti_map_t::Updater_t()),
656  m_allocMap (allocMap_t::Updater_t())
657 {
658  m_types.reserve (auxid_set_size_hint);
659 
660  // Make sure we have factories registered for common C++ types.
661 #define ADD_FACTORY(T) addFactory(typeid(T), typeid(AuxAllocator_t<T>), std::make_unique<AuxTypeVectorFactory<T> >())
662  ADD_FACTORY (bool);
663  ADD_FACTORY (char);
664  ADD_FACTORY (unsigned char);
665  ADD_FACTORY (short);
666  ADD_FACTORY (unsigned short);
667  ADD_FACTORY (int);
668  ADD_FACTORY (unsigned int);
669  ADD_FACTORY (long);
670  ADD_FACTORY (unsigned long);
671  ADD_FACTORY (long long);
672  ADD_FACTORY (unsigned long long);
673  ADD_FACTORY (float);
674  ADD_FACTORY (double);
675  ADD_FACTORY (std::string);
676 
677  ADD_FACTORY (std::vector<char>);
678  ADD_FACTORY (std::vector<unsigned char>);
679  ADD_FACTORY (std::vector<int>);
680  ADD_FACTORY (std::vector<unsigned int>);
681  ADD_FACTORY (std::vector<float>);
682  ADD_FACTORY (std::vector<double>);
683 #undef ADD_FACTORY
684 }
685 
686 
693 {
694  // not using reference, because our iterator doesn't return a reference
695  for (auto p : m_factories) {
696  if (p.first.find (";TI;") == std::string::npos) {
697  delete p.second;
698  }
699  }
700  for (const IAuxTypeVectorFactory* p : m_oldFactories)
701  delete p;
702 }
703 
704 
729 AuxTypeRegistry::findAuxID (const std::string& name,
730  const std::string& clsname,
731  const Flags flags,
732  const std::type_info& ti,
733  const std::type_info* ti_alloc,
734  const std::string* alloc_name,
735  std::unique_ptr<IAuxTypeVectorFactory> (AuxTypeRegistry::*makeFactory) () const)
736 {
737 
738  // The extra test here is to avoid having to copy a string
739  // in the common case where clsname is blank.
740  const std::string& key = clsname.empty() ? name : makeKey (name, clsname);
741 
742 
743  // Fast path --- try without acquiring the lock.
744  {
745  id_map_t::const_iterator i = m_auxids.find (key);
746  if (i != m_auxids.end()) {
747  typeinfo_t& m = m_types[i->second];
748  if (!(CxxUtils::test (m.m_flags, Flags::Atomic) &&
750  (&ti == m.m_ti || strcmp(ti.name(), m.m_ti->name()) == 0) &&
751  m.checkAlloc (ti_alloc, alloc_name) &&
752  !(*m.m_factory).isDynamic())
753  {
754  return i->second;
755  }
756  }
757  }
758 
759  // Something went wrong. Acquire the lock and try again.
760  lock_t lock (m_mutex);
761  id_map_t::const_iterator i = m_auxids.find (key);
762  if (i != m_auxids.end()) {
763  typeinfo_t& m = m_types[i->second];
764 
765  if (CxxUtils::test (m.m_flags, Flags::Atomic) &&
767  {
768  throw SG::ExcAtomicMismatch (i->second, ti);
769  }
770 
771  // By all rights, these two tests should be redundant.
772  // However, there are cases where we see distinct @c type_info objects
773  // for the same type. This is usually associated with dictionaries
774  // being loaded `too early,' during python configuration processing.
775  // It's a C++ standard violation for this to ever happen, but it's
776  // not clear that it's feasible to actually eliminate the possibility
777  // of this happening. So if the @c type_info instances differ,
778  // we still accept the match as long as the names are the same.
779  if ((&ti == m.m_ti || strcmp(ti.name(), m.m_ti->name()) == 0) &&
780  m.checkAlloc (ti_alloc, alloc_name))
781  {
782  // Try to upgrade a dynamic factory.
783  if ((*m.m_factory).isDynamic()) {
784  std::unique_ptr<IAuxTypeVectorFactory> fac2 = (*this.*makeFactory)();
785  if (fac2) {
786  if (!ti_alloc) {
787  ti_alloc = fac2->tiAlloc();
788  }
789  std::string allocName = fac2->tiAllocName();
790  m.m_factory = addFactory (lock, ti, allocName, std::move (fac2));
791  if (ti_alloc) {
792  m.m_factory = addFactory (lock, ti, *ti_alloc, m.m_factory);
793  }
794  }
795  }
796  return i->second;
797  }
798  if( *m.m_ti != typeid(SG::AuxTypePlaceholder) ) {
799  throw SG::ExcAuxTypeMismatch (i->second, ti, *m.m_ti,
800  ti_alloc ? SG::normalizedTypeinfoName (*ti_alloc) : (alloc_name ? *alloc_name : ""),
801  m.m_alloc_name);
802  }
803  // fall through, get a new auxid and real type info
804  // new auxid needed so a new data vector is created in the AuxStore
805  }
806 
807  // Verify now that the variable names are ok.
808  if (!(flags & Flags::SkipNameCheck) &&
809  (!checkName (name) ||
810  (!clsname.empty() && !checkName (clsname))))
811  {
812  throw ExcBadVarName (key);
813  }
814 
815  const IAuxTypeVectorFactory* fac = nullptr;
816  if (ti_alloc) {
817  fac = getFactory (lock, ti, *ti_alloc);
818  }
819  else if (alloc_name) {
820  fac = getFactory (ti, *alloc_name);
821  }
822  else {
823  std::string def_alloc_name = SG::auxAllocatorNamePrefix + SG::normalizedTypeinfoName (ti);
824  if (def_alloc_name[def_alloc_name.size()-1] == '>') def_alloc_name += " ";
825  def_alloc_name += ">";
826  fac = getFactory (ti,def_alloc_name);
827  }
828 
829  if (!fac || fac->isDynamic()) {
830  std::unique_ptr<IAuxTypeVectorFactory> fac2 = (*this.*makeFactory)();
831  if (fac2) {
832  if (!ti_alloc) {
833  ti_alloc = fac2->tiAlloc();
834  }
835  std::string allocName = fac2->tiAllocName();
836  fac = addFactory (lock, ti, allocName, std::move (fac2));
837  if (ti_alloc) {
838  fac = addFactory (lock, ti, *ti_alloc, fac);
839  }
840  }
841  }
842  if (!fac) return null_auxid;
843  if (!ti_alloc) ti_alloc = fac->tiAlloc();
844  SG::auxid_t auxid = m_types.size();
845  m_types.resize (auxid+1);
846  typeinfo_t& t = m_types[auxid];
847  t.m_name = name;
848  t.m_clsname = clsname;
849  t.m_ti = &ti;
850  t.m_ti_alloc = ti_alloc;
851  t.m_alloc_name = fac->tiAllocName();
852  t.m_factory = fac;
853  t.m_flags = (flags & ~Flags::SkipNameCheck);
855  m_auxids.insert_or_assign (key, auxid);
856 
857  return auxid;
858 }
859 
860 
861 #ifndef XAOD_STANDALONE
862 
872 void
874  const IStringPool& pool)
875 {
876  lock_t lock (m_mutex);
877  m_renameMap.clear();
878  if (!map) return;
879  for (const auto& p : *map) {
880  sgkey_t from_sgkey = p.first;
881  sgkey_t to_sgkey = p.second.m_sgkey;
882 
883  const std::string* from_str = pool.keyToString (from_sgkey);
884  if (!from_str) continue;
885  std::string::size_type from_dpos = from_str->find (".");
886  if (from_dpos == std::string::npos || from_dpos == from_str->size()-1) continue;
887 
888  const std::string* to_str = pool.keyToString (to_sgkey);
889  if (!to_str) continue;
890  std::string::size_type to_dpos = to_str->find (".");
891  if (to_dpos == std::string::npos || to_dpos == to_str->size()-1) continue;
892 
893  m_renameMap[*from_str] = to_str->substr (to_dpos+1, std::string::npos);
894  }
895 }
896 #endif
897 
898 
907 const std::string& AuxTypeRegistry::inputRename (const std::string& key,
908  const std::string& name) const
909 {
910  lock_t lock (m_mutex);
911  if (m_renameMap.empty())
912  return name;
913 
914  std::string fullkey = key + "." + name;
915  renameMap_t::const_iterator it = m_renameMap.find (fullkey);
916  if (it != m_renameMap.end())
917  return it->second;
918  return name;
919 }
920 
921 
929 bool AuxTypeRegistry::checkName (const std::string& s)
930 {
931  static const std::string chars1 = "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ_";
932  static const std::string chars2 = chars1 + "0123456789";
933 
934  if (s.empty()) return false;
935  if (chars1.find (s[0]) == std::string::npos) return false;
936  return s.find_first_not_of (chars2, 1) == std::string::npos;
937 }
938 
939 
940 } // namespace SG
941 
942 
SG::AuxTypeRegistry::getFactory
const IAuxTypeVectorFactory * getFactory(const std::type_info &ti, const std::type_info &ti_alloc)
Return the vector factory for a given vector element type.
Definition: AuxTypeRegistry.cxx:457
SG::AuxTypeRegistry::allocMap_t
CxxUtils::ConcurrentStrMap< const std::type_info *, CxxUtils::SimpleUpdater > allocMap_t
Definition: AuxTypeRegistry.h:701
SG::AuxTypeRegistry::m_allocMap
allocMap_t m_allocMap
Definition: AuxTypeRegistry.h:702
data
char data[hepevt_bytes_allocation_ATLAS]
Definition: HepEvt.cxx:11
IStringPool
Abstract interface for looking up strings/CLIDs in a pool.
Definition: IStringPool.h:28
SG::AuxTypeRegistry::makeVectorFromData
std::unique_ptr< IAuxTypeVector > makeVectorFromData(SG::auxid_t auxid, void *data, bool isPacked, bool ownFlag) const
Construct an IAuxTypeVector object from a vector.
Definition: AuxTypeRegistry.cxx:231
python.SystemOfUnits.s
int s
Definition: SystemOfUnits.py:131
CxxUtils::starts_with
bool starts_with(const char *s, const char *prefix)
Test whether one null-terminated byte string starts with another.
SG::AuxTypeRegistry::addFactory
const IAuxTypeVectorFactory * addFactory(const std::type_info &ti, const std::type_info &ti_alloc, std::unique_ptr< const IAuxTypeVectorFactory > factory)
Add a new type -> factory mapping.
Definition: AuxTypeRegistry.cxx:530
python.SystemOfUnits.m
int m
Definition: SystemOfUnits.py:91
SG::AuxTypeRegistry::typeinfo_t::m_ti_alloc
const std::type_info * m_ti_alloc
Type of the vector allocator. May be null for a dynamic type;.
Definition: AuxTypeRegistry.h:648
python.PerfMonSerializer.p
def p
Definition: PerfMonSerializer.py:743
SG::AuxTypeRegistry::getAuxID
SG::auxid_t getAuxID(const std::string &name, const std::string &clsname="", const Flags flags=Flags::None)
Look up a name -> auxid_t mapping.
SG::AuxTypeRegistry::m_oldFactories
std::vector< const IAuxTypeVectorFactory * > m_oldFactories
Hold additional factory instances we need to delete.
Definition: AuxTypeRegistry.h:683
SG
Forward declaration.
Definition: CaloCellPacker_400_500.h:32
SG::SkipNameCheck
@ SkipNameCheck
Definition: AuxTypes.h:74
SG::IAuxTypeVectorFactory::getEltSize
virtual size_t getEltSize() const =0
Return the size of an element of this vector type.
SG::AuxTypeRegistry::instance
static AuxTypeRegistry & instance()
Return the singleton registry instance.
Definition: AuxTypeRegistry.cxx:49
SG::AuxTypeRegistry::findAuxID
SG::auxid_t findAuxID(const std::string &name, const std::string &clsname="") const
Look up a name -> auxid_t mapping.
Definition: AuxTypeRegistry.cxx:150
WriteCellNoiseToCool.src
src
Definition: WriteCellNoiseToCool.py:513
SG::normalizedTypeinfoName
std::string normalizedTypeinfoName(const std::type_info &info)
Convert a type_info to a normalized string representation (matching the names used in the root dictio...
Definition: normalizedTypeinfoName.cxx:120
SG::AuxTypeRegistry::setInputRenameMap
void setInputRenameMap(const Athena::IInputRename::InputRenameMap_t *map, const IStringPool &pool)
Declare input renaming requests.
Definition: AuxTypeRegistry.cxx:873
AthenaPoolTestRead.flags
flags
Definition: AthenaPoolTestRead.py:8
SG::AuxTypeRegistry::lock_t
AthContainers_detail::lock_guard< mutex_t > lock_t
Definition: AuxTypeRegistry.h:488
SG::AuxTypeRegistry::makeKey
static std::string makeKey(const std::string &name, const std::string &clsname)
Return the key used to look up an entry in m_auxids.
Definition: AuxTypeRegistry.cxx:247
SG::AuxTypeRegistry::getName
std::string getName(SG::auxid_t auxid) const
Return the name of an aux data item.
Definition: AuxTypeRegistry.cxx:262
SG::AuxTypeRegistry::getVecTypeName
std::string getVecTypeName(SG::auxid_t auxid) const
Return the type of the STL vector used to hold an aux data item.
Definition: AuxTypeRegistry.cxx:328
pool
pool namespace
Definition: libname.h:15
exceptions.h
Exceptions that can be thrown from AthContainers.
skel.it
it
Definition: skel.GENtoEVGEN.py:424
SG::IAuxTypeVectorFactory::clear
virtual void clear(SG::auxid_t auxid, AuxVectorData &dst, size_t dst_index, size_t n) const =0
Clear a range of elements within a vector.
SG::AuxTypeRegistry::inputRename
const std::string & inputRename(const std::string &key, const std::string &name) const
Check for an input renaming of an auxiliary variable.
Definition: AuxTypeRegistry.cxx:907
SG::AuxTypeRegistry::getAllocType
const std::type_info * getAllocType(SG::auxid_t auxid) const
Return the type of the vector allocator.
Definition: AuxTypeRegistry.cxx:341
SG::IAuxTypeVectorFactory::create
virtual std::unique_ptr< IAuxTypeVector > create(SG::auxid_t auxid, size_t size, size_t capacity) const =0
Create a vector object of this type.
ADD_FACTORY
#define ADD_FACTORY(T)
SG::AuxTypeRegistry::ti_map_t
CxxUtils::ConcurrentStrMap< const IAuxTypeVectorFactory *, CxxUtils::SimpleUpdater > ti_map_t
Map from type_info name + allocator ti name -> IAuxTypeVectorFactory.
Definition: AuxTypeRegistry.h:679
read_hist_ntuple.t
t
Definition: read_hist_ntuple.py:5
SG::AuxTypeRegistry::m_types
AthContainers_detail::concurrent_vector< typeinfo_t > m_types
Table of aux data items, indexed by auxid.
Definition: AuxTypeRegistry.h:671
SG::AuxTypeRegistry::AuxTypeRegistry
AuxTypeRegistry()
Constructor.
Definition: AuxTypeRegistry.cxx:653
SG::AuxTypeRegistry::copyForOutput
void copyForOutput(SG::auxid_t auxid, AuxVectorData &dst, size_t dst_index, const AuxVectorData &src, size_t src_index, size_t n) const
Copy elements between vectors.
Definition: AuxTypeRegistry.cxx:396
AthContainers_detail::fence_seq_cst
void fence_seq_cst()
A sequentially-consistent fence.
SG::AuxTypeRegistry::~AuxTypeRegistry
~AuxTypeRegistry()
Destructor.
Definition: AuxTypeRegistry.cxx:692
SG::IAuxTypeVectorFactory::tiAllocName
virtual std::string tiAllocName() const =0
Return the (demangled) name of the vector allocator.
SG::AuxTypeRegistry
Handle mappings between names and auxid_t.
Definition: AuxTypeRegistry.h:62
SG::IAuxTypeVectorFactory::swap
virtual void swap(SG::auxid_t auxid, AuxVectorData &a, size_t aindex, AuxVectorData &b, size_t bindex, size_t n) const =0
Swap elements between vectors.
python.setupRTTAlg.size
int size
Definition: setupRTTAlg.py:39
SG::auxid_t
size_t auxid_t
Identifier for a particular aux data item.
Definition: AuxTypes.h:27
SG::AuxTypeRegistry::getType
const std::type_info * getType(SG::auxid_t auxid) const
Return the type of an aux data item.
Definition: AuxTypeRegistry.cxx:287
SG::AuxTypeRegistry::m_factories
ti_map_t m_factories
Definition: AuxTypeRegistry.h:680
SG::AuxTypeRegistry::swap
void swap(SG::auxid_t auxid, AuxVectorData &a, size_t aindex, AuxVectorData &b, size_t bindex, size_t n) const
Swap elements between vectors.
Definition: AuxTypeRegistry.cxx:420
SG::AuxTypeRegistry::getTypeName
std::string getTypeName(SG::auxid_t auxid) const
Return the type name of an aux data item.
Definition: AuxTypeRegistry.cxx:301
lumiFormat.i
int i
Definition: lumiFormat.py:92
beamspotman.n
n
Definition: beamspotman.py:731
SG::IAuxTypeVectorFactory
Interface for factory objects that create vectors.
Definition: IAuxTypeVectorFactory.h:50
SG::IAuxTypeVectorFactory::copyForOutput
virtual void copyForOutput(SG::auxid_t auxid, AuxVectorData &dst, size_t dst_index, const AuxVectorData &src, size_t src_index, size_t n) const =0
Copy elements between vectors, possibly applying thinning.
SG::IAuxTypeVectorFactory::tiAlloc
virtual const std::type_info * tiAlloc() const =0
Return the type_info of the vector allocator.
SG::AuxTypeRegistry::getEltSize
size_t getEltSize(SG::auxid_t auxid) const
Return size of an element in the STL vector.
Definition: AuxTypeRegistry.cxx:353
SG::AuxTypeRegistry::makeFactory
std::unique_ptr< IAuxTypeVectorFactory > makeFactory() const
Create an AuxTypeVectorFactory instance.
error.h
Helper for emitting error messages.
SG::AuxTypePlaceholder
Used as type_info when we read an aux data item but it doesn't exist in the registry.
Definition: AuxTypes.h:34
SG::IAuxTypeVectorFactory::copy
virtual void copy(SG::auxid_t auxid, AuxVectorData &dst, size_t dst_index, const AuxVectorData &src, size_t src_index, size_t n) const =0
Copy elements between vectors.
SG::AuxTypeRegistry::getVecType
const std::type_info * getVecType(SG::auxid_t auxid) const
Return the type of the STL vector used to hold an aux data item.
Definition: AuxTypeRegistry.cxx:313
SG::AuxTypeRegistry::numVariables
size_t numVariables() const
Return the total number of registered auxiliary variable.
Definition: AuxTypeRegistry.cxx:61
SG::AuxVarFlags
AuxVarFlags
Additional flags to qualify an auxiliary variable.
Definition: AuxTypes.h:58
SG::AuxTypeRegistry::clear
void clear(SG::auxid_t auxid, AuxVectorData &dst, size_t dst_index, size_t n) const
Clear a range of elements within a vector.
Definition: AuxTypeRegistry.cxx:438
normalizedTypeinfoName.h
Convert a type_info to a normalized string representation (matching the names used in the root dictio...
SG::AuxTypeRegistry::getClassName
std::string getClassName(SG::auxid_t auxid) const
Return the class name associated with an aux data item (may be blank).
Definition: AuxTypeRegistry.cxx:275
CxxUtils::test
constexpr std::enable_if_t< is_bitmask_v< E >, bool > test(E lhs, E rhs)
Convenience function to test bits in a class enum bitmask.
Definition: bitmask.h:262
SG::IAuxTypeVectorFactory::isDynamic
virtual bool isDynamic() const =0
True if the vectors created by this factory work by dynamic emulation (via TVirtualCollectionProxy or...
SG::AuxTypeRegistry::makeVector
std::unique_ptr< IAuxTypeVector > makeVector(SG::auxid_t auxid, size_t size, size_t capacity) const
Construct a new vector to hold an aux item.
Definition: AuxTypeRegistry.cxx:206
name
std::string name
Definition: Control/AthContainers/Root/debug.cxx:192
plotBeamSpotMon.b
b
Definition: plotBeamSpotMon.py:77
SG::IAuxTypeVectorFactory::tiVec
virtual const std::type_info * tiVec() const =0
Return the type_info of the vector.
SG::sgkey_t
uint32_t sgkey_t
Type used for hashed StoreGate key+CLID pairs.
Definition: CxxUtils/CxxUtils/sgkey_t.h:32
SG::AuxTypeRegistry::checkAuxID
void checkAuxID(const SG::auxid_t auxid, const Flags flags=Flags::None)
Verify type for an aux variable.
SG::AuxTypeRegistry::typeinfo_t
Hold information about one aux data item.
Definition: AuxTypeRegistry.h:640
SG::AuxTypeRegistry::m_mutex
mutex_t m_mutex
Mutex controlling access to the registry.
Definition: AuxTypeRegistry.h:696
SG::Atomic
@ Atomic
Mark that this variable should only be accessed atomically.
Definition: AuxTypes.h:70
SG::AuxTypeRegistry::checkName
static bool checkName(const std::string &s)
Check for valid variable name.
Definition: AuxTypeRegistry.cxx:929
a
TList * a
Definition: liststreamerinfos.cxx:10
SG::AuxTypeRegistry::makeFactoryNull
std::unique_ptr< IAuxTypeVectorFactory > makeFactoryNull() const
makeFactory implementation that always returns nullptr.
SG::IAuxTypeVectorFactory::createFromData
virtual std::unique_ptr< IAuxTypeVector > createFromData(SG::auxid_t auxid, void *data, bool isPacked, bool ownFlag) const =0
Create a vector object of this type from a data blob.
SG::AuxTypeRegistry::id_map_t
CxxUtils::ConcurrentStrMap< SG::auxid_t, CxxUtils::SimpleUpdater > id_map_t
Map from name -> auxid.
Definition: AuxTypeRegistry.h:675
SG::ExcAtomicMismatch
Exception — Non-atomic access to atomic aux variable.
Definition: Control/AthContainers/AthContainers/exceptions.h:376
AuxTypeRegistry.h
Handle mappings between names and auxid_t.
SG::AuxTypeRegistry::typeinfo_t::m_alloc_name
std::string m_alloc_name
Name of the vector allocator.
Definition: AuxTypeRegistry.h:651
SG::AuxVectorData
Manage lookup of vectors of auxiliary data.
Definition: AuxVectorData.h:167
ATLAS_THREAD_SAFE
#define ATLAS_THREAD_SAFE
Definition: checker_macros.h:211
checker_macros.h
Define macros for attributes used to control the static checker.
Athena::IInputRename::InputRenameMap_t
SG::SGKeyMap< Rename > InputRenameMap_t
Definition: IInputRename.h:45
SG::AuxTypeRegistry::copy
void copy(SG::auxid_t auxid, AuxVectorData &dst, size_t dst_index, const AuxVectorData &src, size_t src_index, size_t n) const
Copy elements between vectors.
Definition: AuxTypeRegistry.cxx:373
SG::ExcAuxTypeMismatch
Exception — Type mismatch for aux variable.
Definition: Control/AthContainers/AthContainers/exceptions.h:132
SG::ExcBadVarName
Exception — Bad name for auxiliary variable.
Definition: Control/AthContainers/AthContainers/exceptions.h:456
SG::AuxTypeRegistry::m_renameMap
renameMap_t m_renameMap
Definition: AuxTypeRegistry.h:688
SG::auxAllocatorNamePrefix
constexpr const char * auxAllocatorNamePrefix
Definition: AuxDataTraits.h:29
SG::AuxTypeRegistry::typeinfo_t::checkAlloc
bool checkAlloc(const std::type_info *ti_alloc, const std::string *alloc_name) const
Check that the allocator type for this entry matches the requested type.
Definition: AuxTypeRegistry.cxx:29
mapkey::key
key
Definition: TElectronEfficiencyCorrectionTool.cxx:37
SG::AuxTypeRegistry::m_auxids
id_map_t m_auxids
Definition: AuxTypeRegistry.h:676