18 auto search =
classes.find(classname);
21 return &search->second;
24 DictFuncPtr_t classdict = gClassTable->GetDict(classname);
27 if (!classdict)
return NULL;
29 std::map<const char *, uscript::TField> fields;
31 TClass *tclass = classdict();
34 if (tclass->GetCollectionType() == ROOT::kSTLvector) {
35 TClassInfo tclassinfo;
36 tclassinfo.is_vec =
true;
37 tclassinfo.name = classname;
38 tclassinfo.size =
sizeof(std::vector<void*>);
40 TClassEdit::TSplitType split(classname);
42 classdict = gClassTable->GetDict(split.fElements[1].c_str());
49 if (classdict == NULL) {
51 if (split.fElements[1] ==
"bool" || split.fElements[1] ==
"Bool_t") {
54 else if (split.fElements[1] ==
"float" || split.fElements[1] ==
"Float_t") {
57 else if (split.fElements[1] ==
"double" || split.fElements[1] ==
"Double_t") {
60 else if (split.fElements[1] ==
"int" || split.fElements[1] ==
"Int_t") {
63 else if (split.fElements[1] ==
"unsigned" || split.fElements[1] ==
"UInt_t") {
70 TClassInfo *sub_info =
Add(split.fElements[1].c_str());
75 tclassinfo.vec_data = data;
76 return &
classes.insert({classname, tclassinfo}).
first->second;
79 TList *members = tclass->GetListOfDataMembers();
80 TIterator *m_iterator = members->MakeIterator();
82 while ((obj = m_iterator->Next()) != NULL) {
83 TDataMember *member = (TDataMember *)obj;
86 this_field.
offset = member->GetOffset();
88 TDataType *basic_type = member->GetDataType();
92 if (member->GetArrayDim() > 0) {
94 for (
unsigned i = 0; i < member->GetArrayDim(); i++) {
95 this_field.
data.
len = this_field.
data.
len * member->GetMaxIndex(i);
100 if (member->IsEnum()) {
103 assert(member->GetUnitSize() == 4);
106 else if (basic_type != NULL) {
108 switch (basic_type->GetType()) {
133 if (field_info != NULL) {
146 tclassinfo.
fields = std::move(fields);
147 tclassinfo.
name = classname;
148 tclassinfo.
size = tclass->GetClassSize();
149 tclassinfo.
is_vec =
false;
150 return &
classes.insert({classname, tclassinfo}).
first->second;
std::unordered_map< const char *, TClassInfo > classes
std::map< const char *, TField > fields
static const char * Intern(const std::string &str)
TClassInfo * Add(const char *classname)