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

References classNameAttemptingToLoad_, G__p_class_autoloading, h, and isInitializingCintex_.

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

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

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

return class type

Definition at line 345 of file RootAutoLibraryLoader.cc.

References className(), data-class-funcs::classname, classNameAttemptingToLoad_, customizeTrackingMonitorSeedNumber::idx, isInitializingCintex_, and AlCaHLTBitMon_QueryRunRegistry::string.

Referenced by GetClass().

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

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

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

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

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

411  {
412  // std::cout << "LoadAllDictionaries" << std::endl;
413  enable();
414 
416 
418 
419  CatToInfos::const_iterator itFound = db->categoryToInfos().find("Capability");
420 
421  if(itFound == db->categoryToInfos().end()) {
422  return;
423  }
424  std::string lastClass;
425 
426  //give ROOT a name for the file we are loading
427  RootLoadFileSentry sentry;
428 
429  for(auto const& info : itFound->second) {
430  if (lastClass == info.name_) {
431  continue;
432  }
433 
434  lastClass = info.name_;
436  //NOTE: since we have the library already, we could be more efficient if we just load it ourselves
437  }
438  }
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().