Skip to content

Commit c9bd40c

Browse files
authored
Merge pull request #356 from rest-for-physics/jgalan_add_std_to_dictionary
cmake/MacroRootDict.cmake adding std:: containing struct to dictionary
2 parents 0e09164 + e129904 commit c9bd40c

File tree

4 files changed

+49
-12
lines changed

4 files changed

+49
-12
lines changed

cmake/MacroRootDict.cmake

Lines changed: 47 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -69,13 +69,58 @@ MACRO(GEN_ROOT_DICT_LINKDEF_HEADER _namespace)
6969
SET(_input_headers ${ARGN})
7070
SET(_linkdef_header "${ROOT_DICT_OUTPUT_DIR}/${_namespace}_Linkdef.h")
7171

72+
#message ( STATUS "${_input_headers}" )
73+
74+
######### This code is used to identify and add std:: lists that use a struct to LinkDef
75+
file (STRINGS "${_input_headers}" lines)
76+
string(FIND "${lines}" "struct" FOUND_STRUCT )
77+
set ( _structName "NONE" )
78+
if ( FOUND_STRUCT GREATER 0 )
79+
string(SUBSTRING "${lines}" ${FOUND_STRUCT} 50 subline)
80+
string(FIND "${subline}" "{" FOUND_OPEN_BRACE )
81+
# It helps to filter some undesired occurences of struct. But it limits the size of the struct name
82+
if ( FOUND_OPEN_BRACE GREATER 0 AND FOUND_OPEN_BRACE LESS 30 )
83+
string( SUBSTRING "${subline}" 7 ${FOUND_OPEN_BRACE} _structName)
84+
string( FIND "${_structName}" " {" FOUND_OPEN_BRACE )
85+
string( SUBSTRING "${_structName}" 0 ${FOUND_OPEN_BRACE} _structName)
86+
endif ( FOUND_OPEN_BRACE GREATER 0 AND FOUND_OPEN_BRACE LESS 30 )
87+
endif ( FOUND_STRUCT GREATER 0 )
88+
89+
set ( FOUND_STD_STRUCT "NO" )
90+
if( NOT _structName MATCHES "NONE" )
91+
#message( STATUS "Found::${_structName}::" )
92+
while(lines)
93+
list(POP_FRONT lines LINE)
94+
# message( STATUS "This is line::${LINE}::" )
95+
string( FIND "${LINE}" "${_structName}" FOUND_STRUCT_NAME )
96+
string( FIND "${LINE}" "std::" FOUND_STD )
97+
if ( FOUND_STRUCT_NAME GREATER 0 AND FOUND_STD GREATER 0 )
98+
string( SUBSTRING "${LINE}" ${FOUND_STD} -1 LINE)
99+
string( FIND "${LINE}" ">" FOUND_END REVERSE)
100+
if ( FOUND_END GREATER 0 AND FOUND_END LESS 80 )
101+
MATH(EXPR FOUND_END "${FOUND_END}+1")
102+
string( SUBSTRING "${LINE}" 0 ${FOUND_END} LINE)
103+
message( STATUS "Adding ${LINE} to the dictionary!" )
104+
set ( FOUND_STD_STRUCT "${LINE}" )
105+
endif ( FOUND_END GREATER 0 AND FOUND_END LESS 80 )
106+
endif ( FOUND_STRUCT_NAME GREATER 0 AND FOUND_STD GREATER 0 )
107+
108+
string(FIND LINE "${_structName}" FOUND_STRUCT_NAME )
109+
endwhile()
110+
endif( NOT _structName MATCHES "NONE" )
111+
######### This code is used to identify and add std:: lists that use a struct to LinkDef
112+
72113
FOREACH (_header ${_input_headers})
73-
SET(${_namespace}_file_contents "${${_namespace}_file_contents}#ifdef __CINT__" \n)
114+
SET(${_namespace}_file_contents "${${_namespace}_file_contents}#ifdef __ROOTCLING__" \n)
74115
SET(${_namespace}_file_contents "${${_namespace}_file_contents}#pragma link off all globals\;" \n)
75116
SET(${_namespace}_file_contents "${${_namespace}_file_contents}#pragma link off all classes\;" \n)
76117
SET(${_namespace}_file_contents "${${_namespace}_file_contents}#pragma link off all functions\;" \n)
77118
SET(${_namespace}_file_contents "${${_namespace}_file_contents}#pragma link C++ nestedclasses\;" \n)
78-
SET(${_namespace}_file_contents "${${_namespace}_file_contents}#pragma link C++ nestedclasses\;" \n)
119+
SET(${_namespace}_file_contents "${${_namespace}_file_contents}#pragma link C++ nestedtypedef\;" \n)
120+
if( NOT FOUND_STD_STRUCT MATCHES "NO" )
121+
SET(${_namespace}_file_contents "${${_namespace}_file_contents}#pragma link C++ class ${_structName}+\;" \n)
122+
SET(${_namespace}_file_contents "${${_namespace}_file_contents}#pragma link C++ class ${FOUND_STD_STRUCT}+\;" \n)
123+
endif( NOT FOUND_STD_STRUCT MATCHES "NO" )
79124
SET(${_namespace}_file_contents "${${_namespace}_file_contents}#pragma link C++ class ${_namespace}+\;" \n)
80125
SET(${_namespace}_file_contents "${${_namespace}_file_contents}#endif" \n)
81126
ENDFOREACH ()

