Logo ROOT  
Reference Guide
 
Loading...
Searching...
No Matches
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 "TROOT.h"
107#include "TList.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 "strlcpy.h"
119#include <iostream>
120#include <fstream>
121#include <string>
122#include <vector>
123
124const char *tab1 = " ";
125const char *tab2 = " ";
126const char *tab3 = " ";
127const char *tab4 = " ";
128
129const char *names_xmlfileclass = "TXmlFile";
130
132
133////////////////////////////////////////////////////////////////////////////////
134/// default constructor
135
137{
138}
139
140////////////////////////////////////////////////////////////////////////////////
141/// destructor of TXMLPlayer object
142
144{
145}
146
147////////////////////////////////////////////////////////////////////////////////
148/// returns streamer function name for given class
149
151{
152 if (cl == 0)
153 return "";
154 TString res = cl->GetName();
155 res += "_streamer";
156 return res;
157}
158
159////////////////////////////////////////////////////////////////////////////////
160/// Produce streamers for provide class list
161/// TList should include list of classes, for which code should be generated.
162/// filename specify name of file (without extension), where streamers should be
163/// created. Function produces two files: header file and source file.
164/// For instance, if filename is "streamers", files "streamers.h" and "streamers.cxx"
165/// will be created.
166
167Bool_t TXMLPlayer::ProduceCode(TList *cllist, const char *filename)
168{
169 if ((cllist == 0) || (filename == 0))
170 return kFALSE;
171
172 std::ofstream fh(TString(filename) + ".h");
173 std::ofstream fs(TString(filename) + ".cxx");
174
175 fh << "// generated header file" << std::endl << std::endl;
176 fh << "#ifndef " << filename << "_h" << std::endl;
177 fh << "#define " << filename << "_h" << std::endl << std::endl;
178
179 fh << "#include \"" << names_xmlfileclass << ".h\"" << std::endl << std::endl;
180
181 fs << "// generated source file" << std::endl << std::endl;
182 fs << "#include \"" << filename << ".h\"" << std::endl << std::endl;
183
184 // produce appropriate include for all classes
185
186 TObjArray inclfiles;
187 TIter iter(cllist);
188 TClass *cl = 0;
189 while ((cl = (TClass *)iter()) != 0) {
190 if (inclfiles.FindObject(cl->GetDeclFileName()) == 0) {
191 fs << "#include \"" << cl->GetDeclFileName() << "\"" << std::endl;
192 inclfiles.Add(new TNamed(cl->GetDeclFileName(), ""));
193 }
194 }
195 inclfiles.Delete();
196
197 fh << std::endl;
198 fs << std::endl;
199
200 // produce streamers declarations and implementations
201
202 iter.Reset();
203
204 while ((cl = (TClass *)iter()) != 0) {
205
206 fh << "extern void* " << GetStreamerName(cl) << "(" << names_xmlfileclass
207 << " &buf, void* ptr = 0, bool checktypes = true);" << std::endl
208 << std::endl;
209
210 ProduceStreamerSource(fs, cl, cllist);
211 }
212
213 fh << "#endif" << std::endl << std::endl;
214 fs << std::endl << std::endl;
215
216 return kTRUE;
217}
218
219////////////////////////////////////////////////////////////////////////////////
220/// returns name of simple data type for given data member
221
223{
224 if (member == 0)
225 return "int";
226
227 if (member->IsBasic())
228 switch (member->GetDataType()->GetType()) {
229 case kChar_t: return "char";
230 case kShort_t: return "short";
231 case kInt_t: return "int";
232 case kLong_t: return "long";
233 case kLong64_t: return "long long";
234 case kFloat16_t:
235 case kFloat_t: return "float";
236 case kDouble32_t:
237 case kDouble_t: return "double";
238 case kUChar_t: {
239 char first = member->GetDataType()->GetTypeName()[0];
240 if ((first == 'B') || (first == 'b'))
241 return "bool";
242 return "unsigned char";
243 }
244 case kBool_t: return "bool";
245 case kUShort_t: return "unsigned short";
246 case kUInt_t: return "unsigned int";
247 case kULong_t: return "unsigned long";
248 case kULong64_t: return "unsigned long long";
249 }
250
251 if (member->IsEnum())
252 return "int";
253
254 return member->GetTypeName();
255}
256
257////////////////////////////////////////////////////////////////////////////////
258/// return simple data types for given TStreamerElement object
259
261{
263 return "int";
264
265 switch (el->GetType() % 20) {
266 case TVirtualStreamerInfo::kChar: return "char";
267 case TVirtualStreamerInfo::kShort: return "short";
268 case TVirtualStreamerInfo::kInt: return "int";
269 case TVirtualStreamerInfo::kLong: return "long";
270 case TVirtualStreamerInfo::kLong64: return "long long";
272 case TVirtualStreamerInfo::kFloat: return "float";
274 case TVirtualStreamerInfo::kDouble: return "double";
276 char first = el->GetTypeNameBasic()[0];
277 if ((first == 'B') || (first == 'b'))
278 return "bool";
279 return "unsigned char";
280 }
281 case TVirtualStreamerInfo::kBool: return "bool";
282 case TVirtualStreamerInfo::kUShort: return "unsigned short";
283 case TVirtualStreamerInfo::kUInt: return "unsigned int";
284 case TVirtualStreamerInfo::kULong: return "unsigned long";
285 case TVirtualStreamerInfo::kULong64: return "unsigned long long";
286 }
287 return "int";
288}
289
290////////////////////////////////////////////////////////////////////////////////
291/// return functions name to read simple data type from xml file
292
294{
296 return "ReadInt";
297
298 switch (type % 20) {
299 case TVirtualStreamerInfo::kChar: return "ReadChar";
300 case TVirtualStreamerInfo::kShort: return "ReadShort";
301 case TVirtualStreamerInfo::kInt: return "ReadInt";
302 case TVirtualStreamerInfo::kLong: return "ReadLong";
303 case TVirtualStreamerInfo::kLong64: return "ReadLong64";
305 case TVirtualStreamerInfo::kFloat: return "ReadFloat";
307 case TVirtualStreamerInfo::kDouble: return "ReadDouble";
309 Bool_t isbool = false;
310 if (realname != 0)
311 isbool = (TString(realname).Index("bool", 0, TString::kIgnoreCase) >= 0);
312 if (isbool)
313 return "ReadBool";
314 return "ReadUChar";
315 }
316 case TVirtualStreamerInfo::kBool: return "ReadBool";
317 case TVirtualStreamerInfo::kUShort: return "ReadUShort";
318 case TVirtualStreamerInfo::kUInt: return "ReadUInt";
319 case TVirtualStreamerInfo::kULong: return "ReadULong";
320 case TVirtualStreamerInfo::kULong64: return "ReadULong64";
321 }
322 return "ReadValue";
323}
324
325////////////////////////////////////////////////////////////////////////////////
326/// produce code to access member of given class.
327/// Parameter specials has following meaning:
328/// 0 - nothing special
329/// 1 - cast to data type
330/// 2 - produce pointer on given member
331/// 3 - skip casting when produce pointer by buf.P() function
332
333const char *TXMLPlayer::ElementGetter(TClass *cl, const char *membername, int specials)
334{
335 TClass *membercl = cl ? cl->GetBaseDataMember(membername) : 0;
336 TDataMember *member = membercl ? membercl->GetDataMember(membername) : 0;
337 TMethodCall *mgetter = member ? member->GetterMethod(0) : 0;
338
339 if ((mgetter != 0) && (mgetter->GetMethod()->Property() & kIsPublic)) {
340 fGetterName = "obj->";
341 fGetterName += mgetter->GetMethodName();
342 fGetterName += "()";
343 } else if ((member == 0) || ((member->Property() & kIsPublic) != 0)) {
344 fGetterName = "obj->";
345 fGetterName += membername;
346 } else {
347 fGetterName = "";
348 Bool_t deref = (member->GetArrayDim() == 0) && (specials != 2);
349 if (deref)
350 fGetterName += "*(";
351 if (specials != 3) {
352 fGetterName += "(";
353 if (member->Property() & kIsConstant)
354 fGetterName += "const ";
356 if (member->IsaPointer())
357 fGetterName += "*";
358 fGetterName += "*) ";
359 }
360 fGetterName += "buf.P(obj,";
361 fGetterName += member->GetOffset();
362 fGetterName += ")";
363 if (deref)
364 fGetterName += ")";
365 specials = 0;
366 }
367
368 if ((specials == 1) && (member != 0)) {
369 TString cast = "(";
370 cast += GetMemberTypeName(member);
371 if (member->IsaPointer() || (member->GetArrayDim() > 0))
372 cast += "*";
373 cast += ") ";
374 cast += fGetterName;
375 fGetterName = cast;
376 }
377
378 if ((specials == 2) && (member != 0)) {
379 TString buf = "&(";
380 buf += fGetterName;
381 buf += ")";
382 fGetterName = buf;
383 }
384
385 return fGetterName.Data();
386}
387
388////////////////////////////////////////////////////////////////////////////////
389/// Produce code to set value to given data member.
390/// endch should be output after value is specified.
391
392const char *TXMLPlayer::ElementSetter(TClass *cl, const char *membername, char *endch)
393{
394 strcpy(endch, ""); // NOLINT
395
396 TClass *membercl = cl ? cl->GetBaseDataMember(membername) : 0;
397 TDataMember *member = membercl ? membercl->GetDataMember(membername) : 0;
398 TMethodCall *msetter = member ? member->SetterMethod(cl) : 0;
399
400 if ((msetter != 0) && (msetter->GetMethod()->Property() & kIsPublic)) {
401 fSetterName = "obj->";
402 fSetterName += msetter->GetMethodName();
403 fSetterName += "(";
404 strcpy(endch, ")"); // NOLINT
405 } else if ((member == 0) || (member->Property() & kIsPublic) != 0) {
406 fSetterName = "obj->";
407 fSetterName += membername;
408 fSetterName += " = ";
409 } else {
410 fSetterName = "";
411 if (member->GetArrayDim() == 0)
412 fSetterName += "*";
413 fSetterName += "((";
414 if (member->Property() & kIsConstant)
415 fSetterName += "const ";
417 if (member->IsaPointer())
418 fSetterName += "*";
419 fSetterName += "*) buf.P(obj,";
420 fSetterName += member->GetOffset();
421 fSetterName += ")) = ";
422 }
423 return fSetterName.Data();
424}
425
426////////////////////////////////////////////////////////////////////////////////
427/// Produce source code of streamer function for specified class
428
429void TXMLPlayer::ProduceStreamerSource(std::ostream &fs, TClass *cl, TList *cllist)
430{
431 if (cl == 0)
432 return;
434 TObjArray *elements = info->GetElements();
435 if (elements == 0)
436 return;
437
438 fs << "//__________________________________________________________________________" << std::endl;
439 fs << "void* " << GetStreamerName(cl) << "(" << names_xmlfileclass << " &buf, void* ptr, bool checktypes)"
440 << std::endl;
441 fs << "{" << std::endl;
442 fs << tab1 << cl->GetName() << " *obj = (" << cl->GetName() << "*) ptr;" << std::endl;
443
444 fs << tab1 << "if (buf.IsReading()) { " << std::endl;
445
446 TIter iter(cllist);
447 TClass *c1 = 0;
448 Bool_t firstchild = true;
449
450 while ((c1 = (TClass *)iter()) != 0) {
451 if (c1 == cl)
452 continue;
453 if (c1->GetListOfBases()->FindObject(cl->GetName()) == 0)
454 continue;
455 if (firstchild) {
456 fs << tab2 << "if (checktypes) {" << std::endl;
457 fs << tab3 << "void* ";
458 firstchild = false;
459 } else
460 fs << tab3;
461 fs << "res = " << GetStreamerName(c1) << "(buf, dynamic_cast<" << c1->GetName() << "*>(obj));" << std::endl;
462 fs << tab3 << "if (res) return dynamic_cast<" << cl->GetName() << "*>((" << c1->GetName() << " *) res);"
463 << std::endl;
464 }
465 if (!firstchild)
466 fs << tab2 << "}" << std::endl;
467
468 fs << tab2 << "if (!buf.CheckClassNode(\"" << cl->GetName() << "\", " << info->GetClassVersion() << ")) return 0;"
469 << std::endl;
470
471 fs << tab2 << "if (obj==0) obj = new " << cl->GetName() << ";" << std::endl;
472
473 int n;
474 for (n = 0; n <= elements->GetLast(); n++) {
475
476 TStreamerElement *el = dynamic_cast<TStreamerElement *>(elements->At(n));
477 if (el == 0)
478 continue;
479
480 Int_t typ = el->GetType();
481
482 switch (typ) {
483 // basic types
500 char endch[5];
501 fs << tab2 << ElementSetter(cl, el->GetName(), endch);
502 fs << "buf." << GetBasicTypeReaderMethodName(el->GetType(), 0) << "(\"" << el->GetName() << "\")" << endch
503 << ";" << std::endl;
504 continue;
505 }
506
507 // array of basic types like bool[10]
523 fs << tab2 << "buf.ReadArray(" << ElementGetter(cl, el->GetName(), (el->GetArrayDim() > 1) ? 1 : 0);
524 fs << ", " << el->GetArrayLength() << ", \"" << el->GetName() << "\");" << std::endl;
525 continue;
526 }
527
528 // array of basic types like bool[n]
544 TStreamerBasicPointer *elp = dynamic_cast<TStreamerBasicPointer *>(el);
545 if (elp == 0) {
546 std::cout << "fatal error with TStreamerBasicPointer" << std::endl;
547 continue;
548 }
549 char endch[5];
550
551 fs << tab2 << ElementSetter(cl, el->GetName(), endch);
552 fs << "buf.ReadArray(" << ElementGetter(cl, el->GetName());
553 fs << ", " << ElementGetter(cl, elp->GetCountName());
554 fs << ", \"" << el->GetName() << "\", true)" << endch << ";" << std::endl;
555 continue;
556 }
557
559 char endch[5];
560 fs << tab2 << ElementSetter(cl, el->GetName(), endch);
561 fs << "buf.ReadCharStar(" << ElementGetter(cl, el->GetName());
562 fs << ", \"" << el->GetName() << "\")" << endch << ";" << std::endl;
563 continue;
564 }
565
567 fs << tab2 << GetStreamerName(el->GetClassPointer()) << "(buf, dynamic_cast<"
568 << el->GetClassPointer()->GetName() << "*>(obj), false);" << std::endl;
569 continue;
570 }
571
572 // Class* Class not derived from TObject and with comment field //->
575 if (el->GetArrayLength() > 0) {
576 fs << tab2 << "buf.ReadObjectArr(" << ElementGetter(cl, el->GetName());
577 fs << ", " << el->GetArrayLength() << ", -1"
578 << ", \"" << el->GetName() << "\", " << GetStreamerName(el->GetClassPointer()) << ");" << std::endl;
579 } else {
580 fs << tab2 << "buf.ReadObject(" << ElementGetter(cl, el->GetName());
581 fs << ", \"" << el->GetName() << "\", " << GetStreamerName(el->GetClassPointer()) << ");" << std::endl;
582 }
583 continue;
584 }
585
586 // Class* Class not derived from TObject and no comment
589 if (el->GetArrayLength() > 0) {
590 fs << tab2 << "for (int n=0;n<" << el->GetArrayLength() << ";n++) "
591 << "delete (" << ElementGetter(cl, el->GetName()) << ")[n];" << std::endl;
592 fs << tab2 << "buf.ReadObjectPtrArr((void**) " << ElementGetter(cl, el->GetName(), 3);
593 fs << ", " << el->GetArrayLength() << ", \"" << el->GetName() << "\", "
594 << GetStreamerName(el->GetClassPointer()) << ");" << std::endl;
595 } else {
596 char endch[5];
597
598 fs << tab2 << "delete " << ElementGetter(cl, el->GetName()) << ";" << std::endl;
599 fs << tab2 << ElementSetter(cl, el->GetName(), endch);
600 fs << "(" << el->GetClassPointer()->GetName() << "*) buf.ReadObjectPtr(\"" << el->GetName() << "\", "
601 << GetStreamerName(el->GetClassPointer()) << ")" << endch << ";" << std::endl;
602 }
603 continue;
604 }
605
606 // Class NOT derived from TObject
608 fs << tab2 << "buf.ReadObject(" << ElementGetter(cl, el->GetName(), 2);
609 fs << ", \"" << el->GetName() << "\", " << GetStreamerName(el->GetClassPointer()) << ");" << std::endl;
610 continue;
611 }
612
613 // Class NOT derived from TObject, array
615 fs << tab2 << "buf.ReadObjectArr(" << ElementGetter(cl, el->GetName());
616 fs << ", " << el->GetArrayLength() << ", sizeof(" << el->GetClassPointer()->GetName() << "), \""
617 << el->GetName() << "\", " << GetStreamerName(el->GetClassPointer()) << ");" << std::endl;
618 continue;
619 }
620
621 // container with no virtual table (stl) and no comment
626 TStreamerSTL *elstl = dynamic_cast<TStreamerSTL *>(el);
627 if (elstl == 0)
628 break; // to make skip
629
630 if (ProduceSTLstreamer(fs, cl, elstl, false))
631 continue;
632
633 fs << tab2 << "// STL type = " << elstl->GetSTLtype() << std::endl;
634 break;
635 }
636 }
637 fs << tab2 << "buf.SkipMember(\"" << el->GetName() << "\"); // sinfo type " << el->GetType() << " of class "
638 << el->GetClassPointer()->GetName() << " not supported" << std::endl;
639 }
640
641 fs << tab2 << "buf.EndClassNode();" << std::endl;
642
643 fs << tab1 << "} else {" << std::endl;
644
645 // generation of writing part of class streamer
646
647 fs << tab2 << "if (obj==0) return 0;" << std::endl;
648
649 firstchild = true;
650 iter.Reset();
651 while ((c1 = (TClass *)iter()) != 0) {
652 if (c1 == cl)
653 continue;
654 if (c1->GetListOfBases()->FindObject(cl->GetName()) == 0)
655 continue;
656 if (firstchild) {
657 firstchild = false;
658 fs << tab2 << "if (checktypes) {" << std::endl;
659 }
660 fs << tab3 << "if (dynamic_cast<" << c1->GetName() << "*>(obj))" << std::endl;
661 fs << tab4 << "return " << GetStreamerName(c1) << "(buf, dynamic_cast<" << c1->GetName() << "*>(obj));"
662 << std::endl;
663 }
664 if (!firstchild)
665 fs << tab2 << "}" << std::endl;
666
667 fs << tab2 << "buf.StartClassNode(\"" << cl->GetName() << "\", " << info->GetClassVersion() << ");" << std::endl;
668
669 for (n = 0; n <= elements->GetLast(); n++) {
670
671 TStreamerElement *el = dynamic_cast<TStreamerElement *>(elements->At(n));
672 if (el == 0)
673 continue;
674
675 Int_t typ = el->GetType();
676
677 switch (typ) {
678 // write basic types
695 fs << tab2 << "buf.WriteValue(";
697 fs << "(unsigned char) " << ElementGetter(cl, el->GetName());
698 else
699 fs << ElementGetter(cl, el->GetName());
700 fs << ", \"" << el->GetName() << "\");" << std::endl;
701 continue;
702 }
703
704 // array of basic types
720 fs << tab2 << "buf.WriteArray(" << ElementGetter(cl, el->GetName(), (el->GetArrayDim() > 1) ? 1 : 0);
721 fs << ", " << el->GetArrayLength() << ", \"" << el->GetName() << "\");" << std::endl;
722 continue;
723 }
724
740 TStreamerBasicPointer *elp = dynamic_cast<TStreamerBasicPointer *>(el);
741 if (elp == 0) {
742 std::cout << "fatal error with TStreamerBasicPointer" << std::endl;
743 continue;
744 }
745 fs << tab2 << "buf.WriteArray(" << ElementGetter(cl, el->GetName());
746 fs << ", " << ElementGetter(cl, elp->GetCountName()) << ", \"" << el->GetName() << "\", true);" << std::endl;
747 continue;
748 }
749
751 fs << tab2 << "buf.WriteCharStar(" << ElementGetter(cl, el->GetName()) << ", \"" << el->GetName() << "\");"
752 << std::endl;
753 continue;
754 }
755
757 fs << tab2 << GetStreamerName(el->GetClassPointer()) << "(buf, dynamic_cast<"
758 << el->GetClassPointer()->GetName() << "*>(obj), false);" << std::endl;
759 continue;
760 }
761
762 // Class* Class not derived from TObject and with comment field //->
765 if (el->GetArrayLength() > 0) {
766 fs << tab2 << "buf.WriteObjectArr(" << ElementGetter(cl, el->GetName());
767 fs << ", " << el->GetArrayLength() << ", -1"
768 << ", \"" << el->GetName() << "\", " << GetStreamerName(el->GetClassPointer()) << ");" << std::endl;
769 } else {
770 fs << tab2 << "buf.WriteObject(" << ElementGetter(cl, el->GetName());
771 fs << ", \"" << el->GetName() << "\", " << GetStreamerName(el->GetClassPointer()) << ");" << std::endl;
772 }
773 continue;
774 }
775
776 // Class* Class not derived from TObject and no comment
779 if (el->GetArrayLength() > 0) {
780 fs << tab2 << "buf.WriteObjectPtrArr((void**) " << ElementGetter(cl, el->GetName(), 3);
781 fs << ", " << el->GetArrayLength() << ", \"" << el->GetName() << "\", "
782 << GetStreamerName(el->GetClassPointer()) << ");" << std::endl;
783 } else {
784 fs << tab2 << "buf.WriteObjectPtr(" << ElementGetter(cl, el->GetName());
785 fs << ", \"" << el->GetName() << "\", " << GetStreamerName(el->GetClassPointer()) << ");" << std::endl;
786 }
787 continue;
788 }
789
790 case TVirtualStreamerInfo::kAny: { // Class NOT derived from TObject
791 fs << tab2 << "buf.WriteObject(" << ElementGetter(cl, el->GetName(), 2);
792 fs << ", \"" << el->GetName() << "\", " << GetStreamerName(el->GetClassPointer()) << ");" << std::endl;
793 continue;
794 }
795
797 fs << tab2 << "buf.WriteObjectArr(" << ElementGetter(cl, el->GetName());
798 fs << ", " << el->GetArrayLength() << ", sizeof(" << el->GetClassPointer()->GetName() << "), \""
799 << el->GetName() << "\", " << GetStreamerName(el->GetClassPointer()) << ");" << std::endl;
800 continue;
801 }
802
803 // container with no virtual table (stl) and no comment
808 TStreamerSTL *elstl = dynamic_cast<TStreamerSTL *>(el);
809 if (elstl == 0)
810 break; // to make skip
811
812 if (ProduceSTLstreamer(fs, cl, elstl, true))
813 continue;
814 fs << tab2 << "// STL type = " << elstl->GetSTLtype() << std::endl;
815 break;
816 }
817 }
818 fs << tab2 << "buf.MakeEmptyMember(\"" << el->GetName() << "\"); // sinfo type " << el->GetType()
819 << " of class " << el->GetClassPointer()->GetName() << " not supported" << std::endl;
820 }
821
822 fs << tab2 << "buf.EndClassNode();" << std::endl;
823
824 fs << tab1 << "}" << std::endl;
825 fs << tab1 << "return obj;" << std::endl;
826 fs << "}" << std::endl << std::endl;
827}
828
829////////////////////////////////////////////////////////////////////////////////
830/// Produce code to read argument of stl container from xml file
831
832void TXMLPlayer::ReadSTLarg(std::ostream &fs, TString &argname, int argtyp, Bool_t isargptr, TClass *argcl,
833 TString &tname, TString &ifcond)
834{
835 switch (argtyp) {
852 fs << tname << " " << argname << " = buf." << GetBasicTypeReaderMethodName(argtyp, tname.Data()) << "(0);"
853 << std::endl;
854 break;
855 }
856
858 fs << tname << (isargptr ? " " : " *") << argname << " = "
859 << "(" << argcl->GetName() << "*)"
860 << "buf.ReadObjectPtr(0, " << GetStreamerName(argcl) << ");" << std::endl;
861 if (!isargptr) {
862 if (ifcond.Length() > 0)
863 ifcond += " && ";
864 ifcond += argname;
865 TString buf = "*";
866 buf += argname;
867 argname = buf;
868 }
869 break;
870 }
871
873 fs << "string *" << argname << " = "
874 << "buf.ReadSTLstring();" << std::endl;
875 if (!isargptr) {
876 if (ifcond.Length() > 0)
877 ifcond += " && ";
878 ifcond += argname;
879 TString buf = "*";
880 buf += argname;
881 argname = buf;
882 }
883 break;
884 }
885
886 default: fs << "/* argument " << argname << " not supported */";
887 }
888}
889
890////////////////////////////////////////////////////////////////////////////////
891/// Produce code to write argument of stl container to xml file
892
893void TXMLPlayer::WriteSTLarg(std::ostream &fs, const char *accname, int argtyp, Bool_t isargptr, TClass *argcl)
894{
895 switch (argtyp) {
912 fs << "buf.WriteValue(" << accname << ", 0);" << std::endl;
913 break;
914 }
915
917 fs << "buf.WriteObjectPtr(";
918 if (isargptr)
919 fs << accname;
920 else
921 fs << "&(" << accname << ")";
922 fs << ", 0, " << GetStreamerName(argcl) << ");" << std::endl;
923 break;
924 }
925
927 fs << "buf.WriteSTLstring(";
928 if (isargptr)
929 fs << accname;
930 else
931 fs << "&(" << accname << ")";
932 fs << ");" << std::endl;
933 break;
934 }
935
936 default: fs << "/* argument not supported */" << std::endl;
937 }
938}
939
940////////////////////////////////////////////////////////////////////////////////
941/// Produce code of xml streamer for data member of stl type
942
943Bool_t TXMLPlayer::ProduceSTLstreamer(std::ostream &fs, TClass *cl, TStreamerSTL *el, Bool_t isWriting)
944{
945 if ((cl == 0) || (el == 0))
946 return false;
947
948 TClass *contcl = el->GetClassPointer();
949
950 Bool_t isstr = (el->GetSTLtype() == ROOT::kSTLstring);
951 Bool_t isptr = el->IsaPointer();
952 Bool_t isarr = (el->GetArrayLength() > 0);
953 Bool_t isparent = (strcmp(el->GetName(), contcl->GetName()) == 0);
954
955 int stltyp = -1;
956 int narg = 0;
957 int argtype[2];
958 Bool_t isargptr[2];
959 TClass *argcl[2];
960 TString argtname[2];
961
962 if (!isstr && contcl->GetCollectionType() != ROOT::kNotSTL) {
963 int nestedLoc = 0;
964 std::vector<std::string> splitName;
965 TClassEdit::GetSplit(contcl->GetName(), splitName, nestedLoc);
966
967 stltyp = contcl->GetCollectionType();
968 switch (stltyp) {
969 case ROOT::kSTLvector: narg = 1; break;
970 case ROOT::kSTLlist: narg = 1; break;
971 case ROOT::kSTLforwardlist: narg = 1; break;
972 case ROOT::kSTLdeque: narg = 1; break;
973 case ROOT::kSTLmap: narg = 2; break;
974 case ROOT::kSTLmultimap: narg = 2; break;
975 case ROOT::kSTLset: narg = 1; break;
976 case ROOT::kSTLmultiset: narg = 1; break;
977 case ROOT::kSTLunorderedset: narg = 1; break;
978 case ROOT::kSTLunorderedmultiset: narg = 1; break;
979 case ROOT::kSTLunorderedmap: narg = 2; break;
980 case ROOT::kSTLunorderedmultimap: narg = 2; break;
981 case ROOT::kROOTRVec: narg = 1; break;
982
983 default: return false;
984 }
985
986 for (int n = 0; n < narg; n++) {
987 argtype[n] = -1;
988 isargptr[n] = false;
989 argcl[n] = 0;
990 argtname[n] = "";
991
992 TString buf = splitName[n + 1];
993
994 argtname[n] = buf;
995
996 // nested STL containers not yet supported
997 if (TClassEdit::IsSTLCont(buf.Data()))
998 return false;
999
1000 int pstar = buf.Index("*");
1001
1002 if (pstar > 0) {
1003 isargptr[n] = true;
1004 pstar--;
1005 while ((pstar > 0) && (buf[pstar] == ' '))
1006 pstar--;
1007 buf.Remove(pstar + 1);
1008 } else
1009 isargptr[n] = false;
1010
1011 if (buf.Index("const ") == 0) {
1012 buf.Remove(0, 6);
1013 while ((buf.Length() > 0) && (buf[0] == ' '))
1014 buf.Remove(0, 1);
1015 }
1016
1017 TDataType *dt = (TDataType *)gROOT->GetListOfTypes()->FindObject(buf);
1018 if (dt)
1019 argtype[n] = dt->GetType();
1020 else if (buf == "string")
1022 else {
1023 argcl[n] = TClass::GetClass(buf);
1024 if (argcl[n] != 0)
1026 }
1027 if (argtype[n] < 0)
1028 stltyp = -1;
1029 } // for narg
1030
1031 if (stltyp < 0)
1032 return false;
1033 }
1034
1035 Bool_t akaarrayaccess = (narg == 1) && (argtype[0] < 20);
1036
1037 char tabs[30], tabs2[30];
1038
1039 if (isWriting) {
1040
1041 fs << tab2 << "if (buf.StartSTLnode(\"" << fXmlSetup.XmlGetElementName(el) << "\")) {" << std::endl;
1042
1043 fs << tab3 << contcl->GetName() << " ";
1044
1045 TString accname;
1046 if (isptr) {
1047 if (isarr) {
1048 fs << "**cont";
1049 accname = "(*cont)->";
1050 } else {
1051 fs << "*cont";
1052 accname = "cont->";
1053 }
1054 } else if (isarr) {
1055 fs << "*cont";
1056 accname = "cont->";
1057 } else {
1058 fs << "&cont";
1059 accname = "cont.";
1060 }
1061
1062 fs << " = ";
1063
1064 if (isparent)
1065 fs << "*dynamic_cast<" << contcl->GetName() << "*>(obj);" << std::endl;
1066 else
1067 fs << ElementGetter(cl, el->GetName()) << ";" << std::endl;
1068
1069 if (isarr && el->GetArrayLength()) {
1070 strlcpy(tabs, tab4, sizeof(tabs));
1071 fs << tab3 << "for(int n=0;n<" << el->GetArrayLength() << ";n++) {" << std::endl;
1072 } else
1073 strlcpy(tabs, tab3, sizeof(tabs));
1074
1075 strlcpy(tabs2, tabs, sizeof(tabs2));
1076
1077 if (isptr) {
1078 strlcat(tabs2, tab1, sizeof(tabs2));
1079 fs << tabs << "if (" << (isarr ? "*cont" : "cont") << "==0) {" << std::endl;
1080 fs << tabs2 << "buf.WriteSTLsize(0" << (isstr ? ",true);" : ");") << std::endl;
1081 fs << tabs << "} else {" << std::endl;
1082 }
1083
1084 fs << tabs2 << "buf.WriteSTLsize(" << accname << (isstr ? "length(), true);" : "size());") << std::endl;
1085
1086 if (isstr) {
1087 fs << tabs2 << "buf.WriteSTLstringData(" << accname << "c_str());" << std::endl;
1088 } else {
1089 if (akaarrayaccess) {
1090 fs << tabs2 << argtname[0] << "* arr = new " << argtname[0] << "[" << accname << "size()];" << std::endl;
1091 fs << tabs2 << "int k = 0;" << std::endl;
1092 }
1093
1094 fs << tabs2 << contcl->GetName() << "::const_iterator iter;" << std::endl;
1095 fs << tabs2 << "for (iter = " << accname << "begin(); iter != " << accname << "end(); iter++)";
1096 if (akaarrayaccess) {
1097 fs << std::endl << tabs2 << tab1 << "arr[k++] = *iter;" << std::endl;
1098 fs << tabs2 << "buf.WriteArray(arr, " << accname << "size(), 0, false);" << std::endl;
1099 fs << tabs2 << "delete[] arr;" << std::endl;
1100 } else if (narg == 1) {
1101 fs << std::endl << tabs2 << tab1;
1102 WriteSTLarg(fs, "*iter", argtype[0], isargptr[0], argcl[0]);
1103 } else if (narg == 2) {
1104 fs << " {" << std::endl;
1105 fs << tabs2 << tab1;
1106 WriteSTLarg(fs, "iter->first", argtype[0], isargptr[0], argcl[0]);
1107 fs << tabs2 << tab1;
1108 WriteSTLarg(fs, "iter->second", argtype[1], isargptr[1], argcl[1]);
1109 fs << tabs2 << "}" << std::endl;
1110 }
1111 } // if (isstr)
1112
1113 if (isptr)
1114 fs << tabs << "}" << std::endl;
1115
1116 if (isarr && el->GetArrayLength()) {
1117 if (isptr)
1118 fs << tabs << "cont++;" << std::endl;
1119 else
1120 fs << tabs << "(void*) cont = (char*) cont + sizeof(" << contcl->GetName() << ");" << std::endl;
1121 fs << tab3 << "}" << std::endl;
1122 }
1123
1124 fs << tab3 << "buf.EndSTLnode();" << std::endl;
1125 fs << tab2 << "}" << std::endl;
1126
1127 } else {
1128
1129 fs << tab2 << "if (buf.VerifySTLnode(\"" << fXmlSetup.XmlGetElementName(el) << "\")) {" << std::endl;
1130
1131 fs << tab3 << contcl->GetName() << " ";
1132 TString accname, accptr;
1133 if (isptr) {
1134 if (isarr) {
1135 fs << "**cont";
1136 accname = "(*cont)->";
1137 accptr = "*cont";
1138 } else {
1139 fs << "*cont";
1140 accname = "cont->";
1141 accptr = "cont";
1142 }
1143 } else if (isarr) {
1144 fs << "*cont";
1145 accname = "cont->";
1146 } else {
1147 fs << "&cont";
1148 accname = "cont.";
1149 }
1150
1151 fs << " = ";
1152
1153 if (isparent)
1154 fs << "*dynamic_cast<" << contcl->GetName() << "*>(obj);" << std::endl;
1155 else
1156 fs << ElementGetter(cl, el->GetName()) << ";" << std::endl;
1157
1158 if (isarr && el->GetArrayLength()) {
1159 strlcpy(tabs, tab4, sizeof(tabs));
1160 fs << tab3 << "for(int n=0;n<" << el->GetArrayLength() << ";n++) {" << std::endl;
1161 } else
1162 strlcpy(tabs, tab3, sizeof(tabs));
1163
1164 fs << tabs << "int size = buf.ReadSTLsize(" << (isstr ? "true);" : ");") << std::endl;
1165
1166 if (isptr) {
1167 fs << tabs << "delete " << accptr << ";" << std::endl;
1168 fs << tabs << "if (size==0) " << accptr << " = 0;" << std::endl;
1169 fs << tabs << " else " << accptr << " = new " << contcl->GetName() << ";" << std::endl;
1170 if (!isarr) {
1171 char endch[5];
1172 fs << tabs << ElementSetter(cl, el->GetName(), endch);
1173 fs << "cont" << endch << ";" << std::endl;
1174 }
1175 } else {
1176 fs << tabs << accname << (isstr ? "erase();" : "clear();") << std::endl;
1177 }
1178
1179 if (isstr) {
1180 fs << tabs << "if (size>0) " << accname << "assign(buf.ReadSTLstringData(size));" << std::endl;
1181 } else {
1182 if (akaarrayaccess) {
1183 fs << tabs << argtname[0] << "* arr = new " << argtname[0] << "[size];" << std::endl;
1184 fs << tabs << "buf.ReadArray(arr, size, 0, false);" << std::endl;
1185 }
1186
1187 fs << tabs << "for(int k=0;k<size;k++)";
1188
1189 if (akaarrayaccess) {
1190 fs << std::endl << tabs << tab1 << accname;
1191 if ((stltyp == ROOT::kSTLset) || (stltyp == ROOT::kSTLmultiset))
1192 fs << "insert";
1193 else
1194 fs << "push_back";
1195 fs << "(arr[k]);" << std::endl;
1196 fs << tabs << "delete[] arr;" << std::endl;
1197 } else if (narg == 1) {
1198 TString arg1("arg"), ifcond;
1199 fs << " {" << std::endl << tabs << tab1;
1200 ReadSTLarg(fs, arg1, argtype[0], isargptr[0], argcl[0], argtname[0], ifcond);
1201 fs << tabs << tab1;
1202 if (ifcond.Length() > 0)
1203 fs << "if (" << ifcond << ") ";
1204 fs << accname;
1205 if ((stltyp == ROOT::kSTLset) || (stltyp == ROOT::kSTLmultiset))
1206 fs << "insert";
1207 else
1208 fs << "push_back";
1209 fs << "(" << arg1 << ");" << std::endl;
1210 fs << tabs << "}" << std::endl;
1211 } else if (narg == 2) {
1212 TString arg1("arg1"), arg2("arg2"), ifcond;
1213 fs << " {" << std::endl << tabs << tab1;
1214 ReadSTLarg(fs, arg1, argtype[0], isargptr[0], argcl[0], argtname[0], ifcond);
1215 fs << tabs << tab1;
1216 ReadSTLarg(fs, arg2, argtype[1], isargptr[1], argcl[1], argtname[1], ifcond);
1217 fs << tabs << tab1;
1218 if (ifcond.Length() > 0)
1219 fs << "if (" << ifcond << ") ";
1220 fs << accname << "insert(make_pair(" << arg1 << ", " << arg2 << "));" << std::endl;
1221 fs << tabs << "}" << std::endl;
1222 }
1223 }
1224
1225 if (isarr && el->GetArrayLength()) {
1226 if (isptr)
1227 fs << tabs << "cont++;" << std::endl;
1228 else
1229 fs << tabs << "(void*) cont = (char*) cont + sizeof(" << contcl->GetName() << ");" << std::endl;
1230 fs << tab3 << "}" << std::endl;
1231 }
1232
1233 fs << tab3 << "buf.EndSTLnode();" << std::endl;
1234 fs << tab2 << "}" << std::endl;
1235 }
1236 return true;
1237}
const Bool_t kFALSE
Definition RtypesCore.h:101
const Bool_t kTRUE
Definition RtypesCore.h:100
#define ClassImp(name)
Definition Rtypes.h:364
@ 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:121
#define gROOT
Definition TROOT.h:404
const char * tab1
const char * tab3
const char * tab2
const char * tab4
const char * names_xmlfileclass
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:3425
ROOT::ESTLType GetCollectionType() const
Return the 'type' of the STL the TClass is representing.
Definition TClass.cxx:2884
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:4585
TClass * GetBaseDataMember(const char *datamember)
Return pointer to (base) class that contains datamember.
Definition TClass.cxx:2825
const char * GetDeclFileName() const
Return name of the file containing the declaration of this class.
Definition TClass.cxx:3449
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:2966
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.
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
Longptr_t GetOffset() const
Get offset from "this".
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.: "class TDirectory*" -> "TDirectory".
Long_t Property() const
Get property description word. For meaning of bits see EProperty.
void Reset()
A doubly linked list.
Definition TList.h:38
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:31
void Add(TObject *obj)
Definition TObjArray.h:68
virtual void Delete(Option_t *option="")
Remove all objects from the array AND delete all heap based objects.
virtual TObject * FindObject(const char *name) const
Find an object in this collection using its name.
Int_t GetLast() const
Return index of last object in array.
TObject * At(Int_t idx) const
Definition TObjArray.h:164
Mother of all ROOT objects.
Definition TObject.h:41
virtual TObject * FindObject(const char *name) const
Must be redefined in derived classes.
Definition TObject.cxx:393
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:136
Ssiz_t Length() const
Definition TString.h:410
const char * Data() const
Definition TString.h:369
@ kIgnoreCase
Definition TString.h:268
TString & Remove(Ssiz_t pos)
Definition TString.h:673
Ssiz_t Index(const char *pat, Ssiz_t i=0, ECaseCompare cmp=kExact) const
Definition TString.h:639
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
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
Definition TXMLPlayer.h:49
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
Definition TXMLPlayer.h:50
virtual ~TXMLPlayer()
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.
TString fGetterName
Definition TXMLPlayer.h:48
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
return c1
Definition legend1.C:41
const Int_t n
Definition legend1.C:16
@ kSTLmap
Definition ESTLType.h:33
@ kSTLunorderedmultiset
Definition ESTLType.h:43
@ kROOTRVec
Definition ESTLType.h:46
@ kSTLstring
Definition ESTLType.h:49
@ 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