/data3/calcul/jacquem/working_dir/Micromegas/micromegasFrameWork/src/ilcConfDb/IlcConfDb.cpp

Go to the documentation of this file.
00001 #include "ilcConfDb/IlcConfDb.hh"
00002 #include "tools/MicroException.hh"
00003 
00004 #include "db/DBInit.h"
00005 #include "configObjects/LdaConfiguration.h"
00006 #include "configObjects/DccConfiguration.h"
00007 #include "configObjects/DifConfiguration.h"
00008 #include "configObjects/AsicConfiguration.h"
00009 #include "configObjects/State.h"
00010 #include "configObjects/Setup.h"
00011 
00012 
00013 #include <sstream>
00014 #include <iostream>
00015 
00016 
00017 using namespace std;
00018 
00019 IlcConfDb* IlcConfDb::handle = NULL;
00020 
00021 //--------------------------//
00022  IlcConfDb* IlcConfDb::getInstance()
00023 {
00024   if ( handle == NULL )
00025   {
00026     handle = new IlcConfDb();
00027   }
00028   return handle;
00029 }
00030 //--------------------------//
00031 IlcConfDb::IlcConfDb():initialised(false)
00032 {
00033   handle = this;
00034   this->init(); 
00035 }
00036 
00037 //--------------------------//
00038 IlcConfDb::~IlcConfDb()
00039 {
00040   DBInit::terminate();
00041 }
00042 
00043 //--------------------------//
00044 void IlcConfDb::init()
00045 {
00046     if ( ! initialised )
00047     {
00048       DBInit::init();
00049       initialised = true;
00050     }
00051 }
00052   
00053 //--------------------------//
00054 AsicConfiguration&  IlcConfDb::getAsicConfiguration (ui32 runId)
00055 {
00056   Setup * setup = Setup::getSetupFromRun(runId);
00057 /*
00058   vector<string> vec = setup->getSetupNames();
00059   for (vector<string>::const_iterator it =  vec.begin(); it != vec.end() ; it++)
00060   {
00061     cout << "DEBUG SETUP [" << *it << "]" << endl;
00062   }
00063 */
00064   State* state = NULL;
00065   if ( setup != NULL ) 
00066   {
00067     vector<State*> states =  setup->getStates();
00068     for ( vector<State*>::const_iterator it = states.begin(); it != states.end(); it++)
00069     {
00070       state = *it;
00071       if ( state != NULL ) {
00072         cout << " INFO: Database get  state[" << state->getName() << "]" << endl;  
00073       }
00074     }
00075     return  *(state->getAsicConfiguration()) ;
00076   }
00077 
00078   throw MicroException("No setup for this run id" );
00079 }
00080   

Generated on Mon Jan 7 13:15:22 2013 for MicromegasFramework by  doxygen 1.4.7