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