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 "stdafx.h" 00013 #include "ippdme/Response/ippScanResponse.h" 00014 #include "ippdme/misc/ippStringBuilder.h" 00015 00016 00017 00018 /* ScanResponse::ScanResponse 00019 00020 This makes a copy of inData, so it does not matter what happens to 00021 inData after this runs. 00022 00023 see example in 11.4: 00024 Note:the order of the data store in X,Y,Z 00025 should match the requested made by the previous 00026 OnScanReport command send by the client 00027 In particular 00028 OnScanReport(X(),Y(),Z(),IJKAct(),Q()) 00029 OnScanReport(Z(),X(),IJKAct(),Q(),Z()) 00030 are both valid and should produce am appropriate scan response that 00031 take care of the order.... 00032 */ 00033 ippScanResponse::ippScanResponse(unsigned int inTagNumber) 00034 : ippResponse(inTagNumber, CommandTag, DataScan) 00035 { 00036 00037 } 00038 00039 ippScanResponse::ippScanResponse( 00040 unsigned int inTagNumber, 00041 int inDataSize, const double * inData 00042 ) 00043 : ippResponse(inTagNumber, CommandTag, DataScan) 00044 { 00045 setData(inDataSize,inData); 00046 } 00047 00048 ippScanResponse::~ippScanResponse() 00049 { 00050 } 00051 00052 void ippScanResponse::setData(int inDataSize,const double * inData) 00053 { 00054 int n; 00055 00056 if ((inData) && (inDataSize > 0)) { 00057 _data.resize(inDataSize); 00058 for (n = 0; n < inDataSize; n++) { 00059 _data[n] = inData[n]; 00060 } 00061 } else { 00062 _data.resize(0); 00063 } 00064 } 00065 00066 std::string ippScanResponse::getResponseString() const 00067 { 00068 ippStringBuilder builder(_tag,"#"); 00069 for (size_t n = 0; n < _data.size(); n++) { 00070 builder.AppendParam(_data[n]); 00071 } 00072 return builder.ToString(); 00073 }