emcPgStorageManager.C

Go to the documentation of this file.
00001 #include "emcPgStorageManager.h"
00002 
00003 #include <cstdlib>
00004 #include <iostream>
00005 #include "emcDataManager.h"
00006 #include "PdbBankManagerFactory.hh"
00007 #include "PHTimeStamp.h"
00008 #include "PdbApplication.hh"
00009 
00010 using namespace std;
00011 
00012 namespace 
00013 {
00014   emcDataManager* DM()
00015   {
00016     return emcDataManager::GetInstance();    
00017   }
00018 }
00019 
00020 //_____________________________________________________________________________
00021 emcPgStorageManager::emcPgStorageManager()
00022 {
00023   // default ctor: nop.
00024 }
00025 
00026 //_____________________________________________________________________________
00027 emcPgStorageManager::~emcPgStorageManager()
00028 {
00029 }
00030 
00031 //_____________________________________________________________________________
00032 PdbBankManager* 
00033 emcPgStorageManager::BankManager()
00034 {
00035   static PdbBankManager* fBankManager = 
00036     PdbBankManagerFactory::instance().create("Pg");
00037   if (!fBankManager)
00038     {
00039       std::cerr << PHWHERE << "Cannot create Pg BankManager!!!"
00040                 << std::endl;
00041       exit(1);
00042     }
00043   return fBankManager;
00044 }
00045 
00046 //_____________________________________________________________________________
00047 PdbApplication* 
00048 emcPgStorageManager::DBApplication()
00049 {
00050   static PdbApplication* fDBApplication = BankManager()->getApplication();
00051   return fDBApplication;
00052 }
00053 
00054 //_____________________________________________________________________________
00055 PdbCalBank*
00056 emcPgStorageManager::fetchBank(const char *className,
00057                                PdbBankID bankID, const char *bankName,
00058                                PHTimeStamp &searchTime,
00059                                string)
00060 {
00061 #ifdef DEBUG
00062   std::cout << PHWHERE << className << " " 
00063             << bankID.getInternalValue()
00064             << " " << bankName << " "
00065             << searchTime
00066             << std::endl;
00067 #endif
00068 
00069   return BankManager()->fetchBank(className,bankID,bankName,searchTime);
00070 }
00071 
00072 //_____________________________________________________________________________
00073 PdbCalBank*
00074 emcPgStorageManager::fetchBank(const char *className,
00075                                PdbBankID bankID, const char *bankName,
00076                                PHTimeStamp &searchTime)
00077 {
00078   std::cout << PHWHERE << className << " " 
00079             << bankID.getInternalValue()
00080             << " " << bankName << " "
00081             << searchTime
00082             << std::endl;
00083 
00084   return BankManager()->fetchBank(className,bankID,bankName,searchTime);
00085 }
00086 
00087 //_____________________________________________________________________________
00088 void
00089 emcPgStorageManager::Reset()
00090 {
00091 }