ATLAS Offline Software
Static Public Member Functions | List of all members
DataModelAthenaPool::DataVectorConvert Class Reference

Provide backwards compatibility for reading DataVector classes. More...

#include <DataVectorConvert.h>

Collaboration diagram for DataModelAthenaPool::DataVectorConvert:

Static Public Member Functions

static void initialize (RootUtils::ILogger *logfn=0)
 Scan all known DataVector classes and fix up the Root data for any that need conversion. More...
 

Detailed Description

Provide backwards compatibility for reading DataVector classes.

When setting up DataVector inheritance using DATAVECTOR_BASE, a side effect is that the persistent form of the data may change. Including this service will fix up the root metadata to allow reading old data. In fact, any sort of DataVector<A> to DataVector<B> conversions will be allowed, provided that A* can be converted to B*.

The only reason to make this a class rather than a free function is that Root's autoloading seems to work only with classes.

Definition at line 39 of file DataVectorConvert.h.

Member Function Documentation

◆ initialize()

void DataModelAthenaPool::DataVectorConvert::initialize ( RootUtils::ILogger logfn = 0)
static

Scan all known DataVector classes and fix up the Root data for any that need conversion.

Parameters
logfnCallback for logging debug messages. Null for no logging.

It's ok to call this more than once to look for any new classes (we remember which classes we've already processed to avoid doing them again).

Definition at line 469 of file DataVectorConvert.cxx.

470 {
471  static std::mutex m;
472  std::lock_guard<std::mutex> lock (m);
473 
474  // List of classes we've already processed.
475  static std::vector<TClass*> s_seen ATLAS_THREAD_SAFE;
476 
477  TIter next (gROOT->GetListOfClasses());
478  while (TClass* cls = dynamic_cast<TClass*> (next())) {
479  if (std::strncmp (cls->GetName(), "DataVector<", 11) == 0) {
480  if (std::find (s_seen.begin(), s_seen.end(), cls) == s_seen.end()) {
481  test_dv (logfn, cls);
482  s_seen.push_back (cls);
483  }
484  }
485  }
486 }

The documentation for this class was generated from the following files:
python.SystemOfUnits.m
int m
Definition: SystemOfUnits.py:91
find
std::string find(const std::string &s)
return a remapped string
Definition: hcg.cxx:135
BeamSpot::mutex
std::mutex mutex
Definition: InDetBeamSpotVertex.cxx:18
CaloClusterListBadChannel.cls
cls
Definition: CaloClusterListBadChannel.py:8
fillPileUpNoiseLumi.next
next
Definition: fillPileUpNoiseLumi.py:52
ATLAS_THREAD_SAFE
#define ATLAS_THREAD_SAFE
Definition: checker_macros.h:211