Logo ROOT  
Reference Guide
TXMLPlayer.cxx
Go to the documentation of this file.
1// @(#)root/xml:$Id$
2// Author: Sergey Linev, Rene Brun 10.05.2004
3
4/*************************************************************************
5 * Copyright (C) 1995-2004, Rene Brun and Fons Rademakers. *
6 * All rights reserved. *
7 * *
8 * For the licensing terms see $ROOTSYS/LICENSE. *
9 * For the list of contributors see $ROOTSYS/README/CREDITS. *
10 *************************************************************************/
11
12//________________________________________________________________________
13//
14// Class for xml code generation
15// It should be used for generation of xml streamers, which could be used outside root
16// environment. This means, that with help of such streamers user can read and write
17// objects from/to xml file, which later can be accepted by ROOT.
18//
19// At the moment supported only classes, which are not inherited from TObject
20// and which not contains any TObject members.
21//
22// To generate xml code:
23//
24// 1. ROOT library with required classes should be created.
25// In general, without such library non of user objects can be stored and
26// retrieved from any ROOT file
27//
28// 2. Generate xml streamers by root script like:
29//
30// void generate() {
31// gSystem->Load("libRXML.so"); // load ROOT xml library
32// gSystem->Load("libuser.so"); // load user ROOT library
33//
34// TList lst;
35// lst.Add(TClass::GetClass("TUserClass1"));
36// lst.Add(TClass::GetClass("TUserClass2"));
37// ...
38// TXMLPlayer player;
39// player.ProduceCode(&lst, "streamers"); // create xml streamers
40// }
41//
42// 3. Copy "streamers.h", "streamers.cxx", "TXmlFile.h", "TXmlFile.cxx" files
43// to user project and compile them. TXmlFile class implementation can be taken
44// from http://web-docs.gsi.de/~linev/xmlfile.tar.gz
45//
46// TXMLPlayer class generates one function per class, which called class streamer.
47// Name of such function for class TExample will be TExample_streamer.
48//
49// Following data members for streamed classes are supported:
50// - simple data types (int, double, float)
51// - array of simple types (int[5], double[5][6])
52// - dynamic array of simple types (int* with comment field // [fSize])
53// - const char*
54// - object of any nonROOT class
55// - pointer on object
56// - array of objects
57// - array of pointers on objects
58// - stl string
59// - stl vector, list, deque, set, multiset, map, multimap
60// - allowed arguments for stl containers are: simple data types, string, object, pointer on object
61// Any other data member can not be (yet) read from xml file and write to xml file.
62//
63// If data member of class is private or protected, it can not be accessed via
64// member name. Two alternative way is supported. First, if for class member fValue
65// exists function GetValue(), it will be used to get value from the class, and if
66// exists SetValue(), it will be used to set appropriate data member. Names of setter
67// and getter methods can be specified in comments filed like:
68//
69// int fValue; // *OPTION={GetMethod="GetV";SetMethod="SetV"}
70//
71// If getter or setter methods does not available, address to data member will be
72// calculated as predefined offset to object start address. In that case generated code
73// should be used only on the same platform (OS + compiler), where it was generated.
74//
75// Generated streamers resolve inheritance tree for given class. This allows to have
76// array (or vector) of object pointers on some basic class, while objects of derived
77// class(es) are used.
78//
79// To access data from xml files, user should use TXmlFile class, which is different from
80// ROOT TXMLFile, but provides very similar functionality. For example, to read
81// object from xml file:
82//
83// TXmlFile file("test.xml"); // open xml file
84// file.ls(); // show list of keys in file
85// TExample* ex1 = (TExample*) file.Get("ex1", TExample_streamer); // get object
86// file.Close();
87//
88// To write object to file:
89//
90// TXmlFile outfile("test2.xml", "recreate"); // create xml file
91// TExample* ex1 = new TExample;
92// outfile.Write(ex1, "ex1", TExample_streamer); // write object to file
93// outfile.Close();
94//
95// Complete example for generating and using of external xml streamers can be taken from
96// http://www-docs.gsi.de/~linev/xmlreader.tar.gz
97//
98// Any bug reports and requests for additional functionality are welcome.
99//
100// Sergey Linev, S.Linev@gsi.de
101//
102//________________________________________________________________________
103
104#include "TXMLPlayer.h"
105
106#include "Riostream.h"
107#include "TROOT.h"
108#include "TClass.h"
109#include "TVirtualStreamerInfo.h"
110#include "TStreamerElement.h"
111#include "TObjArray.h"
112#include "TDataMember.h"
113#include "TMethod.h"
114#include "TDataType.h"
115#include "TMethodCall.h"
117#include "TClassEdit.h"
118#include <string>
119#include <vector>
120
121const char *tab1 = " ";
122const char *tab2 = " ";
123const char *tab3 = " ";
124const char *tab4 = " ";
125
126const char *names_xmlfileclass = "TXmlFile";
127
129
130////////////////////////////////////////////////////////////////////////////////
131/// default constructor
132
134{
135}
136
137////////////////////////////////////////////////////////////////////////////////
138/// destructor of TXMLPlayer object
139
141{
142}
143
144////////////////////////////////////////////////////////////////////////////////
145/// returns streamer function name for given class
146
148{
149 if (cl == 0)
150 return "";
151 TString res = cl->GetName();
152 res += "_streamer";
153 return res;
154}
155
156////////////////////////////////////////////////////////////////////////////////
157/// Produce streamers for provide class list
158/// TList should include list of classes, for which code should be generated.
159/// filename specify name of file (without extension), where streamers should be
160/// created. Function produces two files: header file and source file.
161/// For instance, if filename is "streamers", files "streamers.h" and "streamers.cxx"
162/// will be created.
163
164Bool_t TXMLPlayer::ProduceCode(TList *cllist, const char *filename)
165{
166 if ((cllist == 0) || (filename == 0))
167 return kFALSE;
168
169 std::ofstream fh(TString(filename) + ".h");
170 std::ofstream fs(TString(filename) + ".cxx");
171
172 fh << "// generated header file" << std::endl << std::endl;
173 fh << "#ifndef " << filename << "_h" << std::endl;
174 fh << "#define " << filename << "_h" << std::endl << std::endl;
175
176 fh << "#include \"" << names_xmlfileclass << ".h\"" << std::endl << std::endl;
177
178 fs << "// generated source file" << std::endl << std::endl;
179 fs << "#include \"" << filename << ".h\"" << std::endl << std::endl;
180
181 // produce appropriate include for all classes
182
183 TObjArray inclfiles;
184 TIter iter(cllist);
185 TClass *cl = 0;
186 while ((cl = (TClass *)iter()) != 0) {
187 if (inclfiles.FindObject(cl->GetDeclFileName()) == 0) {
188 fs << "#include \"" << cl->GetDeclFileName() << "\"" << std::endl;
189 inclfiles.Add(new TNamed(cl->GetDeclFileName(), ""));
190 }
191 }
192 inclfiles.Delete();
193
194 fh << std::endl;
195 fs << std::endl;
196
197 // produce streamers declarations and implementations
198
199 iter.Reset();
200
201 while ((cl = (TClass *)iter()) != 0) {
202
203 fh << "extern void* " << GetStreamerName(cl) << "(" << names_xmlfileclass
204 << " &buf, void* ptr = 0, bool checktypes = true);" << std::endl
205 << std::endl;
206
207 ProduceStreamerSource(fs, cl, cllist);
208 }
209
210 fh << "#endif" << std::endl << std::endl;
211 fs << std::endl << std::endl;
212
213 return kTRUE;
214}
215
216////////////////////////////////////////////////////////////////////////////////
217/// returns name of simple data type for given data member
218
220{
221 if (member == 0)
222 return "int";
223
224 if (member->IsBasic())
225 switch (member->GetDataType()->GetType()) {
226 case kChar_t: return "char";
227 case kShort_t: return "short";
228 case kInt_t: return "int";
229 case kLong_t: return "long";
230 case kLong64_t: return "long long";
231 case kFloat16_t:
232 case kFloat_t: return "float";
233 case kDouble32_t:
234 case kDouble_t: return "double";
235 case kUChar_t: {
236 char first = member->GetDataType()->GetTypeName()[0];
237 if ((first == 'B') || (first == 'b'))
238 return "bool";
239 return "unsigned char";
240 }
241 case kBool_t: return "bool";
242 case kUShort_t: return "unsigned short";
243 case kUInt_t: return "unsigned int";
244 case kULong_t: return "unsigned long";
245 case kULong64_t: return "unsigned long long";
246 }
247
248 if (member->IsEnum())
249 return "int";
250
251 return member->GetTypeName();
252}
253
254////////////////////////////////////////////////////////////////////////////////
255/// return simple data types for given TStreamerElement object
256
258{
260 return "int";
261
262 switch (el->GetType() % 20) {
263 case TVirtualStreamerInfo::kChar: return "char";
264 case TVirtualStreamerInfo::kShort: return "short";
265 case TVirtualStreamerInfo::kInt: return "int";
266 case TVirtualStreamerInfo::kLong: return "long";
267 case TVirtualStreamerInfo::kLong64: return "long long";
269 case TVirtualStreamerInfo::kFloat: return "float";
271 case TVirtualStreamerInfo::kDouble: return "double";
273 char first = el->GetTypeNameBasic()[0];
274 if ((first == 'B') || (first == 'b'))
275 return "bool";
276 return "unsigned char";
277 }
278 case TVirtualStreamerInfo::kBool: return "bool";
279 case TVirtualStreamerInfo::kUShort: return "unsigned short";
280 case TVirtualStreamerInfo::kUInt: return "unsigned int";
281 case TVirtualStreamerInfo::kULong: return "unsigned long";
282 case TVirtualStreamerInfo::kULong64: return "unsigned long long";
283 }
284 return "int";
285}
286
287////////////////////////////////////////////////////////////////////////////////
288/// return functions name to read simple data type from xml file
289
291{
293 return "ReadInt";
294
295 switch (type % 20) {
296 case TVirtualStreamerInfo::kChar: return "ReadChar";
297 case TVirtualStreamerInfo::kShort: return "ReadShort";
298 case TVirtualStreamerInfo::kInt: return "ReadInt";
299 case TVirtualStreamerInfo::kLong: return "ReadLong";
300 case TVirtualStreamerInfo::kLong64: return "ReadLong64";
302 case TVirtualStreamerInfo::kFloat: return "ReadFloat";
304 case TVirtualStreamerInfo::kDouble: return "ReadDouble";
306 Bool_t isbool = false;
307 if (realname != 0)
308 isbool = (TString(realname).Index("bool", 0, TString::kIgnoreCase) >= 0);
309 if (isbool)
310 return "ReadBool";
311 return "ReadUChar";
312 }
313 case TVirtualStreamerInfo::kBool: return "ReadBool";
314 case TVirtualStreamerInfo::kUShort: return "ReadUShort";
315 case TVirtualStreamerInfo::kUInt: return "ReadUInt";
316 case TVirtualStreamerInfo::kULong: return "ReadULong";
317 case TVirtualStreamerInfo::kULong64: return "ReadULong64";
318 }
319 return "ReadValue";
320}
321
322////////////////////////////////////////////////////////////////////////////////
323/// produce code to access member of given class.
324/// Parameter specials has following meaning:
325/// 0 - nothing special
326/// 1 - cast to data type
327/// 2 - produce pointer on given member
328/// 3 - skip casting when produce pointer by buf.P() function
329
330const char *TXMLPlayer::ElementGetter(TClass *cl, const char *membername, int specials)
331{
332 TClass *membercl = cl ? cl->GetBaseDataMember(membername) : 0;
333 TDataMember *member = membercl ? membercl->GetDataMember(membername) : 0;
334 TMethodCall *mgetter = member ? member->GetterMethod(0) : 0;
335
336 if ((mgetter != 0) && (mgetter->GetMethod()->Property() & kIsPublic)) {
337 fGetterName = "obj->";
338 fGetterName += mgetter->GetMethodName();
339 fGetterName += "()";
340 } else if ((member == 0) || ((member->Property() & kIsPublic) != 0)) {
341 fGetterName = "obj->";
342 fGetterName += membername;
343 } else {
344 fGetterName = "";
345 Bool_t deref = (member->GetArrayDim() == 0) && (specials != 2);
346 if (deref)
347 fGetterName += "*(";
348 if (specials != 3) {
349 fGetterName += "(";
350 if (member->Property() & kIsConstant)
351 fGetterName += "const ";
353 if (member->IsaPointer())
354 fGetterName += "*";
355 fGetterName += "*) ";
356 }
357 fGetterName += "buf.P(obj,";
358 fGetterName += member->GetOffset();
359 fGetterName += ")";
360 if (deref)
361 fGetterName += ")";
362 specials = 0;
363 }
364
365 if ((specials == 1) && (member != 0)) {
366 TString cast = "(";
367 cast += GetMemberTypeName(member);
368 if (member->IsaPointer() || (member->GetArrayDim() > 0))
369 cast += "*";
370 cast += ") ";
371 cast += fGetterName;
372 fGetterName = cast;
373 }
374
375 if ((specials == 2) && (member != 0)) {
376 TString buf = "&(";
377 buf += fGetterName;
378 buf += ")";
379 fGetterName = buf;
380 }
381
382 return fGetterName.Data();
383}
384
385////////////////////////////////////////////////////////////////////////////////
386/// Produce code to set value to given data member.
387/// endch should be output after value is specified.
388
389const char *TXMLPlayer::ElementSetter(TClass *cl, const char *membername, char *endch)
390{
391 strcpy(endch, "");
392
393 TClass *membercl = cl ? cl->GetBaseDataMember(membername) : 0;
394 TDataMember *member = membercl ? membercl->GetDataMember(membername) : 0;
395 TMethodCall *msetter = member ? member->SetterMethod(cl) : 0;
396
397 if ((msetter != 0) && (msetter->GetMethod()->Property() & kIsPublic)) {
398 fSetterName = "obj->";
399 fSetterName += msetter->GetMethodName();
400 fSetterName += "(";
401 strcpy(endch, ")");
402 } else if ((member == 0) || (member->Property() & kIsPublic) != 0) {
403 fSetterName = "obj->";
404 fSetterName += membername;
405 fSetterName += " = ";
406 } else {
407 fSetterName = "";
408 if (member->GetArrayDim() == 0)
409 fSetterName += "*";
410 fSetterName += "((";
411 if (member->Property() & kIsConstant)
412 fSetterName += "const ";
414 if (member->IsaPointer())
415 fSetterName += "*";
416 fSetterName += "*) buf.P(obj,";
417 fSetterName += member->GetOffset();
418 fSetterName += ")) = ";
419 }
420 return fSetterName.Data();
421}
422
423////////////////////////////////////////////////////////////////////////////////
424/// Produce source code of streamer function for specified class
425
426void TXMLPlayer::ProduceStreamerSource(std::ostream &fs, TClass *cl, TList *cllist)
427{
428 if (cl == 0)
429 return;
431 TObjArray *elements = info->GetElements();
432 if (elements == 0)
433 return;
434
435 fs << "//__________________________________________________________________________" << std::endl;
436 fs << "void* " << GetStreamerName(cl) << "(" << names_xmlfileclass << " &buf, void* ptr, bool checktypes)"
437 << std::endl;
438 fs << "{" << std::endl;
439 fs << tab1 << cl->GetName() << " *obj = (" << cl->GetName() << "*) ptr;" << std::endl;
440
441 fs << tab1 << "if (buf.IsReading()) { " << std::endl;
442
443 TIter iter(cllist);
444 TClass *c1 = 0;
445 Bool_t firstchild = true;
446
447 while ((c1 = (TClass *)iter()) != 0) {
448 if (c1 == cl)
449 continue;
450 if (c1->GetListOfBases()->FindObject(cl->GetName()) == 0)
451 continue;
452 if (firstchild) {
453 fs << tab2 << "if (checktypes) {" << std::endl;
454 fs << tab3 << "void* ";
455 firstchild = false;
456 } else
457 fs << tab3;
458 fs << "res = " << GetStreamerName(c1) << "(buf, dynamic_cast<" << c1->GetName() << "*>(obj));" << std::endl;
459 fs << tab3 << "if (res) return dynamic_cast<" << cl->GetName() << "*>((" << c1->GetName() << " *) res);"
460 << std::endl;
461 }
462 if (!firstchild)
463 fs << tab2 << "}" << std::endl;
464
465 fs << tab2 << "if (!buf.CheckClassNode(\"" << cl->GetName() << "\", " << info->GetClassVersion() << ")) return 0;"
466 << std::endl;
467
468 fs << tab2 << "if (obj==0) obj = new " << cl->GetName() << ";" << std::endl;
469
470 int n;
471 for (n = 0; n <= elements->GetLast(); n++) {
472
473 TStreamerElement *el = dynamic_cast<TStreamerElement *>(elements->At(n));
474 if (el == 0)
475 continue;
476
477 Int_t typ = el->GetType();
478
479 switch (typ) {
480 // basic types
497 char endch[5];
498 fs << tab2 << ElementSetter(cl, el->GetName(), endch);
499 fs << "buf." << GetBasicTypeReaderMethodName(el->GetType(), 0) << "(\"" << el->GetName() << "\")" << endch
500 << ";" << std::endl;
501 continue;
502 }
503
504 // array of basic types like bool[10]
520 fs << tab2 << "buf.ReadArray(" << ElementGetter(cl, el->GetName(), (el->GetArrayDim() > 1) ? 1 : 0);
521 fs << ", " << el->GetArrayLength() << ", \"" << el->GetName() << "\");" << std::endl;
522 continue;
523 }
524
525 // array of basic types like bool[n]
541 TStreamerBasicPointer *elp = dynamic_cast<TStreamerBasicPointer *>(el);
542 if (elp == 0) {
543 std::cout << "fatal error with TStreamerBasicPointer" << std::endl;
544 continue;
545 }
546 char endch[5];
547
548 fs << tab2 << ElementSetter(cl, el->GetName(), endch);
549 fs << "buf.ReadArray(" << ElementGetter(cl, el->GetName());
550 fs << ", " << ElementGetter(cl, elp->GetCountName());
551 fs << ", \"" << el->GetName() << "\", true)" << endch << ";" << std::endl;
552 continue;
553 }
554
556 char endch[5];
557 fs << tab2 << ElementSetter(cl, el->GetName(), endch);
558 fs << "buf.ReadCharStar(" << ElementGetter(cl, el->GetName());
559 fs << ", \"" << el->GetName() << "\")" << endch << ";" << std::endl;
560 continue;
561 }
562
564 fs << tab2 << GetStreamerName(el->GetClassPointer()) << "(buf, dynamic_cast<"
565 << el->GetClassPointer()->GetName() << "*>(obj), false);" << std::endl;
566 continue;
567 }
568
569 // Class* Class not derived from TObject and with comment field //->
572 if (el->GetArrayLength() > 0) {
573 fs << tab2 << "buf.ReadObjectArr(" << ElementGetter(cl, el->GetName());
574 fs << ", " << el->GetArrayLength() << ", -1"
575 << ", \"" << el->GetName() << "\", " << GetStreamerName(el->GetClassPointer()) << ");" << std::endl;
576 } else {
577 fs << tab2 << "buf.ReadObject(" << ElementGetter(cl, el->GetName());
578 fs << ", \"" << el->GetName() << "\", " << GetStreamerName(el->GetClassPointer()) << ");" << std::endl;
579 }
580 continue;
581 }
582
583 // Class* Class not derived from TObject and no comment
586 if (el->GetArrayLength() > 0) {
587 fs << tab2 << "for (int n=0;n<" << el->GetArrayLength() << ";n++) "
588 << "delete (" << ElementGetter(cl, el->GetName()) << ")[n];" << std::endl;
589 fs << tab2 << "buf.ReadObjectPtrArr((void**) " << ElementGetter(cl, el->GetName(), 3);
590 fs << ", " << el->GetArrayLength() << ", \"" << el->GetName() << "\", "
591 << GetStreamerName(el->GetClassPointer()) << ");" << std::endl;
592 } else {
593 char endch[5];
594
595 fs << tab2 << "delete " << ElementGetter(cl, el->GetName()) << ";" << std::endl;
596 fs << tab2 << ElementSetter(cl, el->GetName(), endch);
597 fs << "(" << el->GetClassPointer()->GetName() << "*) buf.ReadObjectPtr(\"" << el->GetName() << "\", "
598 << GetStreamerName(el->GetClassPointer()) << ")" << endch << ";" << std::endl;
599 }
600 continue;
601 }
602
603 // Class NOT derived from TObject
605 fs << tab2 << "buf.ReadObject(" << ElementGetter(cl, el->GetName(), 2);
606 fs << ", \"" << el->GetName() << "\", " << GetStreamerName(el->GetClassPointer()) << ");" << std::endl;
607 continue;
608 }
609
610 // Class NOT derived from TObject, array
612 fs << tab2 << "buf.ReadObjectArr(" << ElementGetter(cl, el->GetName());
613 fs << ", " << el->GetArrayLength() << ", sizeof(" << el->GetClassPointer()->GetName() << "), \""
614 << el->GetName() << "\", " << GetStreamerName(el->GetClassPointer()) << ");" << std::endl;
615 continue;
616 }
617
618 // container with no virtual table (stl) and no comment
623 TStreamerSTL *elstl = dynamic_cast<TStreamerSTL *>(el);
624 if (elstl == 0)
625 break; // to make skip
626
627 if (ProduceSTLstreamer(fs, cl, elstl, false))
628 continue;
629
630 fs << tab2 << "// STL type = " << elstl->GetSTLtype() << std::endl;
631 break;
632 }
633 }
634 fs << tab2 << "buf.SkipMember(\"" << el->GetName() << "\"); // sinfo type " << el->GetType() << " of class "
635 << el->GetClassPointer()->GetName() << " not supported" << std::endl;
636 }
637
638 fs << tab2 << "buf.EndClassNode();" << std::endl;
639
640 fs << tab1 << "} else {" << std::endl;
641
642 // generation of writing part of class streamer
643
644 fs << tab2 << "if (obj==0) return 0;" << std::endl;
645
646 firstchild = true;
647 iter.Reset();
648 while ((c1 = (TClass *)iter()) != 0) {
649 if (c1 == cl)
650 continue;
651 if (c1->GetListOfBases()->FindObject(cl->GetName()) == 0)
652 continue;
653 if (firstchild) {
654 firstchild = false;
655 fs << tab2 << "if (checktypes) {" << std::endl;
656 }
657 fs << tab3 << "if (dynamic_cast<" << c1->GetName() << "*>(obj))" << std::endl;
658 fs << tab4 << "return " << GetStreamerName(c1) << "(buf, dynamic_cast<" << c1->GetName() << "*>(obj));"
659 << std::endl;
660 }
661 if (!firstchild)
662 fs << tab2 << "}" << std::endl;
663
664 fs << tab2 << "buf.StartClassNode(\"" << cl->GetName() << "\", " << info->GetClassVersion() << ");" << std::endl;
665
666 for (n = 0; n <= elements->GetLast(); n++) {
667
668 TStreamerElement *el = dynamic_cast<TStreamerElement *>(elements->At(n));
669 if (el == 0)
670 continue;
671
672 Int_t typ = el->GetType();
673
674 switch (typ) {
675 // write basic types
692 fs << tab2 << "buf.WriteValue(";
694 fs << "(unsigned char) " << ElementGetter(cl, el->GetName());
695 else
696 fs << ElementGetter(cl, el->GetName());
697 fs << ", \"" << el->GetName() << "\");" << std::endl;
698 continue;
699 }
700
701 // array of basic types
717 fs << tab2 << "buf.WriteArray(" << ElementGetter(cl, el->GetName(), (el->GetArrayDim() > 1) ? 1 : 0);
718 fs << ", " << el->GetArrayLength() << ", \"" << el->GetName() << "\");" << std::endl;
719 continue;
720 }
721
737 TStreamerBasicPointer *elp = dynamic_cast<TStreamerBasicPointer *>(el);
738 if (elp == 0) {
739 std::cout << "fatal error with TStreamerBasicPointer" << std::endl;
740 continue;
741 }
742 fs << tab2 << "buf.WriteArray(" << ElementGetter(cl, el->GetName());
743 fs << ", " << ElementGetter(cl, elp->GetCountName()) << ", \"" << el->GetName() << "\", true);" << std::endl;
744 continue;
745 }
746
748 fs << tab2 << "buf.WriteCharStar(" << ElementGetter(cl, el->GetName()) << ", \"" << el->GetName() << "\");"
749 << std::endl;
750 continue;
751 }
752
754 fs << tab2 << GetStreamerName(el->GetClassPointer()) << "(buf, dynamic_cast<"
755 << el->GetClassPointer()->GetName() << "*>(obj), false);" << std::endl;
756 continue;
757 }
758
759 // Class* Class not derived from TObject and with comment field //->
762 if (el->GetArrayLength() > 0) {
763 fs << tab2 << "buf.WriteObjectArr(" << ElementGetter(cl, el->GetName());
764 fs << ", " << el->GetArrayLength() << ", -1"
765 << ", \"" << el->GetName() << "\", " << GetStreamerName(el->GetClassPointer()) << ");" << std::endl;
766 } else {
767 fs << tab2 << "buf.WriteObject(" << ElementGetter(cl, el->GetName());
768 fs << ", \"" << el->GetName() << "\", " << GetStreamerName(el->GetClassPointer()) << ");" << std::endl;
769 }
770 continue;
771 }
772
773 // Class* Class not derived from TObject and no comment
776 if (el->GetArrayLength() > 0) {
777 fs << tab2 << "buf.WriteObjectPtrArr((void**) " << ElementGetter(cl, el->GetName(), 3);
778 fs << ", " << el->GetArrayLength() << ", \"" << el->GetName() << "\", "
779 << GetStreamerName(el->GetClassPointer()) << ");" << std::endl;
780 } else {
781 fs << tab2 << "buf.WriteObjectPtr(" << ElementGetter(cl, el->GetName());
782 fs << ", \"" << el->GetName() << "\", " << GetStreamerName(el->GetClassPointer()) << ");" << std::endl;
783 }
784 continue;
785 }
786
787 case TVirtualStreamerInfo::kAny: { // Class NOT derived from TObject
788 fs << tab2 << "buf.WriteObject(" << ElementGetter(cl, el->GetName(), 2);
789 fs << ", \"" << el->GetName() << "\", " << GetStreamerName(el->GetClassPointer()) << ");" << std::endl;
790 continue;
791 }
792
794 fs << tab2 << "buf.WriteObjectArr(" << ElementGetter(cl, el->GetName());
795 fs << ", " << el->GetArrayLength() << ", sizeof(" << el->GetClassPointer()->GetName() << "), \""
796 << el->GetName() << "\", " << GetStreamerName(el->GetClassPointer()) << ");" << std::endl;
797 continue;
798 }
799
800 // container with no virtual table (stl) and no comment
805 TStreamerSTL *elstl = dynamic_cast<TStreamerSTL *>(el);
806 if (elstl == 0)
807 break; // to make skip
808
809 if (ProduceSTLstreamer(fs, cl, elstl, true))
810 continue;
811 fs << tab2 << "// STL type = " << elstl->GetSTLtype() << std::endl;
812 break;
813 }
814 }
815 fs << tab2 << "buf.MakeEmptyMember(\"" << el->GetName() << "\"); // sinfo type " << el->GetType()
816 << " of class " << el->GetClassPointer()->GetName() << " not supported" << std::endl;
817 }
818
819 fs << tab2 << "buf.EndClassNode();" << std::endl;
820
821 fs << tab1 << "}" << std::endl;
822 fs << tab1 << "return obj;" << std::endl;
823 fs << "}" << std::endl << std::endl;
824}
825
826////////////////////////////////////////////////////////////////////////////////
827/// Produce code to read argument of stl container from xml file
828
829void TXMLPlayer::ReadSTLarg(std::ostream &fs, TString &argname, int argtyp, Bool_t isargptr, TClass *argcl,
830 TString &tname, TString &ifcond)
831{
832 switch (argtyp) {
849 fs << tname << " " << argname << " = buf." << GetBasicTypeReaderMethodName(argtyp, tname.Data()) << "(0);"
850 << std::endl;
851 break;
852 }
853
855 fs << tname << (isargptr ? " " : " *") << argname << " = "
856 << "(" << argcl->GetName() << "*)"
857 << "buf.ReadObjectPtr(0, " << GetStreamerName(argcl) << ");" << std::endl;
858 if (!isargptr) {
859 if (ifcond.Length() > 0)
860 ifcond += " && ";
861 ifcond += argname;
862 TString buf = "*";
863 buf += argname;
864 argname = buf;
865 }
866 break;
867 }
868
870 fs << "string *" << argname << " = "
871 << "buf.ReadSTLstring();" << std::endl;
872 if (!isargptr) {
873 if (ifcond.Length() > 0)
874 ifcond += " && ";
875 ifcond += argname;
876 TString buf = "*";
877 buf += argname;
878 argname = buf;
879 }
880 break;
881 }
882
883 default: fs << "/* argument " << argname << " not supported */";
884 }
885}
886
887////////////////////////////////////////////////////////////////////////////////
888/// Produce code to write argument of stl container to xml file
889
890void TXMLPlayer::WriteSTLarg(std::ostream &fs, const char *accname, int argtyp, Bool_t isargptr, TClass *argcl)
891{
892 switch (argtyp) {
909 fs << "buf.WriteValue(" << accname << ", 0);" << std::endl;
910 break;
911 }
912
914 fs << "buf.WriteObjectPtr(";
915 if (isargptr)
916 fs << accname;
917 else
918 fs << "&(" << accname << ")";
919 fs << ", 0, " << GetStreamerName(argcl) << ");" << std::endl;
920 break;
921 }
922
924 fs << "buf.WriteSTLstring(";
925 if (isargptr)
926 fs << accname;
927 else
928 fs << "&(" << accname << ")";
929 fs << ");" << std::endl;
930 break;
931 }
932
933 default: fs << "/* argument not supported */" << std::endl;
934 }
935}
936
937////////////////////////////////////////////////////////////////////////////////
938/// Produce code of xml streamer for data member of stl type
939
940Bool_t TXMLPlayer::ProduceSTLstreamer(std::ostream &fs, TClass *cl, TStreamerSTL *el, Bool_t isWriting)
941{
942 if ((cl == 0) || (el == 0))
943 return false;
944
945 TClass *contcl = el->GetClassPointer();
946
947 Bool_t isstr = (el->GetSTLtype() == ROOT::kSTLstring);
948 Bool_t isptr = el->IsaPointer();
949 Bool_t isarr = (el->GetArrayLength() > 0);
950 Bool_t isparent = (strcmp(el->GetName(), contcl->GetName()) == 0);
951
952 int stltyp = -1;
953 int narg = 0;
954 int argtype[2];
955 Bool_t isargptr[2];
956 TClass *argcl[2];
957 TString argtname[2];
958
959 if (!isstr && contcl->GetCollectionType() != ROOT::kNotSTL) {
960 int nestedLoc = 0;
961 std::vector<std::string> splitName;
962 TClassEdit::GetSplit(contcl->GetName(), splitName, nestedLoc);
963
964 stltyp = contcl->GetCollectionType();
965 switch (stltyp) {
966 case ROOT::kSTLvector: narg = 1; break;
967 case ROOT::kSTLlist: narg = 1; break;
968 case ROOT::kSTLforwardlist: narg = 1; break;
969 case ROOT::kSTLdeque: narg = 1; break;
970 case ROOT::kSTLmap: narg = 2; break;
971 case ROOT::kSTLmultimap: narg = 2; break;
972 case ROOT::kSTLset: narg = 1; break;
973 case ROOT::kSTLmultiset: narg = 1; break;
974 case ROOT::kSTLunorderedset: narg = 1; break;
975 case ROOT::kSTLunorderedmultiset: narg = 1; break;
976 case ROOT::kSTLunorderedmap: narg = 2; break;
977 case ROOT::kSTLunorderedmultimap: narg = 2; break;
978
979 default: return false;
980 }
981
982 for (int n = 0; n < narg; n++) {
983 argtype[n] = -1;
984 isargptr[n] = false;
985 argcl[n] = 0;
986 argtname[n] = "";
987
988 TString buf = splitName[n + 1];
989
990 argtname[n] = buf;
991
992 // nested STL containers not yet supported
993 if (TClassEdit::IsSTLCont(buf.Data()))
994 return false;
995
996 int pstar = buf.Index("*");
997
998 if (pstar > 0) {
999 isargptr[n] = true;
1000 pstar--;
1001 while ((pstar > 0) && (buf[pstar] == ' '))
1002 pstar--;
1003 buf.Remove(pstar + 1);
1004 } else
1005 isargptr[n] = false;
1006
1007 if (buf.Index("const ") == 0) {
1008 buf.Remove(0, 6);
1009 while ((buf.Length() > 0) && (buf[0] == ' '))
1010 buf.Remove(0, 1);
1011 }
1012
1013 TDataType *dt = (TDataType *)gROOT->GetListOfTypes()->FindObject(buf);
1014 if (dt)
1015 argtype[n] = dt->GetType();
1016 else if (buf == "string")
1018 else {
1019 argcl[n] = TClass::GetClass(buf);
1020 if (argcl[n] != 0)
1022 }
1023 if (argtype[n] < 0)
1024 stltyp = -1;
1025 } // for narg
1026
1027 if (stltyp < 0)
1028 return false;
1029 }
1030
1031 Bool_t akaarrayaccess = (narg == 1) && (argtype[0] < 20);
1032
1033 char tabs[30], tabs2[30];
1034
1035 if (isWriting) {
1036
1037 fs << tab2 << "if (buf.StartSTLnode(\"" << fXmlSetup.XmlGetElementName(el) << "\")) {" << std::endl;
1038
1039 fs << tab3 << contcl->GetName() << " ";
1040
1041 TString accname;
1042 if (isptr) {
1043 if (isarr) {
1044 fs << "**cont";
1045 accname = "(*cont)->";
1046 } else {
1047 fs << "*cont";
1048 accname = "cont->";
1049 }
1050 } else if (isarr) {
1051 fs << "*cont";
1052 accname = "cont->";
1053 } else {
1054 fs << "&cont";
1055 accname = "cont.";
1056 }
1057
1058 fs << " = ";
1059
1060 if (isparent)
1061 fs << "*dynamic_cast<" << contcl->GetName() << "*>(obj);" << std::endl;
1062 else
1063 fs << ElementGetter(cl, el->GetName()) << ";" << std::endl;
1064
1065 if (isarr && el->GetArrayLength()) {
1066 strlcpy(tabs, tab4, sizeof(tabs));
1067 fs << tab3 << "for(int n=0;n<" << el->GetArrayLength() << ";n++) {" << std::endl;
1068 } else
1069 strlcpy(tabs, tab3, sizeof(tabs));
1070
1071 strlcpy(tabs2, tabs, sizeof(tabs2));
1072
1073 if (isptr) {
1074 strlcat(tabs2, tab1, sizeof(tabs2));
1075 fs << tabs << "if (" << (isarr ? "*cont" : "cont") << "==0) {" << std::endl;
1076 fs << tabs2 << "buf.WriteSTLsize(0" << (isstr ? ",true);" : ");") << std::endl;
1077 fs << tabs << "} else {" << std::endl;
1078 }
1079
1080 fs << tabs2 << "buf.WriteSTLsize(" << accname << (isstr ? "length(), true);" : "size());") << std::endl;
1081
1082 if (isstr) {
1083 fs << tabs2 << "buf.WriteSTLstringData(" << accname << "c_str());" << std::endl;
1084 } else {
1085 if (akaarrayaccess) {
1086 fs << tabs2 << argtname[0] << "* arr = new " << argtname[0] << "[" << accname << "size()];" << std::endl;
1087 fs << tabs2 << "int k = 0;" << std::endl;
1088 }
1089
1090 fs << tabs2 << contcl->GetName() << "::const_iterator iter;" << std::endl;
1091 fs << tabs2 << "for (iter = " << accname << "begin(); iter != " << accname << "end(); iter++)";
1092 if (akaarrayaccess) {
1093 fs << std::endl << tabs2 << tab1 << "arr[k++] = *iter;" << std::endl;
1094 fs << tabs2 << "buf.WriteArray(arr, " << accname << "size(), 0, false);" << std::endl;
1095 fs << tabs2 << "delete[] arr;" << std::endl;
1096 } else if (narg == 1) {
1097 fs << std::endl << tabs2 << tab1;
1098 WriteSTLarg(fs, "*iter", argtype[0], isargptr[0], argcl[0]);
1099 } else if (narg == 2) {
1100 fs << " {" << std::endl;
1101 fs << tabs2 << tab1;
1102 WriteSTLarg(fs, "iter->first", argtype[0], isargptr[0], argcl[0]);
1103 fs << tabs2 << tab1;
1104 WriteSTLarg(fs, "iter->second", argtype[1], isargptr[1], argcl[1]);
1105 fs << tabs2 << "}" << std::endl;
1106 }
1107 } // if (isstr)
1108
1109 if (isptr)
1110 fs << tabs << "}" << std::endl;
1111
1112 if (isarr && el->GetArrayLength()) {
1113 if (isptr)
1114 fs << tabs << "cont++;" << std::endl;
1115 else
1116 fs << tabs << "(void*) cont = (char*) cont + sizeof(" << contcl->GetName() << ");" << std::endl;
1117 fs << tab3 << "}" << std::endl;
1118 }
1119
1120 fs << tab3 << "buf.EndSTLnode();" << std::endl;
1121 fs << tab2 << "}" << std::endl;
1122
1123 } else {
1124
1125 fs << tab2 << "if (buf.VerifySTLnode(\"" << fXmlSetup.XmlGetElementName(el) << "\")) {" << std::endl;
1126
1127 fs << tab3 << contcl->GetName() << " ";
1128 TString accname, accptr;
1129 if (isptr) {
1130 if (isarr) {
1131 fs << "**cont";
1132 accname = "(*cont)->";
1133 accptr = "*cont";
1134 } else {
1135 fs << "*cont";
1136 accname = "cont->";
1137 accptr = "cont";
1138 }
1139 } else if (isarr) {
1140 fs << "*cont";
1141 accname = "cont->";
1142 } else {
1143 fs << "&cont";
1144 accname = "cont.";
1145 }
1146
1147 fs << " = ";
1148
1149 if (isparent)
1150 fs << "*dynamic_cast<" << contcl->GetName() << "*>(obj);" << std::endl;
1151 else
1152 fs << ElementGetter(cl, el->GetName()) << ";" << std::endl;
1153
1154 if (isarr && el->GetArrayLength()) {
1155 strlcpy(tabs, tab4, sizeof(tabs));
1156 fs << tab3 << "for(int n=0;n<" << el->GetArrayLength() << ";n++) {" << std::endl;
1157 } else
1158 strlcpy(tabs, tab3, sizeof(tabs));
1159
1160 fs << tabs << "int size = buf.ReadSTLsize(" << (isstr ? "true);" : ");") << std::endl;
1161
1162 if (isptr) {
1163 fs << tabs << "delete " << accptr << ";" << std::endl;
1164 fs << tabs << "if (size==0) " << accptr << " = 0;" << std::endl;
1165 fs << tabs << " else " << accptr << " = new " << contcl->GetName() << ";" << std::endl;
1166 if (!isarr) {
1167 char endch[5];
1168 fs << tabs << ElementSetter(cl, el->GetName(), endch);
1169 fs << "cont" << endch << ";" << std::endl;
1170 }
1171 } else {
1172 fs << tabs << accname << (isstr ? "erase();" : "clear();") << std::endl;
1173 }
1174
1175 if (isstr) {
1176 fs << tabs << "if (size>0) " << accname << "assign(buf.ReadSTLstringData(size));" << std::endl;
1177 } else {
1178 if (akaarrayaccess) {
1179 fs << tabs << argtname[0] << "* arr = new " << argtname[0] << "[size];" << std::endl;
1180 fs << tabs << "buf.ReadArray(arr, size, 0, false);" << std::endl;
1181 }
1182
1183 fs << tabs << "for(int k=0;k<size;k++)";
1184
1185 if (akaarrayaccess) {
1186 fs << std::endl << tabs << tab1 << accname;
1187 if ((stltyp == ROOT::kSTLset) || (stltyp == ROOT::kSTLmultiset))
1188 fs << "insert";
1189 else
1190 fs << "push_back";
1191 fs << "(arr[k]);" << std::endl;
1192 fs << tabs << "delete[] arr;" << std::endl;
1193 } else if (narg == 1) {
1194 TString arg1("arg"), ifcond;
1195 fs << " {" << std::endl << tabs << tab1;
1196 ReadSTLarg(fs, arg1, argtype[0], isargptr[0], argcl[0], argtname[0], ifcond);
1197 fs << tabs << tab1;
1198 if (ifcond.Length() > 0)
1199 fs << "if (" << ifcond << ") ";
1200 fs << accname;
1201 if ((stltyp == ROOT::kSTLset) || (stltyp == ROOT::kSTLmultiset))
1202 fs << "insert";
1203 else
1204 fs << "push_back";
1205 fs << "(" << arg1 << ");" << std::endl;
1206 fs << tabs << "}" << std::endl;
1207 } else if (narg == 2) {
1208 TString arg1("arg1"), arg2("arg2"), ifcond;
1209 fs << " {" << std::endl << tabs << tab1;
1210 ReadSTLarg(fs, arg1, argtype[0], isargptr[0], argcl[0], argtname[0], ifcond);
1211 fs << tabs << tab1;
1212 ReadSTLarg(fs, arg2, argtype[1], isargptr[1], argcl[1], argtname[1], ifcond);
1213 fs << tabs << tab1;
1214 if (ifcond.Length() > 0)
1215 fs << "if (" << ifcond << ") ";
1216 fs << accname << "insert(make_pair(" << arg1 << ", " << arg2 << "));" << std::endl;
1217 fs << tabs << "}" << std::endl;
1218 }
1219 }
1220
1221 if (isarr && el->GetArrayLength()) {
1222 if (isptr)
1223 fs << tabs << "cont++;" << std::endl;
1224 else
1225 fs << tabs << "(void*) cont = (char*) cont + sizeof(" << contcl->GetName() << ");" << std::endl;
1226 fs << tab3 << "}" << std::endl;
1227 }
1228
1229 fs << tab3 << "buf.EndSTLnode();" << std::endl;
1230 fs << tab2 << "}" << std::endl;
1231 }
1232 return true;
1233}
const Bool_t kFALSE
Definition: RtypesCore.h:90
const Bool_t kTRUE
Definition: RtypesCore.h:89
#define ClassImp(name)
Definition: Rtypes.h:361
@ kFloat_t
Definition: TDataType.h:31
@ kULong64_t
Definition: TDataType.h:32
@ kInt_t
Definition: TDataType.h:30
@ kLong_t
Definition: TDataType.h:30
@ kDouble32_t
Definition: TDataType.h:31
@ kShort_t
Definition: TDataType.h:29
@ kBool_t
Definition: TDataType.h:32
@ kULong_t
Definition: TDataType.h:30
@ kLong64_t
Definition: TDataType.h:32
@ kUShort_t
Definition: TDataType.h:29
@ kDouble_t
Definition: TDataType.h:31
@ kChar_t
Definition: TDataType.h:29
@ kUChar_t
Definition: TDataType.h:29
@ kUInt_t
Definition: TDataType.h:30
@ kFloat16_t
Definition: TDataType.h:33
@ kIsPublic
Definition: TDictionary.h:75
@ kIsConstant
Definition: TDictionary.h:88
int type
Definition: TGX11.cxx:120
#define gROOT
Definition: TROOT.h:406
const char * tab1
Definition: TXMLPlayer.cxx:121
const char * tab3
Definition: TXMLPlayer.cxx:123
const char * tab2
Definition: TXMLPlayer.cxx:122
const char * tab4
Definition: TXMLPlayer.cxx:124
const char * names_xmlfileclass
Definition: TXMLPlayer.cxx:126
TClass instances represent classes, structs and namespaces in the ROOT type system.
Definition: TClass.h:80
TDataMember * GetDataMember(const char *datamember) const
Return pointer to datamember object with name "datamember".
Definition: TClass.cxx:3407
ROOT::ESTLType GetCollectionType() const
Return the 'type' of the STL the TClass is representing.
Definition: TClass.cxx:2866
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,...
Definition: TClass.cxx:4562
TClass * GetBaseDataMember(const char *datamember)
Return pointer to (base) class that contains datamember.
Definition: TClass.cxx:2807
const char * GetDeclFileName() const
Return name of the file containing the declaration of this class.
Definition: TClass.cxx:3431
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.
Definition: TClass.cxx:2948
All ROOT classes may have RTTI (run time type identification) support added.
Definition: TDataMember.h:31
TMethodCall * SetterMethod(TClass *cl)
Return a TMethodCall method responsible for setting the value of data member.
Long_t GetOffset() const
Get offset from "this".
Int_t GetArrayDim() const
Return number of array dimensions.
Bool_t IsEnum() const
Return true if data member is an enum.
Bool_t IsBasic() const
Return true if data member is a basic type, e.g. char, int, long...
Bool_t IsaPointer() const
Return true if data member is a pointer.
TDataType * GetDataType() const
Definition: TDataMember.h:76
const char * GetTypeName() const
Get type of data member, e,g.: "class TDirectory*" -> "TDirectory".
TMethodCall * GetterMethod(TClass *cl=0)
Return a TMethodCall method responsible for getting the value of data member.
Long_t Property() const
Get property description word. For meaning of bits see EProperty.
Basic data type descriptor (datatype information is obtained from CINT).
Definition: TDataType.h:44
Int_t GetType() const
Definition: TDataType.h:68
TString GetTypeName()
Get basic type of typedef, e,g.
Definition: TDataType.cxx:149
Long_t Property() const
Get property description word. For meaning of bits see EProperty.
Definition: TFunction.cxx:183
void Reset()
Definition: TCollection.h:252
A doubly linked list.
Definition: TList.h:44
Method or function calling interface.
Definition: TMethodCall.h:37
const char * GetMethodName() const
Definition: TMethodCall.h:90
TFunction * GetMethod()
Returns the TMethod describing the method to be executed.
The TNamed class is the base class for all named ROOT classes.
Definition: TNamed.h:29
virtual const char * GetName() const
Returns name of object.
Definition: TNamed.h:47
An array of TObjects.
Definition: TObjArray.h:37
void Add(TObject *obj)
Definition: TObjArray.h:74
virtual void Delete(Option_t *option="")
Remove all objects from the array AND delete all heap based objects.
Definition: TObjArray.cxx:356
virtual TObject * FindObject(const char *name) const
Find an object in this collection using its name.
Definition: TObjArray.cxx:415
Int_t GetLast() const
Return index of last object in array.
Definition: TObjArray.cxx:577
TObject * At(Int_t idx) const
Definition: TObjArray.h:166
Mother of all ROOT objects.
Definition: TObject.h:37
const char * GetCountName() const
Int_t GetType() const
virtual TClass * GetClassPointer() const
Returns a pointer to the TClass of this element.
Int_t GetArrayDim() const
Int_t GetArrayLength() const
const char * GetTypeNameBasic() const
Return type name of this element in case the type name is not a standard basic type,...
Int_t GetSTLtype() const
Bool_t IsaPointer() const
Return true if the data member is a pointer.
Basic string class.
Definition: TString.h:131
Ssiz_t Length() const
Definition: TString.h:405
const char * Data() const
Definition: TString.h:364
@ kIgnoreCase
Definition: TString.h:263
TString & Remove(Ssiz_t pos)
Definition: TString.h:668
Ssiz_t Index(const char *pat, Ssiz_t i=0, ECaseCompare cmp=kExact) const
Definition: TString.h:634
Abstract Interface class describing Streamer information for one class.
virtual TObjArray * GetElements() const =0
virtual Int_t GetClassVersion() const =0
TString GetMemberTypeName(TDataMember *member)
returns name of simple data type for given data member
Definition: TXMLPlayer.cxx:219
Bool_t ProduceCode(TList *cllist, const char *filename)
Produce streamers for provide class list TList should include list of classes, for which code should ...
Definition: TXMLPlayer.cxx:164
TString GetStreamerName(TClass *cl)
returns streamer function name for given class
Definition: TXMLPlayer.cxx:147
TString fSetterName
buffer for name of getter method
Definition: TXMLPlayer.h:50
const char * ElementGetter(TClass *cl, const char *membername, int specials=0)
produce code to access member of given class.
Definition: TXMLPlayer.cxx:330
TXMLSetup fXmlSetup
buffer for name of setter method
Definition: TXMLPlayer.h:51
virtual ~TXMLPlayer()
destructor of TXMLPlayer object
Definition: TXMLPlayer.cxx:140
TString GetBasicTypeName(TStreamerElement *el)
return simple data types for given TStreamerElement object
Definition: TXMLPlayer.cxx:257
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.
Definition: TXMLPlayer.cxx:829
TXMLPlayer()
default constructor
Definition: TXMLPlayer.cxx:133
TString GetBasicTypeReaderMethodName(Int_t type, const char *realname)
return functions name to read simple data type from xml file
Definition: TXMLPlayer.cxx:290
void ProduceStreamerSource(std::ostream &fs, TClass *cl, TList *cllist)
Produce source code of streamer function for specified class.
Definition: TXMLPlayer.cxx:426
TString fGetterName
Definition: TXMLPlayer.h:49
Bool_t ProduceSTLstreamer(std::ostream &fs, TClass *cl, TStreamerSTL *el, Bool_t isWriting)
Produce code of xml streamer for data member of stl type.
Definition: TXMLPlayer.cxx:940
const char * ElementSetter(TClass *cl, const char *membername, char *endch)
Produce code to set value to given data member.
Definition: TXMLPlayer.cxx:389
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.
Definition: TXMLPlayer.cxx:890
const char * XmlGetElementName(const TStreamerElement *el)
return converted name for TStreamerElement
Definition: TXMLSetup.cxx:237
return c1
Definition: legend1.C:41
const Int_t n
Definition: legend1.C:16
@ kSTLmap
Definition: ESTLType.h:33
@ kSTLunorderedmultiset
Definition: ESTLType.h:43
@ kSTLstring
Definition: ESTLType.h:48
@ kSTLset
Definition: ESTLType.h:35
@ kSTLmultiset
Definition: ESTLType.h:36
@ kSTLdeque
Definition: ESTLType.h:32
@ kSTLvector
Definition: ESTLType.h:30
@ kSTLunorderedmultimap
Definition: ESTLType.h:45
@ kSTLunorderedset
Definition: ESTLType.h:42
@ kSTLlist
Definition: ESTLType.h:31
@ kSTLforwardlist
Definition: ESTLType.h:41
@ kSTLunorderedmap
Definition: ESTLType.h:44
@ kNotSTL
Definition: ESTLType.h:29
@ kSTLmultimap
Definition: ESTLType.h:34
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.
Definition: first.py:1