CFEL - ASG Software Suite  2.5.0
CASS
raw_sss_parser.cpp
Go to the documentation of this file.
1 // Copyright (C) 2011 Lutz Foucar
2 
3 /**
4  * @file raw_sss_parser.cpp contains class to parse a file
5  * containing the commercial ccd images created by Per Johnsonns program.
6  *
7  * @author Lutz Foucar
8  */
9 
10 #include <fstream>
11 #include <iostream>
12 #include <sstream>
13 #include <stdexcept>
14 
15 #include "raw_sss_parser.h"
16 
17 #include "raw_sss_file_header.hpp"
18 #include "file_reader.h"
19 
20 using namespace cass;
21 using namespace std;
22 using namespace std::tr1;
23 using Streaming::operator >>;
24 
25 
27 {
28  ifstream &file(*(_readerpointerpair.second._filestream));
29  file.seekg (0, ios_base::end);
30  const streampos filesize(file.tellg());
31  file.seekg (0, ios_base::beg);
32 
33  /** the file header information */
34  sssFile::Header header;
35  file.read(reinterpret_cast<char*>(&header),sizeof(sssFile::Header));
36 
37  const uint32_t imagesize(header.width*header.height*sizeof(sssFile::image_t::value_type));
38 
39  cout <<"RAWSSSParser::run(): file contains '"<<header.nFrames<<"' images"<<endl;
40 
41  for (uint32_t iImage(0); iImage < header.nFrames; ++iImage)
42  {
43  const streampos eventStartPos(file.tellg());
44  uint32_t eventId(Streaming::retrieve<uint32_t>(file));
45  savePos(eventStartPos,eventId);
46  file.seekg(imagesize,ios_base::cur);
47  }
48 
49  if (file.tellg()<filesize)
50  throw runtime_error("RAWSSSParser::run(): Read all images, but end of the file not reached.");
51 }
STL namespace.
contains the layout of the sss file headers.
void run()
parse the raw.sss file
uint32_t width
width of the frame
contains base class for all file readers
uint32_t nFrames
number of frames contained in file
contains class to parse a file containing the commercial ccd images created by Per Johnsonns program...
uint32_t height
the height of the frame