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();
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] ==
'/') {
154 ChopFileName(result,127);
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)) {
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");
523 }
else if (strncmp(incName.
Data(),
"auto_ptr<", strlen(
"auto_ptr<")) == 0) {
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;
584 what.ReplaceAll(
"std::",
"");
611 std::vector<std::string> inside;
618 what = inside[1].c_str();
659 constexpr auto auto_ptr_len =
str_length(
"auto_ptr<");
660 if (strncmp(
name,
"auto_ptr<", auto_ptr_len) == 0) {
661 newname =
"unique_ptr<";
662 newname += (
name + auto_ptr_len);
663 }
else if (strchr(
name,
'<')!=0) {
664 std::vector<std::string> inside;
670 for(
unsigned int i = 1; i<narg; ++i) {
674 if (nestedLoc) narg = nestedLoc;
677 if (!inside[narg-1].empty() && inside[narg-1][0] ==
'*')
681 static const char* allocPrefix =
"std::allocator<";
682 static const unsigned int allocPrefixLen (strlen(allocPrefix));
688 if (narg>2 && strncmp(inside[2].c_str(),allocPrefix,allocPrefixLen)==0) {
696 if (narg>4 && strncmp(inside[4].c_str(),allocPrefix,allocPrefixLen)==0) {
702 if (narg>5 && strncmp(inside[5].c_str(),allocPrefix,allocPrefixLen)==0) {
708 if (narg>6 && strncmp(inside[6].c_str(),allocPrefix,allocPrefixLen)==0) {
735 inside.push_back(
"std::vector");
736 inside.push_back(
what);
744 inside[0] =
"std::vector";
748 if (strncmp(inside[0].c_str(),
"std::",5) != 0) {
749 inside[0] =
"std::" + inside[0];
752 static const char *stlnames[] = {
"pair",
"greater",
"less",
"allocator" };
753 for(
unsigned int in = 0; in <
sizeof(stlnames)/
sizeof(stlnames[0]); ++in) {
754 if (strncmp( inside[0].c_str(), stlnames[in], strlen(stlnames[in])) == 0 ) {
755 inside[0] =
"std::" + inside[0];
762 newname.
Append(inside[1]);
763 for(
unsigned int j=2; j<narg; ++j) {
764 if (!inside[j].empty()) {
766 newname.
Append(inside[j]);
769 if (newname[newname.
Length()-1]==
'>') {
774 if (nestedLoc) newname.
Append(inside[nestedLoc]);
775 }
else if ( newname ==
"string" ) {
776 newname =
"std::string";
void Fatal(const char *location, const char *msgfmt,...)
static constexpr int str_length(const char *str)
If we have a map, multimap, set or multiset, plus unordered partners, and the key is a class,...
TClass instances represent classes, structs and namespaces in the ROOT type system.
Bool_t HasInterpreterInfo() const
Int_t Size() const
Return size of object of this class.
const char * GetDeclFileName() const
Return name of the file containing the declaration of this class.
static TClass * GetClass(const char *name, Bool_t load=kTRUE, Bool_t silent=kFALSE)
Static method returning pointer to TClass of the specified class name.
virtual void Add(TObject *obj)
virtual TObject * FindObject(const char *name) const
Find an object in this list using its name.
This code implements the MD5 message-digest algorithm.
const char * AsString() const
Return message digest as string.
void Update(const UChar_t *buf, UInt_t len)
Update TMD5 object to reflect the concatenation of another buffer full of bytes.
void Final()
MD5 finalization, ends an MD5 message-digest operation, writing the the message digest and zeroizing ...
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...
static TString GetHeaderName(const char *name, const TList *extrainfos, Bool_t includeNested=kFALSE)
Return the header name containing the description of name.
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.
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 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'.
static void AddUniqueStatement(FILE *fp, const char *statement, char *inclist)
Add an include statement, if it has not already been added.
static void AddInclude(FILE *fp, const char *header, Bool_t system, char *inclist)
Add an include statement, if it has not already been added.
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.
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 #...
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.
static TString UpdateAssociativeToVector(const char *name)
virtual void SetTitle(const char *title="")
Set the title of the TNamed.
virtual void SetName(const char *name)
Set the name of the TNamed.
virtual const char * GetName() const
Returns name of object.
virtual TClass * GetClassPointer() const
Returns a pointer to the TClass of this element.
const char * GetTypeName() const
virtual Bool_t IsBase() const
Return kTRUE if the element represent a base class.
Describe Streamer information for one class version.
void SetClassVersion(Int_t vers)
Int_t GetClassVersion() const
Ssiz_t First(char c) const
Find first occurrence of a character c.
const char * Data() const
TString & Remove(Ssiz_t pos)
TString & Append(const char *cs)
static TString Format(const char *fmt,...)
Static method which formats a string using a printf style format descriptor and return a TString.
Abstract Interface class describing Streamer information for one class.
virtual TObjArray * GetElements() const =0
ROOT::ESTLType STLKind(std::string_view type)
Converts STL container name to number.
bool IsStdClass(const char *type)
return true if the class belongs to the std namespace
bool IsStdPair(std::string_view name)
std::string GetLong64_Name(const char *original)
Replace 'long long' and 'unsigned long long' by 'Long64_t' and 'ULong64_t'.
ROOT::ESTLType IsSTLCont(std::string_view type)
type : type name: vector<list<classA,allocator>,allocator> result: 0 : not stl container code of cont...
std::string ShortType(const char *typeDesc, int mode)
Return the absolute type of typeDesc.
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.
void forward(const LAYERDATA &prevLayerData, LAYERDATA &currLayerData)
apply the weights (and functions) in forward direction of the DNN