CMS 3D CMS Logo

List of all members | Public Member Functions | Static Public Member Functions | Private Member Functions | Static Private Attributes | Friends
FWLiteEnabler Class Reference

#include <FWLiteEnabler.h>

Public Member Functions

 FWLiteEnabler (const FWLiteEnabler &)=delete
 
FWLiteEnabler const & operator= (FWLiteEnabler const &)=delete
 

Static Public Member Functions

static void enable ()
 enable automatic library loading More...
 

Private Member Functions

 FWLiteEnabler ()
 

Static Private Attributes

static bool enabled_
 

Friends

class DummyClassToStopCompilerWarning
 

Detailed Description

helper class to enable fwlite. Using a free function enable() directly does not work in macros.

Definition at line 11 of file FWLiteEnabler.h.

Constructor & Destructor Documentation

FWLiteEnabler::FWLiteEnabler ( const FWLiteEnabler )
delete
FWLiteEnabler::FWLiteEnabler ( )
private

Definition at line 41 of file FWLiteEnabler.cc.

41  {
42  }

Member Function Documentation

void FWLiteEnabler::enable ( )
static

enable automatic library loading

Definition at line 50 of file FWLiteEnabler.cc.

References MessageLogger_cfi::cerr, edmplugin::standard::config(), edmplugin::PluginManager::configure(), dir, enabled_, end, web.browse_db::env, fwlite::setRefStreamer(), and AlCaHLTBitMon_QueryRunRegistry::string.

Referenced by CmsShowMain::CmsShowMain(), AutoLibraryLoader::enable(), fwlite::EventContainer::EventContainer(), AutoLibraryLoader::loadAll(), and main().

50  {
51  if (enabled_) { return; }
52  enabled_ = true;
53 
55  static BareRootProductGetter s_getter;
56  //this function must be called
57  // so that the TClass we need will be available
58  fwlite::setRefStreamer(&s_getter);
59 
60  //Make it easy to load our headers
61  TInterpreter* intrp= gROOT->GetInterpreter();
62  char const* env = getenv("CMSSW_FWLITE_INCLUDE_PATH");
63  if(nullptr != env) {
64  //this is a comma separated list
65  char const* start = env;
66  char const* end;
67  do {
68  //find end
69  for(end=start; *end!=0 and *end != ':';++end);
70  std::string dir(start, end);
71  intrp->AddIncludePath(dir.c_str());
72  start = end+1;
73  } while(*end != 0);
74  }
75 
76  bool foundCMSIncludes = false;
77  env = getenv("CMSSW_BASE");
78  if(nullptr != env) {
79  foundCMSIncludes = true;
80  std::string dir(env);
81  dir += "/src";
82  intrp->AddIncludePath(dir.c_str());
83  }
84 
85  env = getenv("CMSSW_RELEASE_BASE");
86  if(nullptr != env) {
87  foundCMSIncludes = true;
88  std::string dir(env);
89  dir += "/src";
90  intrp->AddIncludePath(dir.c_str());
91  }
92  if(not foundCMSIncludes) {
93  std::cerr <<"Could not find the environment variables \n"
94  <<" CMSSW_BASE or\n"
95  <<" CMSSW_RELEASE_BASE\n"
96  <<" therefore attempting to '#include' any CMS headers will not work"<<std::endl;
97  }
98  if (nullptr != gApplication) {
99  gApplication->InitializeGraphics();
100  }
101  }
Definition: start.py:1
static PluginManager & configure(const Config &)
PluginManager::Config config()
Definition: standard.cc:21
edm::EDProductGetter const * setRefStreamer(edm::EDProductGetter const *ep)
Definition: RefStreamer.cc:11
#define end
Definition: vmac.h:39
dbl *** dir
Definition: mlp_gen.cc:35
static bool enabled_
Definition: FWLiteEnabler.h:20
FWLiteEnabler const& FWLiteEnabler::operator= ( FWLiteEnabler const &  )
delete

Friends And Related Function Documentation

friend class DummyClassToStopCompilerWarning
friend

Definition at line 12 of file FWLiteEnabler.h.

Member Data Documentation

bool FWLiteEnabler::enabled_
staticprivate

Definition at line 20 of file FWLiteEnabler.h.

Referenced by enable().