CMS 3D CMS Logo

edm::RootAutoLibraryLoader Class Reference

#include <FWCore/RootAutoLibraryLoader/interface/RootAutoLibraryLoader.h>

List of all members.

Public Member Functions

virtual TClass * GetClass (const type_info &typeinfo, Bool_t load)
 return class type
virtual TClass * GetClass (const char *classname, 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

const RootAutoLibraryLoaderoperator= (const RootAutoLibraryLoader &)
 RootAutoLibraryLoader (const RootAutoLibraryLoader &)
 RootAutoLibraryLoader ()

Private Attributes

const char * classNameAttemptingToLoad_

Friends

class DummyClassToStopCompilerWarning


Detailed Description

Definition at line 18 of file RootAutoLibraryLoader.h.


Constructor & Destructor Documentation

RootAutoLibraryLoader::RootAutoLibraryLoader (  )  [private]

Definition at line 313 of file RootAutoLibraryLoader.cc.

References edm::addWrapperOfVectorOfBuiltin(), edm::ALL_AutoLoadCallback(), edm::cintToReflexSpecialCasesMap(), G__p_class_autoloading, gPrevious, h, and edm::registerTypes().

00313                                              :
00314   classNameAttemptingToLoad_(0)
00315 {
00316    edm::AssertHandler h();
00317    gROOT->AddClassGenerator(this);
00318    ROOT::Cintex::Cintex::Enable();
00319 
00320    //set the special cases
00321    std::map<std::string,std::string>& specials = cintToReflexSpecialCasesMap();
00322    if(specials.empty()) {
00323       addWrapperOfVectorOfBuiltin(specials,"char");
00324       addWrapperOfVectorOfBuiltin(specials,"unsigned char");
00325       addWrapperOfVectorOfBuiltin(specials,"signed char");
00326       addWrapperOfVectorOfBuiltin(specials,"short");
00327       addWrapperOfVectorOfBuiltin(specials,"unsigned short");
00328       addWrapperOfVectorOfBuiltin(specials,"int");
00329       addWrapperOfVectorOfBuiltin(specials,"unsigned int");
00330       addWrapperOfVectorOfBuiltin(specials,"long");
00331       addWrapperOfVectorOfBuiltin(specials,"unsigned long");
00332 
00333       addWrapperOfVectorOfBuiltin(specials,"float");
00334       addWrapperOfVectorOfBuiltin(specials,"double");
00335    }
00336    //std::cout <<"my loader"<<std::endl;
00337    //remember if the callback was already set so we can chain together our results
00338    gPrevious = G__p_class_autoloading;
00339    G__set_class_autoloading_callback(&ALL_AutoLoadCallback);
00340    registerTypes();
00341 }

edm::RootAutoLibraryLoader::RootAutoLibraryLoader ( const RootAutoLibraryLoader  )  [private]


Member Function Documentation

void RootAutoLibraryLoader::enable (  )  [static]

interface for TClass generators

enable automatic library loading

Definition at line 386 of file RootAutoLibraryLoader.cc.

Referenced by AutoLibraryLoader::enable(), edm::service::InitRootHandlers::InitRootHandlers(), stor::SMProxyServer::SMProxyServer(), stor::StorageManager::StorageManager(), and edm::StreamerOutputModuleBase::StreamerOutputModuleBase().

00387 {
00388    //static BareRootProductGetter s_getter;
00389    //static edm::EDProductGetter::Operate s_op(&s_getter);
00390    static RootAutoLibraryLoader s_loader;
00391 }

TClass * RootAutoLibraryLoader::GetClass ( const type_info &  typeinfo,
Bool_t  load 
) [virtual]

return class type

Definition at line 375 of file RootAutoLibraryLoader.cc.

00376 {
00377   //std::cout <<"looking for type "<<typeinfo.name()<<std::endl;
00378    TClass* returnValue = 0;
00379    if(load){
00380       return GetClass(typeinfo.name(), load);
00381    }
00382    return returnValue;
00383 }

TClass * RootAutoLibraryLoader::GetClass ( const char *  classname,
Bool_t  load 
) [virtual]

return class type

Definition at line 349 of file RootAutoLibraryLoader.cc.

References TestMuL1L2Filter_cff::cerr, lat::endl(), and edm::loadLibraryForClass().

00350 {
00351   if(classname == classNameAttemptingToLoad_) {
00352     std::cerr <<"WARNING: Reflex failed to create CINT dictionary for "<<classname<<std::endl;
00353     return 0;
00354   }
00355    TClass* returnValue = 0;
00356    //std::cout <<"looking for "<<classname <<" load "<<(load? "T":"F")<< std::endl;
00357    if (load) {
00358      //std::cout <<" going to call loadLibraryForClass"<<std::endl;
00359      if (loadLibraryForClass(classname)) {
00360        //use this to check for infinite recursion attempt
00361        classNameAttemptingToLoad_ = classname;
00362        // This next call will create the TClass object for the class.
00363        // It will also attempt to load the dictionary for the class
00364        // if the second argument is kTRUE. This is the default, so it
00365        // need not be explicitly specified.
00366        returnValue = gROOT->GetClass(classname, kTRUE);
00367        classNameAttemptingToLoad_ = 0;
00368      }
00369    }
00370    return returnValue;
00371 }

void RootAutoLibraryLoader::loadAll (  )  [static]

load all known libraries holding dictionaries

Definition at line 397 of file RootAutoLibraryLoader.cc.

References edmplugin::PluginManager::categoryToInfos(), archive::db, edmplugin::PluginCapabilities::get(), and edmplugin::PluginManager::get().

Referenced by AutoLibraryLoader::loadAll().

00398 {
00399   // std::cout <<"LoadAllDictionaries"<<std::endl;
00400   enable();
00401 
00402   edmplugin::PluginManager*db =  edmplugin::PluginManager::get();
00403 
00404   typedef edmplugin::PluginManager::CategoryToInfos CatToInfos;
00405 
00406   CatToInfos::const_iterator itFound = db->categoryToInfos().find("Capability");
00407 
00408   if(itFound == db->categoryToInfos().end()) {
00409     return;
00410   }
00411   std::string lastClass;
00412   const std::string cPrefix("LCGReflex/");
00413 
00414   //give ROOT a name for the file we are loading
00415   RootLoadFileSentry sentry;
00416 
00417   for (edmplugin::PluginManager::Infos::const_iterator itInfo = itFound->second.begin(),
00418        itInfoEnd = itFound->second.end();
00419        itInfo != itInfoEnd; ++itInfo)
00420   {
00421     if (lastClass == itInfo->name_) {
00422       continue;
00423     }
00424 
00425     lastClass = itInfo->name_;
00426     edmplugin::PluginCapabilities::get()->load(lastClass);
00427     //NOTE: since we have the library already, we could be more efficient if we just load it ourselves
00428   }
00429 }

const RootAutoLibraryLoader& edm::RootAutoLibraryLoader::operator= ( const RootAutoLibraryLoader  )  [private]


Friends And Related Function Documentation

friend class DummyClassToStopCompilerWarning [friend]

Definition at line 19 of file RootAutoLibraryLoader.h.


Member Data Documentation

const char* edm::RootAutoLibraryLoader::classNameAttemptingToLoad_ [private]

Definition at line 34 of file RootAutoLibraryLoader.h.


The documentation for this class was generated from the following files:
Generated on Tue Jun 9 18:44:13 2009 for CMSSW by  doxygen 1.5.4