ATLAS Offline Software
TConverterRegistry.h
Go to the documentation of this file.
1 // This file's extension implies that it's C, but it's really -*- C++ -*-.
2 
3 /*
4  Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration
5 */
25 #ifndef TCONVERTERREGISTRY_H
26 #define TCONVERTERREGISTRY_H
27 
28 
29 #include <string>
30 #include <map>
31 #include <mutex>
32 #include "Rtypes.h"
33 class TVirtualConverter;
34 class TMemberStreamer;
35 
36 
41 {
42 public:
46  static TConverterRegistry* Instance();
47 
48 
49  //==========================================================================
50  // @c TConvertingBranchElement converters.
51  //
52 
63 
72  void AddConverter (TVirtualConverter* conv, bool takeown);
73 
82  bool AddConverter (const char* convname);
83 
90  TVirtualConverter* GetConverter (const char* name, int checksum) const;
91 
92 
93  //==========================================================================
94  // @c TConvertingStreamerInfo converters.
95  //
96 
97  void AddStreamerConverter (const std::string& from_type,
98  const std::string& to_type,
99  TMemberStreamer* streamer);
100 
101  TMemberStreamer* GetStreamerConverter (const std::string& from_type,
102  const std::string& to_type) const;
103 
104 
105 private:
108 
109  // We store a map of names to maps of checksums to converters.
110  // The bool flag tells whether or not we own this converter.
111  typedef std::pair<TVirtualConverter*, bool> Payload;
112  typedef std::map<UInt_t, Payload> CheckSumMap;
113  typedef std::map<std::string, CheckSumMap> MapType;
114 
117 
120  using lock_t = std::lock_guard<std::mutex>;
121 
123 #ifndef __CLING__
124  typedef std::map<std::string, TMemberStreamer*> SMapType;
126 #endif
127 };
128 
129 
130 #endif // not TCONVERTERREGISTRY_H
TConverterRegistry::fSMap
SMapType fSMap
Definition: TConverterRegistry.h:125
TConverterRegistry::CheckSumMap
std::map< UInt_t, Payload > CheckSumMap
Definition: TConverterRegistry.h:112
BeamSpot::mutex
std::mutex mutex
Definition: InDetBeamSpotVertex.cxx:18
TConverterRegistry::MapType
std::map< std::string, CheckSumMap > MapType
Definition: TConverterRegistry.h:113
TConverterRegistry::GetStreamerConverter
TMemberStreamer * GetStreamerConverter(const std::string &from_type, const std::string &to_type) const
Definition: TConverterRegistry.cxx:128
TConverterRegistry::~TConverterRegistry
~TConverterRegistry()
Destructor.
Definition: TConverterRegistry.cxx:157
TConverterRegistry::Payload
std::pair< TVirtualConverter *, bool > Payload
Definition: TConverterRegistry.h:111
TConverterRegistry::fMutex
std::mutex fMutex
Protect access to the map.
Definition: TConverterRegistry.h:119
TConverterRegistry::SMapType
std::map< std::string, TMemberStreamer * > SMapType
Streamer converters.
Definition: TConverterRegistry.h:124
TVirtualConverter
Base class for converters for Root schema evolution.
Definition: TVirtualConverter.h:110
TConverterRegistry::lock_t
std::lock_guard< std::mutex > lock_t
Definition: TConverterRegistry.h:120
TConverterRegistry::AddStreamerConverter
void AddStreamerConverter(const std::string &from_type, const std::string &to_type, TMemberStreamer *streamer)
Definition: TConverterRegistry.cxx:114
TConverterRegistry
Registry for Root converters.
Definition: TConverterRegistry.h:41
name
std::string name
Definition: Control/AthContainers/Root/debug.cxx:195
TConverterRegistry::fMap
MapType fMap
Map of registered converters.
Definition: TConverterRegistry.h:116
TConverterRegistry::AddConverter
void AddConverter(TVirtualConverter *conv)
Add a new converter to the registry.
Definition: TConverterRegistry.cxx:36
TConverterRegistry::Instance
static TConverterRegistry * Instance()
Return a pointer to the global registry instance.
Definition: TConverterRegistry.cxx:143
TConverterRegistry::GetConverter
TVirtualConverter * GetConverter(const char *name, int checksum) const
Look up a converter in the registry by name and checksum.
Definition: TConverterRegistry.cxx:100
pdg_comparison.conv
conv
Definition: pdg_comparison.py:321