174 fh <<
"// generated header file" << std::endl << std::endl;
175 fh <<
"#ifndef " <<
filename <<
"_h" << std::endl;
176 fh <<
"#define " <<
filename <<
"_h" << std::endl << std::endl;
180 fs <<
"// generated source file" << std::endl << std::endl;
181 fs <<
"#include \"" <<
filename <<
".h\"" << std::endl << std::endl;
188 while ((cl = (
TClass *)iter()) !=
nullptr) {
203 while ((cl = (
TClass *)iter()) !=
nullptr) {
206 <<
" &buf, void* ptr = 0, bool checktypes = true);" << std::endl
212 fh <<
"#endif" << std::endl << std::endl;
213 fs << std::endl << std::endl;
227 switch (
member->GetDataType()->GetType()) {
230 case kInt_t:
return "int";
238 char first =
member->GetDataType()->GetTypeName()[0];
239 if ((first ==
'B') || (first ==
'b'))
241 return "unsigned char";
245 case kUInt_t:
return "unsigned int";
246 case kULong_t:
return "unsigned long";
253 return member->GetTypeName();
264 switch (
el->GetType() % 20) {
275 char first =
el->GetTypeNameBasic()[0];
276 if ((first ==
'B') || (first ==
'b'))
278 return "unsigned char";
370 if (
member->IsaPointer() || (
member->GetArrayDim() > 0))
410 if (
member->GetArrayDim() == 0)
437 fs <<
"//__________________________________________________________________________" << std::endl;
440 fs <<
"{" << std::endl;
443 fs <<
tab1 <<
"if (buf.IsReading()) { " << std::endl;
449 while ((
c1 = (
TClass *)iter()) !=
nullptr) {
452 if (!
c1->GetListOfBases()->FindObject(cl->
GetName()))
455 fs <<
tab2 <<
"if (checktypes) {" << std::endl;
460 fs <<
"res = " <<
GetStreamerName(
c1) <<
"(buf, dynamic_cast<" <<
c1->GetName() <<
"*>(obj));" << std::endl;
461 fs <<
tab3 <<
"if (res) return dynamic_cast<" << cl->
GetName() <<
"*>((" <<
c1->GetName() <<
" *) res);"
465 fs <<
tab2 <<
"}" << std::endl;
467 fs <<
tab2 <<
"if (!buf.CheckClassNode(\"" << cl->
GetName() <<
"\", " <<
info->GetClassVersion() <<
")) return 0;"
470 fs <<
tab2 <<
"if (obj==0) obj = new " << cl->
GetName() <<
";" << std::endl;
523 fs <<
", " <<
el->GetArrayLength() <<
", \"" <<
el->GetName() <<
"\");" << std::endl;
545 std::cout <<
"fatal error with TStreamerBasicPointer" << std::endl;
553 fs <<
", \"" <<
el->GetName() <<
"\", true)" <<
endch <<
";" << std::endl;
561 fs <<
", \"" <<
el->GetName() <<
"\")" <<
endch <<
";" << std::endl;
567 <<
el->GetClassPointer()->GetName() <<
"*>(obj), false);" << std::endl;
574 if (
el->GetArrayLength() > 0) {
576 fs <<
", " <<
el->GetArrayLength() <<
", -1"
577 <<
", \"" <<
el->GetName() <<
"\", " <<
GetStreamerName(
el->GetClassPointer()) <<
");" << std::endl;
580 fs <<
", \"" <<
el->GetName() <<
"\", " <<
GetStreamerName(
el->GetClassPointer()) <<
");" << std::endl;
588 if (
el->GetArrayLength() > 0) {
589 fs <<
tab2 <<
"for (int n=0;n<" <<
el->GetArrayLength() <<
";n++) "
590 <<
"delete (" <<
ElementGetter(cl,
el->GetName()) <<
")[n];" << std::endl;
592 fs <<
", " <<
el->GetArrayLength() <<
", \"" <<
el->GetName() <<
"\", "
599 fs <<
"(" <<
el->GetClassPointer()->GetName() <<
"*) buf.ReadObjectPtr(\"" <<
el->GetName() <<
"\", "
608 fs <<
", \"" <<
el->GetName() <<
"\", " <<
GetStreamerName(
el->GetClassPointer()) <<
");" << std::endl;
615 fs <<
", " <<
el->GetArrayLength() <<
", sizeof(" <<
el->GetClassPointer()->GetName() <<
"), \""
632 fs <<
tab2 <<
"// STL type = " <<
elstl->GetSTLtype() << std::endl;
636 fs <<
tab2 <<
"buf.SkipMember(\"" <<
el->GetName() <<
"\"); // sinfo type " <<
el->GetType() <<
" of class "
637 <<
el->GetClassPointer()->GetName() <<
" not supported" << std::endl;
640 fs <<
tab2 <<
"buf.EndClassNode();" << std::endl;
642 fs <<
tab1 <<
"} else {" << std::endl;
646 fs <<
tab2 <<
"if (obj==0) return 0;" << std::endl;
650 while ((
c1 = (
TClass *)iter()) !=
nullptr) {
653 if (!
c1->GetListOfBases()->FindObject(cl->
GetName()))
657 fs <<
tab2 <<
"if (checktypes) {" << std::endl;
659 fs <<
tab3 <<
"if (dynamic_cast<" <<
c1->GetName() <<
"*>(obj))" << std::endl;
664 fs <<
tab2 <<
"}" << std::endl;
666 fs <<
tab2 <<
"buf.StartClassNode(\"" << cl->
GetName() <<
"\", " <<
info->GetClassVersion() <<
");" << std::endl;
694 fs <<
tab2 <<
"buf.WriteValue(";
699 fs <<
", \"" <<
el->GetName() <<
"\");" << std::endl;
720 fs <<
", " <<
el->GetArrayLength() <<
", \"" <<
el->GetName() <<
"\");" << std::endl;
741 std::cout <<
"fatal error with TStreamerBasicPointer" << std::endl;
745 fs <<
", " <<
ElementGetter(cl,
elp->GetCountName()) <<
", \"" <<
el->GetName() <<
"\", true);" << std::endl;
757 <<
el->GetClassPointer()->GetName() <<
"*>(obj), false);" << std::endl;
764 if (
el->GetArrayLength() > 0) {
766 fs <<
", " <<
el->GetArrayLength() <<
", -1"
767 <<
", \"" <<
el->GetName() <<
"\", " <<
GetStreamerName(
el->GetClassPointer()) <<
");" << std::endl;
770 fs <<
", \"" <<
el->GetName() <<
"\", " <<
GetStreamerName(
el->GetClassPointer()) <<
");" << std::endl;
778 if (
el->GetArrayLength() > 0) {
780 fs <<
", " <<
el->GetArrayLength() <<
", \"" <<
el->GetName() <<
"\", "
784 fs <<
", \"" <<
el->GetName() <<
"\", " <<
GetStreamerName(
el->GetClassPointer()) <<
");" << std::endl;
791 fs <<
", \"" <<
el->GetName() <<
"\", " <<
GetStreamerName(
el->GetClassPointer()) <<
");" << std::endl;
797 fs <<
", " <<
el->GetArrayLength() <<
", sizeof(" <<
el->GetClassPointer()->GetName() <<
"), \""
813 fs <<
tab2 <<
"// STL type = " <<
elstl->GetSTLtype() << std::endl;
817 fs <<
tab2 <<
"buf.MakeEmptyMember(\"" <<
el->GetName() <<
"\"); // sinfo type " <<
el->GetType()
818 <<
" of class " <<
el->GetClassPointer()->GetName() <<
" not supported" << std::endl;
821 fs <<
tab2 <<
"buf.EndClassNode();" << std::endl;
823 fs <<
tab1 <<
"}" << std::endl;
824 fs <<
tab1 <<
"return obj;" << std::endl;
825 fs <<
"}" << std::endl << std::endl;
858 <<
"(" <<
argcl->GetName() <<
"*)"
873 <<
"buf.ReadSTLstring();" << std::endl;
885 default:
fs <<
"/* argument " <<
argname <<
" not supported */";
911 fs <<
"buf.WriteValue(" <<
accname <<
", 0);" << std::endl;
916 fs <<
"buf.WriteObjectPtr(";
926 fs <<
"buf.WriteSTLstring(";
931 fs <<
");" << std::endl;
935 default:
fs <<
"/* argument not supported */" << std::endl;
982 default:
return false;
985 for (
int n = 0;
n <
narg;
n++) {
1010 if (buf.
Index(
"const ") == 0) {
1012 while ((buf.
Length() > 0) && (buf[0] ==
' '))
1019 else if (buf ==
"string")
1064 fs <<
"*dynamic_cast<" <<
contcl->GetName() <<
"*>(obj);" << std::endl;
1068 if (
isarr &&
el->GetArrayLength()) {
1070 fs <<
tab3 <<
"for(int n=0;n<" <<
el->GetArrayLength() <<
";n++) {" << std::endl;
1078 fs <<
tabs <<
"if (" << (
isarr ?
"*cont" :
"cont") <<
"==0) {" << std::endl;
1079 fs <<
tabs2 <<
"buf.WriteSTLsize(0" << (
isstr ?
",true);" :
");") << std::endl;
1080 fs <<
tabs <<
"} else {" << std::endl;
1083 fs <<
tabs2 <<
"buf.WriteSTLsize(" <<
accname << (
isstr ?
"length(), true);" :
"size());") << std::endl;
1086 fs <<
tabs2 <<
"buf.WriteSTLstringData(" <<
accname <<
"c_str());" << std::endl;
1090 fs <<
tabs2 <<
"int k = 0;" << std::endl;
1093 fs <<
tabs2 <<
contcl->GetName() <<
"::const_iterator iter;" << std::endl;
1096 fs << std::endl <<
tabs2 <<
tab1 <<
"arr[k++] = *iter;" << std::endl;
1097 fs <<
tabs2 <<
"buf.WriteArray(arr, " <<
accname <<
"size(), 0, false);" << std::endl;
1098 fs <<
tabs2 <<
"delete[] arr;" << std::endl;
1099 }
else if (
narg == 1) {
1102 }
else if (
narg == 2) {
1103 fs <<
" {" << std::endl;
1108 fs <<
tabs2 <<
"}" << std::endl;
1113 fs <<
tabs <<
"}" << std::endl;
1115 if (
isarr &&
el->GetArrayLength()) {
1117 fs <<
tabs <<
"cont++;" << std::endl;
1119 fs <<
tabs <<
"(void*) cont = (char*) cont + sizeof(" <<
contcl->GetName() <<
");" << std::endl;
1120 fs <<
tab3 <<
"}" << std::endl;
1123 fs <<
tab3 <<
"buf.EndSTLnode();" << std::endl;
1124 fs <<
tab2 <<
"}" << std::endl;
1153 fs <<
"*dynamic_cast<" <<
contcl->GetName() <<
"*>(obj);" << std::endl;
1157 if (
isarr &&
el->GetArrayLength()) {
1159 fs <<
tab3 <<
"for(int n=0;n<" <<
el->GetArrayLength() <<
";n++) {" << std::endl;
1163 fs <<
tabs <<
"int size = buf.ReadSTLsize(" << (
isstr ?
"true);" :
");") << std::endl;
1167 fs <<
tabs <<
"if (size==0) " <<
accptr <<
" = 0;" << std::endl;
1168 fs <<
tabs <<
" else " <<
accptr <<
" = new " <<
contcl->GetName() <<
";" << std::endl;
1172 fs <<
"cont" <<
endch <<
";" << std::endl;
1179 fs <<
tabs <<
"if (size>0) " <<
accname <<
"assign(buf.ReadSTLstringData(size));" << std::endl;
1183 fs <<
tabs <<
"buf.ReadArray(arr, size, 0, false);" << std::endl;
1186 fs <<
tabs <<
"for(int k=0;k<size;k++)";
1194 fs <<
"(arr[k]);" << std::endl;
1195 fs <<
tabs <<
"delete[] arr;" << std::endl;
1196 }
else if (
narg == 1) {
1208 fs <<
"(" <<
arg1 <<
");" << std::endl;
1209 fs <<
tabs <<
"}" << std::endl;
1210 }
else if (
narg == 2) {
1219 fs <<
accname <<
"insert(make_pair(" <<
arg1 <<
", " <<
arg2 <<
"));" << std::endl;
1220 fs <<
tabs <<
"}" << std::endl;
1224 if (
isarr &&
el->GetArrayLength()) {
1226 fs <<
tabs <<
"cont++;" << std::endl;
1228 fs <<
tabs <<
"(void*) cont = (char*) cont + sizeof(" <<
contcl->GetName() <<
");" << std::endl;
1229 fs <<
tab3 <<
"}" << std::endl;
1232 fs <<
tab3 <<
"buf.EndSTLnode();" << std::endl;
1233 fs <<
tab2 <<
"}" << std::endl;
ROOT::Detail::TRangeCast< T, true > TRangeDynCast
TRangeDynCast is an adapter class that allows the typed iteration through a TCollection.
Option_t Option_t TPoint TPoint const char GetTextMagnitude GetFillStyle GetLineColor GetLineWidth GetMarkerStyle GetTextAlign GetTextColor GetTextSize void char Point_t Rectangle_t WindowAttributes_t Float_t Float_t Float_t Int_t Int_t UInt_t UInt_t Rectangle_t Int_t Int_t Window_t TString Int_t GCValues_t GetPrimarySelectionOwner GetDisplay GetScreen GetColormap GetNativeEvent const char const char dpyName wid window const char font_name cursor keysym reg const char only_if_exist regb h Point_t winding char text const char depth char const char Int_t count const char ColorStruct_t color const char filename
Option_t Option_t TPoint TPoint const char GetTextMagnitude GetFillStyle GetLineColor GetLineWidth GetMarkerStyle GetTextAlign GetTextColor GetTextSize fs
Option_t Option_t TPoint TPoint const char GetTextMagnitude GetFillStyle GetLineColor GetLineWidth GetMarkerStyle GetTextAlign GetTextColor GetTextSize void char Point_t Rectangle_t WindowAttributes_t Float_t Float_t Float_t Int_t Int_t UInt_t UInt_t Rectangle_t Int_t Int_t Window_t TString Int_t GCValues_t GetPrimarySelectionOwner GetDisplay GetScreen GetColormap GetNativeEvent const char const char dpyName wid window const char font_name cursor keysym reg const char only_if_exist regb h Point_t winding char text const char depth char const char Int_t count const char ColorStruct_t color const char Pixmap_t Pixmap_t PictureAttributes_t attr const char char ret_data h unsigned char height h Atom_t Int_t ULong_t ULong_t unsigned char prop_list Atom_t Atom_t Atom_t Time_t type
const char * names_xmlfileclass
TClass instances represent classes, structs and namespaces in the ROOT type system.
TVirtualStreamerInfo * GetStreamerInfo(Int_t version=0, Bool_t isTransient=kFALSE) const
returns a pointer to the TVirtualStreamerInfo object for version If the object does not exist,...
TClass * GetBaseDataMember(const char *datamember)
Return pointer to (base) class that contains datamember.
const char * GetDeclFileName() const
Return name of the file containing the declaration of this class.
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.
All ROOT classes may have RTTI (run time type identification) support added.
Basic data type descriptor (datatype information is obtained from CINT).
Method or function calling interface.
The TNamed class is the base class for all named ROOT classes.
const char * GetName() const override
Returns name of object.
TObject * At(Int_t idx) const override
Int_t GetLast() const override
Return index of last object in array.
Mother of all ROOT objects.
Describe one element (data member) to be Streamed.
const char * Data() const
TString & Remove(Ssiz_t pos)
Ssiz_t Index(const char *pat, Ssiz_t i=0, ECaseCompare cmp=kExact) const
Abstract Interface class describing Streamer information for one class.
@ kUChar
Equal to TDataType's kchar.
TString GetMemberTypeName(TDataMember *member)
returns name of simple data type for given data member
Bool_t ProduceCode(TList *cllist, const char *filename)
Produce streamers for provide class list TList should include list of classes, for which code should ...
TString GetStreamerName(TClass *cl)
returns streamer function name for given class
TString fSetterName
buffer for name of getter method
const char * ElementGetter(TClass *cl, const char *membername, int specials=0)
produce code to access member of given class.
TXMLSetup fXmlSetup
buffer for name of setter method
~TXMLPlayer() override
destructor of TXMLPlayer object
TString GetBasicTypeName(TStreamerElement *el)
return simple data types for given TStreamerElement object
void ReadSTLarg(std::ostream &fs, TString &argname, int argtyp, Bool_t isargptr, TClass *argcl, TString &tname, TString &ifcond)
Produce code to read argument of stl container from xml file.
TXMLPlayer()
default constructor
TString GetBasicTypeReaderMethodName(Int_t type, const char *realname)
return functions name to read simple data type from xml file
void ProduceStreamerSource(std::ostream &fs, TClass *cl, TList *cllist)
Produce source code of streamer function for specified class.
Bool_t ProduceSTLstreamer(std::ostream &fs, TClass *cl, TStreamerSTL *el, Bool_t isWriting)
Produce code of xml streamer for data member of stl type.
const char * ElementSetter(TClass *cl, const char *membername, char *endch)
Produce code to set value to given data member.
void WriteSTLarg(std::ostream &fs, const char *accname, int argtyp, Bool_t isargptr, TClass *argcl)
Produce code to write argument of stl container to xml file.
const char * XmlGetElementName(const TStreamerElement *el)
return converted name for TStreamerElement
ROOT::ESTLType IsSTLCont(std::string_view type)
type : type name: vector<list<classA,allocator>,allocator> result: 0 : not stl container code of cont...
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.