#ifndef SLSDETECTORDATA_H #define SLSDETECTORDATA_H #include #include #include using namespace std; template class slsDetectorData { protected: const int nx; /**< Number of pixels in the x direction */ const int ny; /**< Number of pixels in the y direction */ int dataSize; /**=0 && ix=0 && iy=0 && ix=0 && iy=0 && ix=0 && iy=0 && dataMap[iy][ix]=0 && ix=0 && iy=0 && dataMap[iy][ix]> (pixelval*4); cout <<"value:"<< value << endl; return ((t >> (pixelval*4)) & 0xf)^m; else if(dr == 8) //uint8_t value = t >> (pixelval*8); cout <<"value:"<< value << endl; return ((t >> (pixelval*8)) & 0xff)^m; else if(dr == 16){ //uint16_t value = t >> (pixelval*16); cout <<"value:"<< value << endl; return ((t >> (pixelval*16)) & 0xffff)^m; }else{ //uint32_t value = t >> (pixelval*32); cout <<"value:"<< value << endl; return ((t >> (pixelval*32)) & 0xffffffff)^m; } }; /** Returns the value of the selected channel for the given dataset as double. \param data pointer to the dataset (including headers etc) \param ix pixel number in the x direction \param iy pixel number in the y direction \returns data for the selected channel, with inversion if required as double */ virtual double getValue(char *data, int ix, int iy=0) {return (double)getChannel(data, ix, iy);}; /** Returns the value of the selected channel for the given dataset as double. \param data pointer to the dataset (including headers etc) \param ix pixel number in the x direction \param iy pixel number in the y direction \param dr dynamic range \returns data for the selected channel, with inversion if required as double */ virtual double getValue(char *data, int ix, int iy, int dr) { return ((double)getChannel(data, ix, iy, dr)); }; /** Returns the frame number for the given dataset. Purely virtual func. \param buff pointer to the dataset \returns frame number */ virtual int getFrameNumber(char *buff)=0; /** Returns the packet number for the given dataset. purely virtual func \param buff pointer to the dataset \returns packet number number virtual int getPacketNumber(char *buff)=0; */ /** Loops over a memory slot until a complete frame is found (i.e. all packets 0 to nPackets, same frame number). purely virtual func \param data pointer to the memory to be analyzed \param ndata reference to the amount of data found for the frame, in case the frame is incomplete at the end of the memory slot \param dsize size of the memory slot to be analyzed \returns pointer to the beginning of the last good frame (might be incomplete if ndata smaller than dataSize), or NULL if no frame is found */ virtual char *findNextFrame(char *data, int &ndata, int dsize)=0; /** Loops over a file stream until a complete frame is found (i.e. all packets 0 to nPackets, same frame number). Can be overloaded for different kind of detectors! \param filebin input file stream (binary) \returns pointer to the begin of the last good frame, NULL if no frame is found or last frame is incomplete */ virtual char *readNextFrame(ifstream &filebin)=0; }; #endif