Main Page | Modules | Namespace List | Class Hierarchy | Class List | File List | Namespace Members | Class Members | File Members

Plugins.cpp

Go to the documentation of this file.
00001 
00002 #include "cafe/Plugins.hpp"
00003 #include "cafe/Config.hpp"
00004 
00005 #include "TEnv.h"
00006 
00007 namespace cafe {
00008 
00009     Plugins *Plugins::s_instance = 0;
00010 
00011     Plugins *Plugins::instance()
00012     {
00013         if(s_instance == 0) {
00014             s_instance = new Plugins();
00015         }
00016         return s_instance;
00017     }
00018 
00019     Plugins::Plugins()
00020     {
00021         using namespace std;
00022 
00023         if(TPluginManager *mgr = gROOT->GetPluginManager()) {
00024 
00025             const char *public_context = getenv("SRT_PUBLIC_CONTEXT");
00026             const char *private_context = getenv("SRT_PRIVATE_CONTEXT");
00027             if(private_context == 0) private_context = ".";
00028 
00029             Config conf("cafe");
00030             vector<string> packages = conf.getVString("Packages", " ,");
00031             packages.push_back("cafe");
00032 
00033             for(vector<string>::iterator it = packages.begin();
00034                 it != packages.end();
00035                 ++it) {
00036                 if(public_context) {
00037                     string name = public_context;
00038                     name += '/' + *it + "/scripts/rootrc";
00039                     TEnv env(name.c_str());
00040                     mgr->LoadHandlersFromEnv(&env);
00041 
00042                 }
00043                 string name = private_context;
00044                 name += '/' + *it + "/scripts/rootrc";
00045                 TEnv env(name.c_str());
00046                 mgr->LoadHandlersFromEnv(&env);
00047             }
00048         }       
00049     }
00050     
00051     Plugins::~Plugins()
00052     {
00053     }
00054 }
00055 

Generated on Tue Mar 28 10:13:04 2006 for CAF by doxygen 1.3.4