CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
List of all members | Public Member Functions | Static Public Member Functions | Private Member Functions | Private Attributes | Friends
edm::RootAutoLibraryLoader Class Reference

#include <RootAutoLibraryLoader.h>

Inheritance diagram for edm::RootAutoLibraryLoader:

Public Member Functions

virtual TClass * GetClass (char const *classname, Bool_t load)
 return class type More...
 
virtual TClass * GetClass (type_info const &typeinfo, Bool_t load)
 return class type More...
 

Static Public Member Functions

static void enable ()
 interface for TClass generators More...
 
static void loadAll ()
 load all known libraries holding dictionaries More...
 

Private Member Functions

RootAutoLibraryLoader const & operator= (RootAutoLibraryLoader const &)
 
 RootAutoLibraryLoader ()
 
 RootAutoLibraryLoader (RootAutoLibraryLoader const &)
 

Private Attributes

char const * classNameAttemptingToLoad_
 
bool isInitializingCintex_
 

Friends

class DummyClassToStopCompilerWarning
 

Detailed Description

Definition at line 19 of file RootAutoLibraryLoader.h.

Constructor & Destructor Documentation

RootAutoLibraryLoader::RootAutoLibraryLoader ( )
private

Definition at line 301 of file RootAutoLibraryLoader.cc.

References classNameAttemptingToLoad_, G__p_class_autoloading, h, and isInitializingCintex_.

301  :
302 #if ROOT_VERSION_CODE >= ROOT_VERSION(5,27,6)
304  isInitializingCintex_(true) {
305 #else
307 #endif
308  AssertHandler h;
309  gROOT->AddClassGenerator(this);
310  ROOT::Cintex::Cintex::Enable();
311 #if ROOT_VERSION_CODE >= ROOT_VERSION(5,27,6)
312  isInitializingCintex_ =false;
313 #endif
314  //set the special cases
315  std::map<std::string, std::string>& specials = cintToReflexSpecialCasesMap();
316  if(specials.empty()) {
317  addWrapperOfVectorOfBuiltin(specials,"bool");
318 
319  addWrapperOfVectorOfBuiltin(specials,"char");
320  addWrapperOfVectorOfBuiltin(specials,"unsigned char");
321  addWrapperOfVectorOfBuiltin(specials,"signed char");
322  addWrapperOfVectorOfBuiltin(specials,"short");
323  addWrapperOfVectorOfBuiltin(specials,"unsigned short");
324  addWrapperOfVectorOfBuiltin(specials,"int");
325  addWrapperOfVectorOfBuiltin(specials,"unsigned int");
326  addWrapperOfVectorOfBuiltin(specials,"long");
327  addWrapperOfVectorOfBuiltin(specials,"unsigned long");
328  addWrapperOfVectorOfBuiltin(specials,"long long");
329  addWrapperOfVectorOfBuiltin(specials,"unsigned long long");
330 
331  addWrapperOfVectorOfBuiltin(specials,"float");
332  addWrapperOfVectorOfBuiltin(specials,"double");
333  }
334  //std::cout << "my loader" << std::endl;
335  //remember if the callback was already set so we can chain together our results
337  G__set_class_autoloading_callback(&ALL_AutoLoadCallback);
338  registerTypes();
339  }
CallbackPtr G__p_class_autoloading
The Signals That Services Can Subscribe To This is based on ActivityRegistry h
Helper function to determine trigger accepts.
Definition: Activities.doc:4
static CallbackPtr gPrevious
edm::RootAutoLibraryLoader::RootAutoLibraryLoader ( RootAutoLibraryLoader const &  )
private

Member Function Documentation

void RootAutoLibraryLoader::enable ( )
static

interface for TClass generators

enable automatic library loading

Definition at line 405 of file RootAutoLibraryLoader.cc.

Referenced by AutoLibraryLoader::enable(), edm::service::InitRootHandlers::InitRootHandlers(), loadAll(), and edm::StreamerOutputModuleBase::StreamerOutputModuleBase().

405  {
406  //static BareRootProductGetter s_getter;
407  //static EDProductGetter::Operate s_op(&s_getter);
408  static RootAutoLibraryLoader s_loader;
409  }
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().

