Main Page | Modules | Namespace List | Class Hierarchy | Alphabetical List | Data Structures | File List | Namespace Members | Data Fields | Related Pages

ArchivingManager.cpp

00001 #include "ArchivingManager.h"
00002 #include "Sct/SctNames.h"
00003 
00004 #include "Sct/IoExceptions.h"
00005 #include "Sct/LogicErrors.h"
00006 #include <sstream>
00007 #include <iomanip>
00008 #include <cstdlib>
00009 #include <boost/date_time/posix_time/posix_time.hpp>
00010 
00011 using namespace Sct;
00012 using namespace boost;
00013 
00014 
00015 
00016     using boost::shared_ptr;
00017 
00018     ArchivingManager::ArchivingManager() {}
00019 
00020     ArchivingManager::~ArchivingManager() {}
00021 
00022     ArchivingManager& ArchivingManager::instance() throw () {
00023         static ArchivingManager bertha;
00024         return bertha;
00025     }
00026 
00027     
00028     
00029     shared_ptr<ArchScanResult> ArchivingManager::getScanFromMap(shared_ptr<const Serializable> ob) const throw(Sct::LogicError) {
00030       const string classname = ob->getClassName();
00031         ArchivingScanMap::const_iterator it = theScanMap.find(classname);
00032         if ( it == theScanMap.end() ){
00033         cerr << "ArchivingScanManager::getFromScanMap no archiver for " << classname << endl;
00034         cerr << "known Scanarchivers:" << endl ;
00035         for (ArchivingScanMap::const_iterator it = theScanMap.begin(); it != theScanMap.end(); ++it){
00036             cerr << (*it).first << endl;
00037         }
00038         throw InvalidArgumentError( string("ArchivingManager::getScanFromMap no Scanarchiver for ") + classname, __FILE__, __LINE__ );
00039         } else {
00040           
00041           return (*it).second ;
00042           
00043         }
00044     }
00045 
00046        shared_ptr<ArchTestResult> ArchivingManager::getTestFromMap(shared_ptr<const Serializable> ob) const throw(Sct::LogicError) {
00047      const string classname = ob->getClassName();
00048      ArchivingTestMap::const_iterator it = theTestMap.find(classname);
00049      if ( it == theTestMap.end() ){
00050        cerr << "ArchivingTestManager::getFromMap no archiver for " << classname << endl;
00051        cerr << "known Testarchivers:" << endl ;
00052        for (ArchivingTestMap::const_iterator it = theTestMap.begin(); it != theTestMap.end(); ++it){
00053          cerr << (*it).first << endl;
00054        }
00055        throw InvalidArgumentError( string("ArchivingManager::getTestFromMap no Testarchiver for ") + classname, __FILE__, __LINE__ );
00056      } else {
00057        return (*it).second;
00058        
00059      }
00060        }
00061 
00062     bool ArchivingManager::addScanArchiver(const string& scanName, shared_ptr<ArchScanResult> archiver) throw(Sct::LogicError) {
00063         if (theScanMap.find(scanName) == theScanMap.end() ){
00064         theScanMap[scanName] = archiver;
00065         return true;
00066         }
00067         return false;
00068     }
00069 
00070         bool ArchivingManager::addTestArchiver(const string& testName, shared_ptr<ArchTestResult> archiver) throw(Sct::LogicError) {
00071         if (theTestMap.find(testName) == theTestMap.end() ){
00072         theTestMap[testName] = archiver;
00073         return true;
00074         }
00075         return false;
00076     }

Generated on Thu Jul 15 09:50:42 2004 for SCT DAQ/DCS Software - C++ by doxygen 1.3.5