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 302 of file RootAutoLibraryLoader.cc.

References classNameAttemptingToLoad_, G__p_class_autoloading, h, and isInitializingCintex_.

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

Member Function Documentation

void RootAutoLibraryLoader::enable ( )
static

interface for TClass generators

enable automatic library loading

Definition at line 406 of file RootAutoLibraryLoader.cc.

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

406  {
407  //static BareRootProductGetter s_getter;
408  //static EDProductGetter::Operate s_op(&s_getter);
409  static RootAutoLibraryLoader s_loader;
410  }
TClass * RootAutoLibraryLoader::GetClass ( char const *  classname,
Bool_t  load 
)
virtual

return class type

Definition at line 347 of file RootAutoLibraryLoader.cc.

References className(), classNameAttemptingToLoad_, and isInitializingCintex_.

Referenced by GetClass().

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

References GetClass(), and svgfig::load().

396  {
397  //std::cout << "looking for type " << typeinfo.name() << std::endl;
398  TClass* returnValue = 0;
399  if(load) {
400  return GetClass(typeinfo.name(), load);
401  }
402  return returnValue;
403  }
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 413 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().

413  {
414  // std::cout << "LoadAllDictionaries" << std::endl;
415  enable();
416 
418 
420 
421  CatToInfos::const_iterator itFound = db->categoryToInfos().find("Capability");
422 
423  if(itFound == db->categoryToInfos().end()) {
424  return;
425  }
426  std::string lastClass;
427  std::string const cPrefix("LCGReflex/");
428 
429  //give ROOT a name for the file we are loading
430  RootLoadFileSentry sentry;
431 
432  for (edmplugin::PluginManager::Infos::const_iterator itInfo = itFound->second.begin(),
433  itInfoEnd = itFound->second.end();
434  itInfo != itInfoEnd; ++itInfo) {
435  if (lastClass == itInfo->name_) {
436  continue;
437  }
438 
439  lastClass = itInfo->name_;
441  //NOTE: since we have the library already, we could be more efficient if we just load it ourselves
442  }
443  }
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().