Registry for Root converters.
More...
#include <TConverterRegistry.h>
Registry for Root converters.
Definition at line 40 of file TConverterRegistry.h.
◆ CheckSumMap
◆ lock_t
◆ MapType
◆ Payload
◆ SMapType
◆ ~TConverterRegistry()
| TConverterRegistry::~TConverterRegistry |
( |
| ) |
|
|
private |
Destructor.
Destroy the registered converters.
Definition at line 156 of file TConverterRegistry.cxx.
157{
158 for (
auto& [name, checksum_map] :
fMap) {
159 for (auto& [checksum, payload] : checksum_map) {
162 }
163 }
164
165 for (
auto& [key, streamer] :
fSMap)
166 delete streamer;
167}
MapType fMap
Map of registered converters.
◆ AddConverter() [1/3]
| bool TConverterRegistry::AddConverter |
( |
const char * | convname | ) |
|
Add a new converter to the registry.
- Parameters
-
| convname | The name of the converter class to add. |
- Returns
- True if successful, false if the class couldn't be found.
This will also add a streamer for the class, to support conversion in non-split mode.
Definition at line 80 of file TConverterRegistry.cxx.
81{
82 TClass*
cl = gROOT->GetClass (convname);
83 if (!cl) return false;
84 TClass* basecl = gROOT->GetClass ("TVirtualConverter");
85 int offs =
cl->GetBaseClassOffset (basecl);
86 if (offs < 0) return false;
87 char* cnv =
reinterpret_cast<char*
> (
cl->New());
88 AddConverter (
reinterpret_cast<TVirtualConverter*
> (cnv + offs),
true);
89 return true;
90}
void AddConverter(TVirtualConverter *conv)
Add a new converter to the registry.
cl
print [x.__class__ for x in toList(dqregion.getSubRegions()) ]
◆ AddConverter() [2/3]
Add a new converter to the registry.
- Parameters
-
| conv | The converter to add. |
This will also add a streamer for the class, to support conversion in non-split mode.
The caller will retain ownership of the converter.
Definition at line 35 of file TConverterRegistry.cxx.
◆ AddConverter() [3/3]
Add a new converter to the registry.
- Parameters
-
| conv | The converter to add. |
| takeown | If true, the registry takes ownership of the converter. |
This will also add a streamer for the class, to support conversion in non-split mode.
Definition at line 49 of file TConverterRegistry.cxx.
51{
53
55
56
57
58
59 TClass*
cls =
conv->GetTransClass();
61
62
63
64 if (cmap.size() == 0)
65 cls->AdoptStreamer (
new TConverterStreamer (cmap, cls));
66
67
68 cmap[
conv->GetCheckSum()] = std::make_pair (conv, takeown);
69}
void TConvertingBranchElement_init()
To allow calling Initialize without having to depend on the header.
std::map< UInt_t, Payload > CheckSumMap
std::lock_guard< std::mutex > lock_t
std::mutex fMutex
Protect access to the map.
◆ AddStreamerConverter()
| void TConverterRegistry::AddStreamerConverter |
( |
const std::string & | from_type, |
|
|
const std::string & | to_type, |
|
|
TMemberStreamer * | streamer ) |
◆ GetConverter()
| TVirtualConverter * TConverterRegistry::GetConverter |
( |
const char * | name, |
|
|
int | checksum ) const |
Look up a converter in the registry by name and checksum.
- Parameters
-
| name | The name of the (transient) class. |
| checksum | The checksum of the persistent class. |
- Returns
- The converter, or nullptr if none.
Definition at line 99 of file TConverterRegistry.cxx.
101{
103 auto i =
fMap.find (name);
104 if (i !=
fMap.end()) {
105 auto i2 =
i->second.find (checksum);
106 if (i2 !=
i->second.end())
107 return i2->second.first;
108 }
109 return nullptr;
110}
◆ GetStreamerConverter()
| TMemberStreamer * TConverterRegistry::GetStreamerConverter |
( |
const std::string & | from_type, |
|
|
const std::string & | to_type ) const |
◆ Instance()
Return a pointer to the global registry instance.
Definition at line 142 of file TConverterRegistry.cxx.
143{
144
145
148}
#define ATLAS_THREAD_SAFE
◆ fMap
◆ fMutex
| std::mutex TConverterRegistry::fMutex |
|
mutableprivate |
◆ fSMap
The documentation for this class was generated from the following files: