00001 #include "ServiceRaw.h"
00002 #include "archiving/ArchRawScanResult.h"
00003 #include "archiving/ArchFitScanResult.h"
00004
00005 #include "Sct/SctNames.h"
00006
00007 #include "Sct/IS/IOManagerIS.h"
00008 #include "SctData/TestResult.h"
00009 #include "SctData/RawScanResult.h"
00010
00011
00012 using namespace Sct;
00013 using namespace SctData;
00014 using namespace Sct::IS;
00015 using namespace boost;
00016
00017
00018 namespace SctArchivingServiceRaw {
00019
00020 ArchivingServiceRaw::ArchivingServiceRaw() {}
00021
00022 void ArchivingServiceRaw::runRaw() {
00023 cout<<" I am in ArchivingServiceRaw::runRaw() " <<endl;
00024 IPCPartition& p = SctNames::getPartition();
00025 ISInfoReceiver r(p);
00026 r.subscribe( "EventData", ".*Raw.*", ISCallbackRaw,this);
00027 r.run();
00028 }
00029
00030
00031 void ArchivingServiceRaw::ISCallbackRaw(ISCallbackInfo * isc) {
00032 cout<<" I am in ArchivingServiceRaw::ISCallbackRaw " <<endl;
00033 ArchivingServiceRaw* a = static_cast<ArchivingServiceRaw*>(isc->parameter());
00034 a->archiveRaw(isc);
00035 }
00036
00037
00038 void ArchivingServiceRaw::archiveRaw(ISCallbackInfo * isc) {
00039 cout<<" I am in ArchivingServiceRaw::archiveRaw " <<endl;
00040
00041 if (isc->reason() != ISInfoCreated && isc->reason() != ISInfoUpdated )
00042 return;
00043
00044
00045 shared_ptr<Serializable> ob = IOManagerIS::instance().read(*isc);
00046 if (ob == 0) {
00047 cerr << "Failed to get object from IS" << endl;
00048 return;
00049 }
00050
00051 shared_ptr<RawScanResult> raw = dynamic_pointer_cast<RawScanResult>(ob);
00052 if (raw == 0) {
00053 cerr << "object wasn't as expected" << endl;
00054
00055 return;
00056 }
00057
00058
00059 cout << "Archiving RawScanResult: " << endl;
00060
00061 ArchRawScanResult archraw(*raw);
00062 archraw.SetUNIXDir();
00063 archraw.SaveRawScan();
00064 archraw.RawScanIsPersisted();
00065
00066
00067 cout << "Test Raw complete" << endl;
00068 }
00069
00070
00071 }