Main Page | Namespace List | Class Hierarchy | Class List | Directories | File List | Namespace Members | Class Members | File Members | Related Pages

ippMockExecutor.cpp

Go to the documentation of this file.
00001 // 
00002 // DISCLAIMER: 
00003 //  This software was produced by the National Institute of Standards 
00004 //  and Technology (NIST), an agency of the U.S. government, and by statute is 
00005 //  not subject to copyright in the United States.  Recipients of this 
00006 //  software assume all responsibility associated with its operation,
00007 //  modification,maintenance, and subsequent redistribution. 
00008 //
00009 //  See NIST Administration Manual 4.09.07 b and Appendix I. 
00010 //
00011 
00012 #include "ippMockExecutor.h"
00013 
00014 
00015 
00016 ippMockExecutor::ippMockExecutor()
00017 {
00018   _g_count = 0;
00019   _OnScanReportCmd = new ippOnScanReportCommand(0);
00020   _OnScanReportCmd->setDefault();
00021   _GetDMEVersionCounter =-1;
00022 }
00023 
00024 bool ippMockExecutor::readyToProcessSlowQueueCommand() const 
00025 {
00026   return _g_count ==0; // Command is completed if all fakes answers have been generated.
00027 }
00028 
00029 void ippMockExecutor::executeAbortE()
00030 {
00031 
00032 }
00033 
00034 void ippMockExecutor::AbortCurrentCommand()
00035 {
00036   if (_g_count  ) {
00037     _g_count = 0; // let's fake the command abortion  by setting the _g_count to 0
00038   }
00039   ippExecutor::AbortCurrentCommand();
00040 }
00041 
00042 
00043 ippResponseList ippMockExecutor::checkStatus()
00044 {
00045 
00046   if (_g_count >0) {
00047     int tagNum = _currentCommand->getTag().getTagNumber();
00048     _returningValues.push_back(ProduceFakeScanReport(tagNum,(double)_g_count,(double)_g_count,(double)_g_count));
00049     _g_count--;
00050     if (_g_count == 0 ) {
00051       // command is now completed.
00052       generateCompletedResponse();
00053     }
00054   }
00055   return ippExecutor::checkStatus();
00056 }
00057 
00058 void ippMockExecutor::executeStartSession()
00059 {
00060   _GetDMEVersionCounter = 0;
00061   generateCompletedResponse();
00062 }
00063 
00064 void ippMockExecutor::executeEndSession()         
00065 {
00066   generateCompletedResponse();
00067 }
00068 
00069 void ippMockExecutor::executeScanOnLine(){
00070 
00071   IPP_ASSERT_MSG(_g_count==0, " a ScanOnLine command is probably being executed already");
00072   _g_count = 10; // we want to produce 10 fakes  ScanReportCmd response...
00073 }
00074 
00075 void ippMockExecutor::executeGetDMEVersion()
00076 {
00077   _GetDMEVersionCounter++;
00078   generateCompletedResponse();
00079 }
00080 
00081 void ippMockExecutor::executeIsHomed()
00082 {
00083   generateCompletedResponse();
00084 }
00085 
00086 ippResponsePtr ippMockExecutor::ProduceFakeScanReport(int tagNum,double X,double Y,double Z)
00087 {
00088   ippOnScanReportBuilderPtr _scanReportBuilder = new ippOnScanReportBuilder(_OnScanReportCmd);
00089   _scanReportBuilder->StartPoint();
00090 
00091   // [TO DO] set the Q factor 0..100
00092   _scanReportBuilder->setValue(ippOnScanReportCommand::Q,0);
00093   _scanReportBuilder->setValue(ippOnScanReportCommand::X,X);
00094   _scanReportBuilder->setValue(ippOnScanReportCommand::Y,Y);
00095   _scanReportBuilder->setValue(ippOnScanReportCommand::Z,Z);
00096   _scanReportBuilder->setValues(ippOnScanReportCommand::IJK  , 0.0,0.0,1.0);
00097   _scanReportBuilder->setValue(ippOnScanReportCommand::IJKAct , 1);
00098   _scanReportBuilder->Commit();
00099   ippScanResponsePtr x = _scanReportBuilder->FlushAndGetResponse(tagNum);
00100   return x;
00101 }

Generated on Wed Nov 8 00:20:07 2006 for IPPDME by  doxygen 1.4.1