#include <RootAutoLibraryLoader.h>
Public Member Functions | |
virtual TClass * | GetClass (char const *classname, Bool_t load) |
return class type | |
virtual TClass * | GetClass (type_info const &typeinfo, Bool_t load) |
return class type | |
Static Public Member Functions | |
static void | enable () |
interface for TClass generators | |
static void | loadAll () |
load all known libraries holding dictionaries | |
Private Member Functions | |
RootAutoLibraryLoader const & | operator= (RootAutoLibraryLoader const &) |
RootAutoLibraryLoader () | |
RootAutoLibraryLoader (RootAutoLibraryLoader const &) | |
Private Attributes | |
char const * | classNameAttemptingToLoad_ |
bool | isInitializingCintex_ |
Friends | |
class | DummyClassToStopCompilerWarning |
Definition at line 19 of file RootAutoLibraryLoader.h.
RootAutoLibraryLoader::RootAutoLibraryLoader | ( | ) | [private] |
Definition at line 301 of file RootAutoLibraryLoader.cc.
References classNameAttemptingToLoad_, h, and isInitializingCintex_.
: #if ROOT_VERSION_CODE >= ROOT_VERSION(5,27,6) classNameAttemptingToLoad_(0), isInitializingCintex_(true) { #else classNameAttemptingToLoad_(0) { #endif AssertHandler h; gROOT->AddClassGenerator(this); ROOT::Cintex::Cintex::Enable(); #if ROOT_VERSION_CODE >= ROOT_VERSION(5,27,6) isInitializingCintex_ =false; #endif //set the special cases std::map<std::string, std::string>& specials = cintToReflexSpecialCasesMap(); if(specials.empty()) { addWrapperOfVectorOfBuiltin(specials,"bool"); addWrapperOfVectorOfBuiltin(specials,"char"); addWrapperOfVectorOfBuiltin(specials,"unsigned char"); addWrapperOfVectorOfBuiltin(specials,"signed char"); addWrapperOfVectorOfBuiltin(specials,"short"); addWrapperOfVectorOfBuiltin(specials,"unsigned short"); addWrapperOfVectorOfBuiltin(specials,"int"); addWrapperOfVectorOfBuiltin(specials,"unsigned int"); addWrapperOfVectorOfBuiltin(specials,"long"); addWrapperOfVectorOfBuiltin(specials,"unsigned long"); addWrapperOfVectorOfBuiltin(specials,"long long"); addWrapperOfVectorOfBuiltin(specials,"unsigned long long"); addWrapperOfVectorOfBuiltin(specials,"float"); addWrapperOfVectorOfBuiltin(specials,"double"); } //std::cout << "my loader" << std::endl; //remember if the callback was already set so we can chain together our results gPrevious = G__p_class_autoloading; G__set_class_autoloading_callback(&ALL_AutoLoadCallback); registerTypes(); }
edm::RootAutoLibraryLoader::RootAutoLibraryLoader | ( | RootAutoLibraryLoader const & | ) | [private] |
void RootAutoLibraryLoader::enable | ( | ) | [static] |
interface for TClass generators
enable automatic library loading
Definition at line 405 of file RootAutoLibraryLoader.cc.
Referenced by edm::service::InitRootHandlers::InitRootHandlers(), loadAll(), and edm::StreamerOutputModuleBase::StreamerOutputModuleBase().
{ //static BareRootProductGetter s_getter; //static EDProductGetter::Operate s_op(&s_getter); static RootAutoLibraryLoader s_loader; }
TClass * RootAutoLibraryLoader::GetClass | ( | type_info const & | typeinfo, |
Bool_t | load | ||
) | [virtual] |
return class type
Definition at line 395 of file RootAutoLibraryLoader.cc.
References GetClass(), and svgfig::load().
TClass * RootAutoLibraryLoader::GetClass | ( | char const * | classname, |
Bool_t | load | ||
) | [virtual] |
return class type
Definition at line 346 of file RootAutoLibraryLoader.cc.
References className(), classNameAttemptingToLoad_, and isInitializingCintex_.
Referenced by GetClass().
{ TClass* returnValue = 0; if(classNameAttemptingToLoad_ != 0 && !strcmp(classname, classNameAttemptingToLoad_)) { // We can try to see if the class name contains "basic_string<char>". // If so, we replace "basic_string<char>" with "string" and try again. std::string className(classname); std::string::size_type idx = className.find("basic_string<char>"); if (idx != std::string::npos) { className.replace(idx, 18, std::string("string")); //if basic_string<char> was the last argument to a templated class // then there would be an extra space to separate the two '>' if(className.size() > idx + 6 && className[idx + 6] == ' ') { className.replace(idx + 6, 1, ""); } classNameAttemptingToLoad_ = className.c_str(); returnValue = gROOT->GetClass(className.c_str(), kTRUE); classNameAttemptingToLoad_ = classname; return returnValue; } //NOTE: As of ROOT 5.27.06 this warning generates false positives for HepMC classes because // ROOT has special handling for them built into class.rules //std::cerr << "WARNING[RootAutoLibraryLoader]: Reflex failed to create CINT dictionary for " << classname << std::endl; return 0; } //std::cout << "looking for " << classname << " load " << (load? "T":"F") << std::endl; if (load) { //std::cout << " going to call loadLibraryForClass" << std::endl; //[ROOT 5.28] When Cintex is in its 'Enable' method it will register callbacks to build // TClasses. During this phase we do not want to actually force TClasses to have to // come into existence. #if ROOT_VERSION_CODE >= ROOT_VERSION(5,27,6) if (not isInitializingCintex_ and loadLibraryForClass(classname)) { #else if (loadLibraryForClass(classname)) { #endif //use this to check for infinite recursion attempt classNameAttemptingToLoad_ = classname; // This next call will create the TClass object for the class. // It will also attempt to load the dictionary for the class // if the second argument is kTRUE. This is the default, so it // need not be explicitly specified. returnValue = gROOT->GetClass(classname, kTRUE); classNameAttemptingToLoad_ = 0; } } return returnValue; }
void RootAutoLibraryLoader::loadAll | ( | ) | [static] |
load all known libraries holding dictionaries
Definition at line 412 of file RootAutoLibraryLoader.cc.
References edmplugin::PluginManager::categoryToInfos(), EcalCondDB::db, enable(), and reco::get().
{ // std::cout << "LoadAllDictionaries" << std::endl; enable(); edmplugin::PluginManager* db = edmplugin::PluginManager::get(); typedef edmplugin::PluginManager::CategoryToInfos CatToInfos; CatToInfos::const_iterator itFound = db->categoryToInfos().find("Capability"); if(itFound == db->categoryToInfos().end()) { return; } std::string lastClass; std::string const cPrefix("LCGReflex/"); //give ROOT a name for the file we are loading RootLoadFileSentry sentry; for (edmplugin::PluginManager::Infos::const_iterator itInfo = itFound->second.begin(), itInfoEnd = itFound->second.end(); itInfo != itInfoEnd; ++itInfo) { if (lastClass == itInfo->name_) { continue; } lastClass = itInfo->name_; edmplugin::PluginCapabilities::get()->load(lastClass); //NOTE: since we have the library already, we could be more efficient if we just load it ourselves } }
RootAutoLibraryLoader const& edm::RootAutoLibraryLoader::operator= | ( | RootAutoLibraryLoader const & | ) | [private] |
friend class DummyClassToStopCompilerWarning [friend] |
Definition at line 20 of file RootAutoLibraryLoader.h.
char const* edm::RootAutoLibraryLoader::classNameAttemptingToLoad_ [private] |
Definition at line 35 of file RootAutoLibraryLoader.h.
Referenced by GetClass(), and RootAutoLibraryLoader().
bool edm::RootAutoLibraryLoader::isInitializingCintex_ [private] |
Definition at line 40 of file RootAutoLibraryLoader.h.
Referenced by GetClass(), and RootAutoLibraryLoader().