/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   if ( setup != NULL ) 
00058   {
00059     State *state = *(setup->getStates().begin());
00060     if ( state != NULL )
00061     {
00062       return  *(state->getAsicConfiguration()) ;
00063     }
00064   }
00065 
00066   throw MicroException("No setup for this run id" );
00067 }
00068   

Generated on Mon Jun 11 16:55:46 2012 for MicromegasFramework by  doxygen 1.4.7