Constructor.
110 {
111 SetNameTitle(parameters.getTreeName(), parameters.getTreeTitle());
112
113
114
115 TClass* t_class = TClass::GetClass<T>();
116
117 if (t_class == nullptr) {
118 THROW(JException,
"Could not get class " <<
typeid(T).name());
119 }
120
121 TIter next(t_class->GetListOfRealData());
122 TRealData*
data{
nullptr};
123 T object;
124
125 auto* base = reinterpret_cast<uint8_t*>(&object);
126
127 while ((data = dynamic_cast<TRealData*>(next())) != nullptr) {
128
130
131 auto* member =
data->GetDataMember();
132 auto* address = reinterpret_cast<uint8_t*>(base + member->GetOffset());
133 std::string type_name =
data->GetDataMember()->GetTypeName();
134
135 if (member->GetArrayDim() > 0) {
136 type_name += "[]";
137 }
138
140
141 if (type_code.empty()) {
142 THROW(JException,
"unknown type " << type_name);
143 }
144
145 std::string leaf =
data->GetName();
146 leaf += "/" + type_code;
147 auto branch = Branch(
data->GetName(), address, leaf.c_str());
148
150 offsets_ .push_back(member->GetOffset());
151 }
152 }
153 }
#define THROW(JException_t, A)
Marco for throwing exception with std::ostream compatible message.
std::vector< TBranch * > branches_
std::vector< Long_t > offsets_
static bool is_tobject_member(const char *name)
Check if name is one of TObject own data members (fBits or fUniqueID, for Root <= 6....
static std::string getTypeCode(const std::string &type_name)
Return the type code (used to create primitive leaves in basic Root tree branches) corresponding to t...