ROOT Version: Not Provided
Platform: Not Provided
Compiler: Not Provided
Dear all,
I have a question concerning the usage of the LinkDef and the support for the enumerator Class object.
What are the correct instructions to put in the LinkDef ?
I have a file (Enumerators.hpp) like this
#ifndef ENUMERATORSVC_HPP
#define ENUMERATORSVC_HPP
#include "MessageSvc.hpp"
#include "TString.h"
/**
* \enum Prj
* \brief Project types flags
*/
enum class Prj {
None = 0, // ONLY FOR PYTHON SUBMITTER
RKst = 1,
RK = 2,
RPhi = 3,
Error = 99
};
/**
* \enum Analysis
* \brief Analysis types flags
*/
enum class Analysis {
None = 0, // ONLY FOR PYTHON SUBMITTER
MM = 1,
EE = 2,
Error = 99
};
Then i do in the LinkDef
#ifdef __ROOTCLING__
#pragma link off all class;
//#pragma link off all enum;
//#pragma link off all function;
//#pragma link off all global;
#pragma link off all namespace;
//#pragma link off all struct;
//#pragma link off all typedef;
//#pragma link off all union;
#pragma link C++ nestedclasses;
#pragma link C++ nestedtypedef;
//#pragma link C++ enum Prj;
//#pragma link C++ enum Analysis;
//#pragma link C++ defined_in "Enumerators.hpp";
#pragma link C++ defined_in "HelperSvc.hpp";
Where HelperSvc.hpp
does the #include "Enumerators.hpp"
and uses Analysis::None
.
I produce the dictionary with
set(PROJECT services)
file(GLOB SOURCES ${CMAKE_CURRENT_SOURCE_DIR}/src/*.cpp)
file(GLOB HEADERS ${CMAKE_CURRENT_SOURCE_DIR}/inc/*.hpp)
list(REMOVE_ITEM HEADERS ${CMAKE_CURRENT_SOURCE_DIR}/inc/LinkDef.h)
message(STATUS "SRCS = ${SOURCES}")
message(STATUS "INCS = ${HEADERS}")
GENERATE_DICTIONARY(${PROJECT}Dict ${HEADERS} LINKDEF ${CMAKE_CURRENT_SOURCE_DIR}/inc/LinkDef.h)
add_library(${PROJECT}-objlib OBJECT ${SOURCES} ${PROJECT}Dict.cxx)
having
function(GENERATE_DICTIONARY dictionary)
if(${ROOT_VERSION} LESS 6.0)
ROOT_GENERATE_DICTIONARY(${dictionary} ${ARGN})
else()
ROOT_GENERATE_DICTIONARY(${dictionary} MODULE ${dictionary} ${ARGN})
endif()
endfunction()
What i would like to do is that, once the library is produced , be able in Root and pyRoot to define something like
Analysis myana = Analysis::None ;
Is there a way to have the enumerator classes usable and create a dictionary for them?
If yes, what is the suggested way to do that?
Thanks in advance
Renato