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

RawDataWriter.cpp

00001 #include "RawDataWriter.h"
00002 #include "scan.h"
00003 #include "ScanWriterFactory.h"
00004 #include "ScanResultWriter.h"
00005 #include "dataTypes.h"
00006 #include "Sct/UnsupportedOperationError.h"
00007 
00008 namespace SctData {
00009 
00010 //Make sure we are in the map
00011 bool RawDataWriter::inMap = ScanWriterFactory::getFactory().addWriterToMap(SR_DT_RAWHIST, ScanResultWriter::getRawWriter(), *(new RawDataWriter())) && ScanWriterFactory::getFactory().addWriterToMap(SR_DT_SLICE_COMPRESSED, ScanResultWriter::getRawWriter(), *(new RawDataWriter()));
00012 
00013 //Do the publishing!
00014 void RawDataWriter::writeData(scan_result_ptrs& scanResult, OStream& out) {
00015     ScanResultWriter::writeClass("RawRawData", out);
00016     //cout << "Publishing slice data" << endl;
00017     //data
00018     switch (scanResult.header.width) {
00019     case SR_WD_32: {
00020             out << scanResult.header.size/2 << scanResult.header.dataType << scanResult.header.width;
00021 
00022             UINT32* data = reinterpret_cast<UINT32*>(scanResult.data);
00023             out.put(data, scanResult.header.size/2);
00024         }
00025         break;
00026 
00027     case SR_WD_16: {
00028             //data header - no need to output width
00029             out << scanResult.header.size << scanResult.header.dataType << scanResult.header.width;
00030 
00031             UINT16* data = reinterpret_cast<UINT16*>(scanResult.data);
00032             out.put(data, scanResult.header.size);
00033         }
00034         break;
00035 
00036     default:
00037     ostringstream oss;
00038     oss << "RawDataWriter only supports 16 and 32 bit widths, was given: " << scanResult.header.width;
00039         throw UnsupportedOperationError(oss.str(), __FILE__, __LINE__);
00040         break;
00041     }
00042 }
00043 
00044 }

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