CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
AutoLibraryLoader.cc
Go to the documentation of this file.
1 // -*- C++ -*-
2 //
3 // Package: LibraryLoader
4 // Class : AutoLibraryLoader
5 //
6 // Implementation:
7 // <Notes on implementation>
8 //
9 // Original Author:
10 // Created: Wed Nov 30 14:55:01 EST 2005
11 //
12 
13 // system include files
14 #include <iostream>
15 #include "TROOT.h"
16 #include "TInterpreter.h"
17 #include "TApplication.h"
18 
19 // user include files
25 
27 //
28 // constants, enums and typedefs
29 //
30 
31 //
32 // static data member definitions
33 //
34 
35 bool AutoLibraryLoader::enabled_(false);
36 
37 //
38 // constructors and destructor
39 //
41 {
42 }
43 
44 
45 //
46 // member functions
47 //
48 
49 void
51 {
52  if (enabled_) { return; }
53  enabled_ = true;
54 
56  static BareRootProductGetter s_getter;
58  //this function must be called after enabling the autoloader
59  // so that the Reflex dictionaries will be converted to ROOT
60  // dictionaries and the TClass we need will be available
61  fwlite::setRefStreamer(&s_getter);
62 
63  //Make it easy to load our headers
64  TInterpreter* intrp= gROOT->GetInterpreter();
65  const char* env = getenv("CMSSW_FWLITE_INCLUDE_PATH");
66  if( 0 != env) {
67  //this is a comma separated list
68  const char* start = env;
69  const char* end = env;
70  do{
71  //find end
72  for(end=start; *end!=0 and *end != ':';++end);
73  std::string dir(start, end);
74  intrp->AddIncludePath(dir.c_str());
75  start = end+1;
76  }while(*end != 0);
77  }
78 
79  bool foundCMSIncludes = false;
80  env = getenv("CMSSW_BASE");
81  if( 0 != env) {
82  foundCMSIncludes = true;
83  std::string dir(env);
84  dir += "/src";
85  intrp->AddIncludePath(dir.c_str());
86  }
87 
88  env = getenv("CMSSW_RELEASE_BASE");
89  if( 0 != env) {
90  foundCMSIncludes = true;
91  std::string dir(env);
92  dir += "/src";
93  intrp->AddIncludePath(dir.c_str());
94  }
95  if( not foundCMSIncludes) {
96  std::cerr <<"Could not find the environment variables \n"
97  <<" CMSSW_BASE or\n"
98  <<" CMSSW_RELEASE_BASE\n"
99  <<" therefore attempting to '#include' any CMS headers will not work"<<std::endl;
100  }
101  if (0 != gApplication) {
102  gApplication->InitializeGraphics();
103  }
104 }
105 
106 void
108 {
109  // std::cout <<"LoadAllDictionaries"<<std::endl;
110  enable();
112 }
113 
static PluginManager & configure(const Config &)
static void loadAll()
load all known libraries holding dictionaries
PluginManager::Config config()
Definition: standard.cc:22
edm::EDProductGetter const * setRefStreamer(edm::EDProductGetter const *ep)
Definition: RefStreamer.cc:10
#define end
Definition: vmac.h:38
static void loadAll()
load all known libraries holding dictionaries
static void enable()
enable automatic library loading
dbl *** dir
Definition: mlp_gen.cc:35
static void enable()
interface for TClass generators