43 if (normName && normName[0] && normName[0] !=
'(')
61 auto regularPtr = (
long *)0x42;
62 std::unique_ptr<long> uniquePtr(regularPtr);
63 auto regularPtr_2 =
reinterpret_cast<long **
>(&uniquePtr);
64 bool isZero = uniquePtr.get() == *regularPtr_2;
67 Error(
"CloseStreamerInfoROOTFile",
68 "UniquePtr points to %p, reinterpreting it gives %p and should have %p", uniquePtr.get(), *(regularPtr_2), regularPtr);
75 auto dmTypeName = dm->GetTypeName();
79 if (!isUniquePtrOffsetZero)
return true;
82 std::vector<std::string> out;
86 if (0 != out[2].find(
"default_delete<")) {
87 Error(
"CloseStreamerInfoROOTFile",
"I/O is supported only for unique_ptrs with a default deleter. %s::%s appears to have a custom one, %s.", normName, dm->GetName(), out[2].c_str());
128 if (writeEmptyRootPCM) {
138 Error(
"CloseStreamerInfoROOTFile",
"Cannot find class %s.", normName.c_str());
146 auto dms = cl->GetListOfDataMembers();
148 Error(
"CloseStreamerInfoROOTFile",
"Cannot find data members for %s.", normName.c_str());
152 for (
auto dmObj : *dms) {
154 if (!dm->IsPersistent() || cl->GetClassVersion()==0)
continue;
157 const char *enumTypeName = dm->GetTypeName();
159 if (enumType && (!enumType->GetClass() || !enumType->GetClass()->IsLoaded()) &&
160 ((strstr(enumTypeName,
"(unnamed)") ==
nullptr) &&
169 if (cl->IsLoaded())
continue;
185 if (
auto pr = cl->GetCollectionProxy()) {
186 auto colltype =
pr->GetCollectionType();
189 if (
auto pcl =
pr->GetValueClass()) {
190 if (
auto pcl_dms = pcl->GetListOfDataMembers()) {
191 for (
auto dmObj : *pcl_dms) {
194 const char *enumTypeName = dm->GetTypeName();
196 if (enumType && (!enumType->GetClass() || !enumType->GetClass()->IsLoaded()) &&
214 Error(
"CloseStreamerInfoROOTFile",
"Cannot find typedef %s.", dtname.c_str());
217 if (dt->GetType() == -1) {
228 const size_t lastSepPos = enumname.rfind(
"::");
229 if (lastSepPos != std::string::npos) {
230 const std::string nsName = enumname.substr(0, lastSepPos);
232 if (!tclassInstance) {
233 Error(
"CloseStreamerInfoROOTFile",
"Cannot find TClass instance for namespace %s.", nsName.c_str());
240 Error(
"CloseStreamerInfoROOTFile",
"TClass instance for namespace %s does not have any enum associated. This is an inconsistency.", nsName.c_str());
243 const std::string unqualifiedEnumName = enumname.substr(lastSepPos + 2);
245 if (en) en->
SetTitle(nsName.c_str());
247 en = (
TEnum *)
gROOT->GetListOfEnums()->FindObject(enumname.c_str());
251 Error(
"CloseStreamerInfoROOTFile",
"Cannot find enum %s.", enumname.c_str());
Error("WriteTObject","The current directory (%s) is not associated with a file. The object (%s) has not been written.", GetName(), objname)
TClass instances represent classes, structs and namespaces in the ROOT type system.
TList * GetListOfEnums(Bool_t load=kTRUE)
Return a list containing the TEnums of a class.
Long_t Property() const override
Returns the properties of the TClass as a bit field stored as a Long_t value.
static TClass * GetClass(const char *name, Bool_t load=kTRUE, Bool_t silent=kFALSE)
Static method returning pointer to TClass of the specified class name.
Int_t Write(const char *name=nullptr, Int_t option=0, Int_t bufsize=0) override
Write all objects in this collection.
All ROOT classes may have RTTI (run time type identification) support added.
Basic data type descriptor (datatype information is obtained from CINT).
The TEnum class implements the enum type.
Long_t Property() const override
Get property description word. For meaning of bits see EProperty.
static TEnum * GetEnum(const std::type_info &ti, ESearchAction sa=kALoadAndInterpLookup)
A file, usually with extension .root, that stores data and code in the form of serialized objects in ...
virtual void SetTitle(const char *title="")
Set the title of the TNamed.
void Delete(Option_t *option="") override
Remove all objects from the array AND delete all heap based objects.
void AddLast(TObject *obj) override
Add object in the next empty slot in the array.
Mother of all ROOT objects.
virtual TObject * FindObject(const char *name) const
Must be redefined in derived classes.
@ kSingleKey
write collection with single key
Persistent version of a TClass.
Describes a persistent version of a class.
static void SetFactory(TVirtualStreamerInfo *factory)
static function: Set the StreamerInfo factory
int GetSplit(const char *type, std::vector< std::string > &output, int &nestedLoc, EModType mode=TClassEdit::kNone)
Stores in output (after emptying it) the split type.
bool IsUniquePtr(std::string_view name)
void pr(register struct inclist *ip, char *file, char *base, char *dep)
static bool IsUnsupportedUniquePointer(const char *normName, TDataMember *dm)
void AddTypedefToROOTFile(const char *tdname)
bool CloseStreamerInfoROOTFile(bool writeEmptyRootPCM)
std::vector< std::string > gEnumsToStore
void AddEnumToROOTFile(const char *enumname)
void InitializeStreamerInfoROOTFile(const char *filename)
void AddStreamerInfoToROOTFile(const char *normName)
std::vector< std::string > gTypedefsToStore
static bool IsUniquePtrOffsetZero()
std::vector< std::string > gClassesToStore