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

ServiceTests.cpp

Go to the documentation of this file.
00001 #include "ServiceTests.h"
00002 #include "archiving/ArchRawScanResult.h"
00003 #include "archiving/ArchFitScanResult.h"
00004 #include "archiving/ArchNPtGainTestResult.h"
00005 #include "archiving/ArchNoiseOccupancyTestResult.h"
00006 #include "archiving/ArchStrobeDelayTestResult.h"
00007 #include "archiving/ArchTrimRangeTestResult.h"
00008 #include "archiving/ArchTimeWalkTestResult.h"
00009 #include "archiving/ArchPipelineTestResult.h"
00010 #include "archiving/ArchFullBypassTestResult.h"
00011 #include "archiving/ArchNMaskTestResult.h"
00012 
00013 
00014 #include "Sct/SctNames.h"
00015 #include "is/isinfo.h"
00016 #include "Sct/IS/IOManagerIS.h"
00017 #include "SctData/TestResult.h"
00018 #include "SctData/RawScanResult.h"
00019 #include "SctData/FitScanResult.h"
00020 
00021 #include <string>
00022 //#include "Sct/shared_ptr_utility.h"
00023 
00024 using namespace Sct;
00025 using namespace SctData;
00026 using namespace Sct::IS;
00027 using namespace boost;
00028 
00029 namespace SctArchivingServiceTests {
00030 
00031 ArchivingServiceTests::ArchivingServiceTests() {}
00032 
00033 
00034 void ArchivingServiceTests::runTests() {
00035     cout<<" I am in ArchivingServiceTests::runTests() " <<endl;
00036     IPCPartition& p = SctNames::getPartition();
00037     ISInfoReceiver r(p);
00038     
00039     r.subscribe( "TestData", ".*TestResult.*", MyISCallbackTests,this);
00040     r.run();
00041    
00042 }
00043 
00044 
00045 
00046 
00047 void ArchivingServiceTests::MyISCallbackTests(ISCallbackInfo * isc) {
00048     cout<<" I am in ArchivingService::MyISCallbackTests " <<endl;
00049     ArchivingServiceTests* a = static_cast<ArchivingServiceTests*>(isc->parameter());
00050     cout<< " !!!! IS Object Name = " << isc->type().name()<<endl;
00051     a->archiveTests(isc);
00052 }
00053 
00054 
00055 
00056 
00057 void ArchivingServiceTests::archiveTests(ISCallbackInfo * isc) {
00058     cout<<" I am in ArchivingServiceTests::archiveTests " <<endl;
00059     
00060     if (isc->reason() != ISInfoCreated && isc->reason() != ISInfoUpdated ) return;
00061 
00062     
00063     shared_ptr<Serializable> ob = IOManagerIS::instance().read(*isc);
00064     cout << "!!!!!!!!! CLASS NAME ==== " << ob->getClassName() <<endl;
00065     if (ob == 0) {
00066         cerr << "Failed to get object from IS" << endl;
00067         return;
00068     }
00069 
00070     
00071     if(ob->getClassName() == "SctData::NoiseOccupancyTestResult") {
00072       cout<<" The Test Obj is NoiseOccupancyTestResult "<<endl;
00073       //NoiseOccupancyTestResult* test = dynamic_cast<NoiseOccupancyTestResult*>(ob);
00074       shared_ptr<NoiseOccupancyTestResult> result = boost::dynamic_pointer_cast<NoiseOccupancyTestResult>(ob);
00075 
00076       ArchNoiseOccupancyTestResult archnotest(*result);
00077       archnotest.SetUNIXDir();
00078       archnotest.SaveNoiseOccupancy();
00079       cout<< "Noise Occupancy Test Correctly Saved " << endl;
00080 
00081     }
00082     else if(ob->getClassName() == "SctData::NPtGainTestResult") {
00083       cout<<" The Test Obj is NPtGainTestResult "<<endl;
00084       shared_ptr<NPtGainTestResult> result = boost::dynamic_pointer_cast<NPtGainTestResult>(ob);
00085       ArchNPtGainTestResult archNPtGtest(*result);
00086       archNPtGtest.SetUNIXDir();
00087       archNPtGtest.SaveNPtGain();
00088       cout<< "NPt Gain Test Correctly Saved " << endl;
00089 
00090     }
00091     else if(ob->getClassName() == "SctData::StrobeDelayTestResult") {
00092       cout<<" The Test Obj is StrobeDelayTestResult "<<endl;
00093       shared_ptr<StrobeDelayTestResult> result = boost::dynamic_pointer_cast<StrobeDelayTestResult>(ob);
00094       ArchStrobeDelayTestResult archSDtest(*result);
00095       archSDtest.SetUNIXDir();
00096       archSDtest.SaveStrobeDelay();
00097       cout<< "Strobe Delay Test Correctly Saved " << endl;
00098 
00099     }
00100     else if(ob->getClassName() == "SctData::TrimRangeTestResult") {
00101       cout<<" The Test Obj is TrimRangeTestResult "<<endl;
00102       shared_ptr<TrimRangeTestResult> result = boost::dynamic_pointer_cast<TrimRangeTestResult>(ob);
00103       ArchTrimRangeTestResult archTRtest(*result);
00104       archTRtest.SetUNIXDir();
00105       archTRtest.SaveTrimRange();
00106       cout<< "Trim Range Test Correctly Saved " << endl;
00107 
00108     }
00109     else if(ob->getClassName() == "SctData::TimeWalkTestResult") {
00110       cout<<" The Test Obj is TimeWalkTestResult "<<endl;
00111       shared_ptr<TimeWalkTestResult> result = boost::dynamic_pointer_cast<TimeWalkTestResult>(ob);
00112       ArchTimeWalkTestResult archTWtest(*result);
00113       archTWtest.SetUNIXDir();
00114       archTWtest.SaveTimeWalk();
00115       cout<< "TimeWalk Test Correctly Saved " << endl;
00116 
00117     }
00118     else if(ob->getClassName() == "SctData::FullBypassTestResult") {
00119       cout<<" The Test Obj is FullBypassTestResult "<<endl;
00120       shared_ptr<FullBypassTestResult> result = boost::dynamic_pointer_cast<FullBypassTestResult>(ob);
00121       ArchFullBypassTestResult archFBtest(*result);
00122       archFBtest.SetUNIXDir();
00123       archFBtest.SaveFullBypass();
00124       cout<< "FullBypass Test Correctly Saved " << endl;
00125 
00126     }
00127     else if(ob->getClassName() == "SctData::PipelineTestResult") {
00128       cout<<" The Test Obj is PipelineTestResult "<<endl;
00129       shared_ptr<PipelineTestResult> result = boost::dynamic_pointer_cast<PipelineTestResult>(ob);
00130       ArchPipelineTestResult archPtest(*result);
00131       archPtest.SetUNIXDir();
00132       archPtest.SavePipeline();
00133       cout<< "Pipeline Test Correctly Saved " << endl;
00134 
00135     }
00136     else if(ob->getClassName() == "SctData::NMaskTestResult") {
00137       cout<<" The Test Obj is NMaskTestResult "<<endl;
00138       shared_ptr<NMaskTestResult> result = boost::dynamic_pointer_cast<NMaskTestResult>(ob);
00139       ArchNMaskTestResult archNMtest(*result);
00140       archNMtest.SetUNIXDir();
00141       archNMtest.SaveNMask();
00142       cout<< "NMask Test Correctly Saved " << endl;
00143 
00144     }
00145     else {
00146       cout<< "ERROR: the object on IS is an unknown Test type" <<endl;
00147     }
00148     
00149     
00150     cout << "Bye bye" <<endl;
00151     
00152 
00153    
00154 }
00155 
00156 }

Generated on Mon Dec 15 19:36:17 2003 for SCT DAQ/DCS Software by doxygen1.3-rc3