346  {
347  TClass* returnValue = 0;
348  if(classNameAttemptingToLoad_ != 0 && !strcmp(classname, classNameAttemptingToLoad_)) {
349  // We can try to see if the class name contains "basic_string<char>".
350  // If so, we replace "basic_string<char>" with "string" and try again.
351  std::string className(classname);
352  std::string::size_type idx = className.find("basic_string<char>");
353  if (idx != std::string::npos) {
354  className.replace(idx, 18, std::string("string"));
355  //if basic_string<char> was the last argument to a templated class
356  // then there would be an extra space to separate the two '>'
357  if(className.size() > idx + 6 && className[idx + 6] == ' ') {
358  className.replace(idx + 6, 1, "");
359  }
360  classNameAttemptingToLoad_ = className.c_str();
361  returnValue = gROOT->GetClass(className.c_str(), kTRUE);
362  classNameAttemptingToLoad_ = classname;
363  return returnValue;
364  }
365  //NOTE: As of ROOT 5.27.06 this warning generates false positives for HepMC classes because
366  // ROOT has special handling for them built into class.rules
367  //std::cerr << "WARNING[RootAutoLibraryLoader]: Reflex failed to create CINT dictionary for " << classname << std::endl;
368  return 0;
369  }
370  //std::cout << "looking for " << classname << " load " << (load? "T":"F") << std::endl;
371  if (load) {
372  //std::cout << " going to call loadLibraryForClass" << std::endl;
373  //[ROOT 5.28] When Cintex is in its 'Enable' method it will register callbacks to build
374  // TClasses. During this phase we do not want to actually force TClasses to have to
375  // come into existence.
376 #if ROOT_VERSION_CODE >= ROOT_VERSION(5,27,6)
377  if (not isInitializingCintex_ and loadLibraryForClass(classname)) {
378 #else
379  if (loadLibraryForClass(classname)) {
380 #endif
381  //use this to check for infinite recursion attempt
382  classNameAttemptingToLoad_ = classname;
383  // This next call will create the TClass object for the class.
384  // It will also attempt to load the dictionary for the class
385  // if the second argument is kTRUE. This is the default, so it
386  // need not be explicitly specified.
387  returnValue = gROOT->GetClass(classname, kTRUE);
389  }
390  }
391  return returnValue;
392  }
uint16_t size_type
def load
Definition: svgfig.py:546
std::string className(const T &t)
Definition: ClassName.h:30
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().

395  {
396  //std::cout << "looking for type " << typeinfo.name() << std::endl;
397  TClass* returnValue = 0;
398  if(load) {
399  return GetClass(typeinfo.name(), load);
400  }
401  return returnValue;
402  }
virtual TClass * GetClass(char const *classname, Bool_t load)
return class type
def load
Definition: svgfig.py:546
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(), edmplugin::PluginCapabilities::get(), edmplugin::PluginManager::get(), and edmplugin::PluginCapabilities::load().

Referenced by AutoLibraryLoader::loadAll().

412  {
413  // std::cout << "LoadAllDictionaries" << std::endl;
414  enable();
415 
417 
419 
420  CatToInfos::const_iterator itFound = db->categoryToInfos().find("Capability");
421 
422  if(itFound == db->categoryToInfos().end()) {
423  return;
424  }
425  std::string lastClass;
426  std::string const cPrefix("LCGReflex/");
427 
428  //give ROOT a name for the file we are loading
429  RootLoadFileSentry sentry;
430 
431  for (edmplugin::PluginManager::Infos::const_iterator itInfo = itFound->second.begin(),
432  itInfoEnd = itFound->second.end();
433  itInfo != itInfoEnd; ++itInfo) {
434  if (lastClass == itInfo->name_) {
435  continue;
436  }
437 
438  lastClass = itInfo->name_;
440  //NOTE: since we have the library already, we could be more efficient if we just load it ourselves
441  }
442  }
const CategoryToInfos & categoryToInfos() const
Definition: PluginManager.h:71
tuple db
Definition: EcalCondDB.py:151
std::map< std::string, Infos > CategoryToInfos
Definition: PluginManager.h:43
static PluginCapabilities * get()
void load(const std::string &iName)
static void enable()
interface for TClass generators
static PluginManager * get()
RootAutoLibraryLoader const& edm::RootAutoLibraryLoader::operator= ( RootAutoLibraryLoader const &  )
private

Friends And Related Function Documentation

friend class DummyClassToStopCompilerWarning
friend

Definition at line 20 of file RootAutoLibraryLoader.h.

Member Data Documentation

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().