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

References classNameAttemptingToLoad_, G__p_class_autoloading, h, and isInitializingCintex_.

297  :
298 #if ROOT_VERSION_CODE >= ROOT_VERSION(5,27,6)
300  isInitializingCintex_(true) {
301 #else
302  classNameAttemptingToLoad_(nullptr) {
303 #endif
304  AssertHandler h;
305  gROOT->AddClassGenerator(this);
306  ROOT::Cintex::Cintex::Enable();
307 #if ROOT_VERSION_CODE >= ROOT_VERSION(5,27,6)
308  isInitializingCintex_ =false;
309 #endif
310  //set the special cases
311  std::map<std::string, std::string>& specials = cintToReflexSpecialCasesMap();
312  if(specials.empty()) {
313  addWrapperOfVectorOfBuiltin(specials,"bool");
314 
315  addWrapperOfVectorOfBuiltin(specials,"char");
316  addWrapperOfVectorOfBuiltin(specials,"unsigned char");
317  addWrapperOfVectorOfBuiltin(specials,"signed char");
318  addWrapperOfVectorOfBuiltin(specials,"short");
319  addWrapperOfVectorOfBuiltin(specials,"unsigned short");
320  addWrapperOfVectorOfBuiltin(specials,"int");
321  addWrapperOfVectorOfBuiltin(specials,"unsigned int");
322  addWrapperOfVectorOfBuiltin(specials,"long");
323  addWrapperOfVectorOfBuiltin(specials,"unsigned long");
324  addWrapperOfVectorOfBuiltin(specials,"long long");
325  addWrapperOfVectorOfBuiltin(specials,"unsigned long long");
326 
327  addWrapperOfVectorOfBuiltin(specials,"float");
328  addWrapperOfVectorOfBuiltin(specials,"double");
329  }
330  //std::cout << "my loader" << std::endl;
331  //remember if the callback was already set so we can chain together our results
333  G__set_class_autoloading_callback(&ALL_AutoLoadCallback);
334  registerTypes();
335  }
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 401 of file RootAutoLibraryLoader.cc.

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

401  {
402  //static BareRootProductGetter s_getter;
403  //static EDProductGetter::Operate s_op(&s_getter);
404  static RootAutoLibraryLoader s_loader;
405  }
TClass * RootAutoLibraryLoader::GetClass ( char const *  classname,
Bool_t  load 
)
virtual

return class type

Definition at line 342 of file RootAutoLibraryLoader.cc.

References className(), classNameAttemptingToLoad_, customizeTrackingMonitorSeedNumber::idx, isInitializingCintex_, and AlCaHLTBitMon_QueryRunRegistry::string.

Referenced by GetClass().

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

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

391  {
392  //std::cout << "looking for type " << typeinfo.name() << std::endl;
393  TClass* returnValue = nullptr;
394  if(load) {
395  return GetClass(typeinfo.name(), load);
396  }
397  return returnValue;
398  }
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 408 of file RootAutoLibraryLoader.cc.

References edmplugin::PluginManager::categoryToInfos(), enable(), edmplugin::PluginCapabilities::get(), edmplugin::PluginManager::get(), edmplugin::PluginCapabilities::load(), and AlCaHLTBitMon_QueryRunRegistry::string.

Referenced by AutoLibraryLoader::loadAll().

408  {
409  // std::cout << "LoadAllDictionaries" << std::endl;
410  enable();
411 
413 
415 
416  CatToInfos::const_iterator itFound = db->categoryToInfos().find("Capability");
417 
418  if(itFound == db->categoryToInfos().end()) {
419  return;
420  }
421  std::string lastClass;
422 
423  //give ROOT a name for the file we are loading
424  RootLoadFileSentry sentry;
425 
426  for(auto const& info : itFound->second) {
427  if (lastClass == info.name_) {
428  continue;
429  }
430 
431  lastClass = info.name_;
433  //NOTE: since we have the library already, we could be more efficient if we just load it ourselves
434  }
435  }
const CategoryToInfos & categoryToInfos() const
Definition: PluginManager.h:82
static const TGPicture * info(bool iBackgroundIsBlack)
tuple db
Definition: EcalCondDB.py:151
std::map< std::string, Infos > CategoryToInfos
Definition: PluginManager.h:54
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().