source/framework/core/inc/TRestAnalysisPlot.h

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -147,13 +147,11 @@ class TRestAnalysisPlot : public TRestMetadata {
147147

148148
std::vector<std::string> fPlotNamesCheck; //!
149149

150-
#ifndef __CINT__
151150
TRestRun* fRun; //! TRestRun to handle output file
152151
std::vector<TString> fRunInputFileName; //! TRestRun to handle input file
153152
TCanvas* fCombinedCanvas; //! Output canvas
154153
Long64_t fDrawNEntries; //!
155154
Long64_t fDrawFirstEntry; //!
156-
#endif
157155

158156
void AddFileFromExternalRun();
159157
void AddFileFromEnv();

source/framework/core/inc/TRestBrowser.h

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,6 @@
2323
/// Event browser for different input file
2424
class TRestBrowser {
2525
protected:
26-
#ifndef __CINT__
2726
TGMainFrame* frmMain = nullptr; //!
2827
TGMainFrame* frmBot = nullptr; //!
2928

@@ -62,12 +61,10 @@ class TRestBrowser {
6261

6362
TBrowser* fBrowser = nullptr; //!
6463
TRestRun* fRestRun = nullptr; //!
65-
#endif
6664

6765
private:
68-
#ifndef __CINT__
69-
Bool_t pureAnalysis;
70-
TString fInputFileName;
66+
Bool_t pureAnalysis; //!
67+
TString fInputFileName; //!
7168

7269
TRestEventViewer* fEventViewer = nullptr; //!
7370

@@ -77,7 +74,6 @@ class TRestBrowser {
7774
void SetBottomPanelButtons();
7875
Bool_t LoadEventId(Int_t eventID, Int_t subEventID = -1);
7976
Bool_t LoadEventEntry(Int_t n);
80-
#endif
8177

8278
public:
8379
// tool method

source/framework/core/inc/TRestEvent.h

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -47,10 +47,8 @@ class TRestEvent : public TObject {
4747
Bool_t fOk; ///< Flag to be used by processes to define an event status. fOk=true is the default.
4848

4949
TRestRun* fRun = nullptr; //!
50-
#ifndef __CINT__
5150

5251
TPad* fPad; //!
53-
#endif
5452

5553
void RestartPad(Int_t nElements);
5654

0 commit comments

Comments
 (0)