34 if (!strstr(inclist, statement)) {
35 if (strlen(inclist)+strlen(statement) >= 50000) {
36 Fatal(
"AddUniqueStatement",
"inclist too short need %u instead of 500000",
UInt_t(strlen(inclist)+strlen(statement)));
38 strcat(inclist, statement);
39 fprintf(fp,
"%s", statement);
50 what.
Form(
"#include <%s>\n", header);
52 what.
Form(
"#include \"%s\"\n", header);
74 name.
Remove( limit - 32 - 5);
90 const char *
name = strname.c_str();
91 Int_t len = strlen(name);
93 for (
Int_t i = 0; i < len; ++i) {
104 if (nest == 0 && name[i+1] ==
':') {
108 if (!definedInParent && cl==0 && extrainfos!=0) {
111 definedInParent =
kTRUE;
114 if (definedInParent) {
119 if (strcmp(name + strlen(name) - 2,
".h") == 0) {
130 if (name[i+1] ==
'/') {
166 Int_t numberOfNamespaces = 0;
167 const char *fullname = clname;
170 if (strchr(clname,
':')) {
172 Int_t len = strlen(clname);
173 const char *
name = clname;
175 for (
Int_t cur = 0; cur < len; ++cur) {
176 switch (clname[cur]) {
185 if (nest == 0 && clname[cur+1] ==
':') {
190 if (cl == 0 || (cl && cl->
Size() == 0)) {
191 TString last(name, cur - (name - clname));
192 if ((numberOfClasses == 0 || *numberOfClasses == 0) && strchr(last.
Data(),
'<') == 0) {
193 fprintf(fp,
"namespace %s {\n", last.
Data());
194 ++numberOfNamespaces;
197 fprintf(fp,
"#ifndef %s_h\n", headername.
Data());
198 fprintf(fp,
"#define %s_h\n", headername.
Data());
201 fprintf(fp,
"public:\n");
202 if (numberOfClasses) ++(*numberOfClasses);
205 name = clname + cur + 2;
209 name = clname + cur + 2;
218 istemplate = strstr(clname,
"<") != 0;
223 if (implementEmptyClass==1) {
225 fprintf(fp,
"#ifndef %s_h\n", headername.
Data());
226 fprintf(fp,
"#define %s_h\n", headername.
Data());
229 std::vector<const char*> argtype;
234 if (isdigit(protoname[pos+1])) {
235 argtype.push_back(
"int");
237 argtype.push_back(
"typename");
241 switch (protoname[i]) {
250 if (isdigit(protoname[i+1])) {
251 argtype.push_back(
"int");
253 argtype.push_back(
"typename");
264 fprintf(fp,
"template <");
265 for (
UInt_t p = 0; p < nparam; ++p) {
266 if (p >= argtype.size() ) {
267 fprintf(fp,
"/* missing */ T%d", p);
269 fprintf(fp,
"%s T%d", argtype[p], p);
271 if (p != (nparam - 1)) fprintf(fp,
", ");
273 if (needGenericTemplate) {
274 fprintf(fp,
"> class %s", protoname.
Data());
276 fprintf(fp,
"> class %s;\n", protoname.
Data());
277 fprintf(fp,
"template <> ");
281 if (implementEmptyClass) {
283 if (!needGenericTemplate) {
284 fprintf(fp,
"class %s", clname);
287 if (numberOfClasses) ++(*numberOfClasses);
288 fprintf(fp,
"public:\n");
289 fprintf(fp,
"operator int() { return 0; };\n");
291 fprintf(fp,
"enum %s { kDefault_%s };\n", clname, clname);
294 if (implementEmptyClass==1) {
295 if (strchr(fullname,
':') == 0) {
297 fprintf(fp,
"#ifdef __MAKECINT__\n#pragma link C++ class %s+;\n#endif\n", fullname);
299 fprintf(fp,
"#endif\n");
303 if (!(istemplate && needGenericTemplate)) {
304 fprintf(fp,
"class %s", clname);
307 return numberOfNamespaces;
326 if (clname[strlen(clname)-1]==
'>') {
327 newinfo->
SetTitle(
"Generated by MakeProject as an empty class template instantiation");
330 newinfo->
SetTitle(
"Generated by MakeProject as a namespace");
333 newinfo->
SetTitle(
"Generated by MakeProject as an enum");
336 extrainfos->
Add(newinfo);
342 info->
SetTitle(
"Generated by MakeProject as an empty class");
349 info->
SetTitle(
"Generated by MakeProject as an empty class");
366 UInt_t len = strlen(clname);
371 for (
UInt_t i = 0; i < len; ++i) {
374 if (nest == 0 && clname[i+1] ==
':') {
382 if (nest == 1) last = i + 1;
385 if (nest == 0)
return;
388 if ((clname[i] ==
',' && nest == 1) || (clname[i] ==
'>' && nest == 0)) {
389 TString incName(clname + last, i - last);
391 if (clname[i] ==
'>' && nest == 1) incName.
Append(
">");
393 if (isdigit(incName[0])) {
431 if (strchr(clname,
'<')) {
435 UInt_t numberOfClasses = 0;
438 if (!implementEmptyClass) fprintf(fp,
";\n");
439 for (
UInt_t i = 0;i < numberOfClasses;++i) {
440 fprintf(fp,
"}; // end of class.\n");
441 fprintf(fp,
"#endif\n");
443 for (
UInt_t i = 0;i < numberOfNamespaces;++i) {
444 fprintf(fp,
"} // end of namespace.\n");
457 UInt_t len = strlen(clname);
462 for (
UInt_t i = 0; i < len; ++i) {
466 if (nest == 1) last = i + 1;
469 if (nest==0)
return ninc;
472 if ((clname[i] ==
',' && nest == 1) || (clname[i] ==
'>' && nest == 0)) {
473 TString incName(clname + last, i - last);
475 if (clname[i] ==
'>' && nest == 1) incName.
Append(
">");
477 if (isdigit(incName[0])) {
480 const char *what =
"";
489 what =
"forward_list";
500 what =
"unordered_map";
508 what =
"unordered_set";
514 what =
"undetermined_stl_container";
518 fprintf(fp,
"namespace std {} using namespace std;\n");
520 }
else if (strncmp(incName.
Data(),
"pair<", strlen(
"pair<")) == 0) {
523 }
else if (strncmp(incName.
Data(),
"auto_ptr<", strlen(
"auto_ptr<")) == 0) {
530 if (!forward && cl) {
535 if (include && include[0]) {
537 if (strncmp(include,
"include/", 8) == 0) {
540 if (strncmp(include,
"include\\", 9) == 0) {
551 }
else if (incName.
Length() && incName[0] !=
' ' &&
gROOT->GetType(incName) == 0) {
553 if (emptyclass && extrainfos) {
569 std::vector<std::string> inside;
596 if (strncmp(clname,
"auto_ptr<", strlen(
"auto_ptr<")) == 0) {
614 std::vector<std::string> inside;
620 if (strncmp(inside[1].c_str(),
"pair<",strlen(
"pair<"))==0) {
621 what = inside[1].c_str();
657 if (strchr(name,
'<')!=0) {
658 std::vector<std::string> inside;
661 if (nestedLoc) --narg;
664 for(
unsigned int i = 1; i<narg; ++i) {
668 static const char* allocPrefix =
"std::allocator<";
669 static const unsigned int allocPrefixLen (strlen(allocPrefix));
675 if (narg>2 && strncmp(inside[2].c_str(),allocPrefix,allocPrefixLen)==0) {
683 if (narg>4 && strncmp(inside[4].c_str(),allocPrefix,allocPrefixLen)==0) {
689 if (narg>5 && strncmp(inside[5].c_str(),allocPrefix,allocPrefixLen)==0) {
695 if (narg>6 && strncmp(inside[6].c_str(),allocPrefix,allocPrefixLen)==0) {
716 if (what[what.size()-1]==
'>') {
722 inside.push_back(
"std::vector");
723 inside.push_back(what);
731 inside[0] =
"std::vector";
735 if (strncmp(inside[0].c_str(),
"std::",5) != 0) {
736 inside[0] =
"std::" + inside[0];
739 static const char *stlnames[] = {
"pair",
"greater",
"less",
"allocator" };
740 for(
unsigned int in = 0; in <
sizeof(stlnames)/
sizeof(stlnames[0]); ++in) {
741 if (strncmp( inside[0].c_str(), stlnames[in], strlen(stlnames[in])) == 0 ) {
742 inside[0] =
"std::" + inside[0];
749 newname.
Append(inside[1]);
750 for(
unsigned int j=2; j<narg; ++j) {
751 if (!inside[j].empty()) {
753 newname.
Append(inside[j]);
756 if (newname[newname.
Length()-1]==
'>') {
761 if (nestedLoc) newname.
Append(inside[nestedLoc]);
762 }
else if ( newname ==
"string" ) {
763 newname =
"std::string";
Describe Streamer information for one class version.
virtual const char * GetName() const
Returns name of object.
static void GenerateMissingStreamerInfo(TList *extrainfos, const char *clname, Bool_t iscope)
Generate an empty StreamerInfo for the given type (no recursion) if it is not not known in the list o...
ROOT::ESTLType IsSTLCont(std::string_view type)
type : type name: vector<list<classA,allocator>,allocator> result: 0 : not stl container code of cont...
const char * GetDeclFileName() const
void Final()
MD5 finalization, ends an MD5 message-digest operation, writing the the message digest and zeroizing ...
void Fatal(const char *location, const char *msgfmt,...)
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.
static TString GetHeaderName(const char *name, const TList *extrainfos, Bool_t includeNested=kFALSE)
Return the header name containing the description of name.
TString & ReplaceAll(const TString &s1, const TString &s2)
virtual TClass * GetClassPointer() const
Returns a pointer to the TClass of this element.
virtual void SetName(const char *name)
Set the name of the TNamed.
static void ChopFileName(TString &name, Int_t limit)
Chop the name by replacing the ending (before a potential extension) with a md5 summary of the name...
Bool_t HasInterpreterInfo() const
const char * AsString() const
Return message digest as string.
static void GeneratePostDeclaration(FILE *fp, const TVirtualStreamerInfo *info, char *inclist)
Add to the header file anything that need to appear after the class declaration (this includes some #...
virtual TObject * FindObject(const char *name) const
Delete a TObjLink object.
static TString Format(const char *fmt,...)
Static method which formats a string using a printf style format descriptor and return a TString...
This code implements the MD5 message-digest algorithm.
ROOT::ESTLType STLKind(std::string_view type)
Converts STL container name to number.
TString & Append(const char *cs)
Bool_t EndsWith(const char *pat, ECaseCompare cmp=kExact) const
Return true if string ends with the specified string.
Ssiz_t First(char c) const
Find first occurrence of a character c.
static UInt_t GenerateForwardDeclaration(FILE *fp, const char *clname, char *inclist, Bool_t implementEmptyClass, Bool_t needGenericTemplate, const TList *extrainfos)
Insert a (complete) forward declaration for the class 'clname'.
std::string GetLong64_Name(const char *original)
Replace 'long long' and 'unsigned long long' by 'Long64_t' and 'ULong64_t'.
static void AddInclude(FILE *fp, const char *header, Bool_t system, char *inclist)
Add an include statement, if it has not already been added.
void Update(const UChar_t *buf, UInt_t len)
Update TMD5 object to reflect the concatenation of another buffer full of bytes.
void Form(const char *fmt,...)
Formats a string using a printf style format descriptor.
static void AddUniqueStatement(FILE *fp, const char *statement, char *inclist)
Add an include statement, if it has not already been added.
Int_t Size() const
Return size of object of this class.
The ROOT global object gROOT contains a list of all defined classes.
void SetClassVersion(Int_t vers)
bool IsStdClass(const char *type)
return true if the class belongs to the std namespace
static void GenerateMissingStreamerInfos(TList *extrainfos, TStreamerElement *element)
Generate an empty StreamerInfo for types that are used in templates parameters but are not known in t...
static UInt_t GenerateIncludeForTemplate(FILE *fp, const char *clname, char *inclist, Bool_t forward, const TList *extrainfos)
Add to the header file, the #include needed for the argument of this template.
TString & Remove(Ssiz_t pos)
virtual TObjArray * GetElements() const =0
virtual Bool_t IsBase() const
Return kTRUE if the element represent a base class.
void forward(const LAYERDATA &prevLayerData, LAYERDATA &currLayerData)
apply the weights (and functions) in forward direction of the DNN
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.
Int_t GetClassVersion() const
static TString UpdateAssociativeToVector(const char *name)
If we have a map, multimap, set or multiset, plus unordered partners, and the key is a class...
const char * GetTypeName() const
virtual void Add(TObject *obj)
std::string ShortType(const char *typeDesc, int mode)
Return the absolute type of typeDesc.
Abstract Interface class describing Streamer information for one class.
virtual void SetTitle(const char *title="")
Set the title of the TNamed.
static UInt_t GenerateClassPrefix(FILE *fp, const char *clname, Bool_t top, TString &protoname, UInt_t *numberOfClasses, Int_t implementEmptyClass=kFALSE, Bool_t needGenericTemplate=kFALSE)
Write the start of the class (forward) declaration.
const char * Data() const