somewere stuck with virtual template overloading

This commit is contained in:
Dhanya Maliakal
2017-03-23 11:56:17 +01:00
parent 300b014f73
commit b9eb3d5a52
25 changed files with 407 additions and 244 deletions

View File

@ -46,6 +46,12 @@ class BinaryFile : private virtual slsReceiverDefs, public File, public BinaryFi
*/
void PrintMembers();
/**
* Get File Handle pointer
* @returns file handle pointer
*/
FILE* GetFileHandle();
/**
* Create file
* @param fnum current frame index to include in file name

View File

@ -34,7 +34,8 @@ class DataProcessor : private virtual slsReceiverDefs, public ThreadObject {
*/
DataProcessor(Fifo*& f, fileFormat* ftype, bool* fwenable, bool* dsEnable,
int* cbaction,
void (*dataReadycb)(int, char*, int, FILE*, char*, void*),
void (*dataReadycb)(uint64_t, uint32_t, uint32_t, uint64_t, uint64_t, uint16_t, uint16_t, uint16_t, uint16_t, uint32_t, uint16_t, uint8_t, uint8_t,
char*, uint32_t, FILE*, void*),
void *pDataReadycb);
/**
@ -293,19 +294,32 @@ class DataProcessor : private virtual slsReceiverDefs, public ThreadObject {
int* callbackAction;
/**
* function being called back for raw data
* Call back for raw data
* args to raw data ready callback are
* framenum
* datapointer
* datasize in bytes
* file descriptor
* guidatapointer (NULL, no data required)
* frameNumber is the frame number
* expLength is the subframe number (32 bit eiger) or real time exposure time in 100ns (others)
* packetNumber is the packet number
* bunchId is the bunch id from beamline
* timestamp is the time stamp with 10 MHz clock
* modId is the unique module id (unique even for left, right, top, bottom)
* xCoord is the x coordinate in the complete detector system
* yCoord is the y coordinate in the complete detector system
* zCoord is the z coordinate in the complete detector system
* debug is for debugging purposes
* roundRNumber is the round robin set number
* detType is the detector type see :: detectorType
* version is the version number of this structure format
* dataPointer is the pointer to the data
* dataSize in bytes is the size of the data in bytes
* fileDescriptor is the file descriptor
*/
void (*rawDataReadyCallBack)(int, char*, int, FILE*, char*, void*);
void (*rawDataReadyCallBack)(uint64_t, uint32_t, uint32_t, uint64_t, uint64_t, uint16_t, uint16_t, uint16_t, uint16_t, uint32_t, uint16_t, uint8_t, uint8_t,
char*, uint32_t, FILE*, void*);
void *pRawDataReady;
};

View File

@ -125,11 +125,6 @@ class DataStreamer : private virtual slsReceiverDefs, public ThreadObject {
*/
bool IsRunning();
/**
* Create Part1 of Json Header which includes common attributes in an acquisition
*/
void CreateHeaderPart1();
/**
* Record First Indices (firstAcquisitionIndex, firstMeasurementIndex)
* @param fnum frame index to record
@ -172,12 +167,11 @@ class DataStreamer : private virtual slsReceiverDefs, public ThreadObject {
/**
* Create and send Json Header
* @param fnum frame number
* @param snum sub frame number
* @param header header of image
* @param dummy true if its a dummy header
* @returns 0 if error, else 1
*/
int SendHeader(uint64_t fnum, uint32_t snum, bool dummy = false);
int SendHeader(sls_detector_header* header, bool dummy = false);
/** type of thread */
static const std::string TypeName;
@ -227,9 +221,6 @@ class DataStreamer : private virtual slsReceiverDefs, public ThreadObject {
/** timer beginning stamp for random streaming */
struct timespec timerBegin;
/** Current Json Header prefix*/
char* currentHeader;
/** Aquisition Started flag */
bool acquisitionStartedFlag;

View File

@ -11,6 +11,15 @@
#include "sls_receiver_defs.h"
#include "logger.h"
#ifdef HDF5C
//#ifndef HDF5DEFINED
//#define HDF5DEFINED
#include "H5Cpp.h"
#ifndef H5_NO_NAMESPACE
using namespace H5;
#endif
#endif
//#endif
#include <string>
@ -58,6 +67,15 @@ class File : private virtual slsReceiverDefs {
*/
virtual fileFormat GetFileType() = 0;
/**
* Get File Handle pointer
* @returns file handle pointer
*/
virtual FILE* GetBinaryFileHandle() {return NULL;};
#ifdef HDF5C
virtual H5File* GetHDF5FileHandle() {return NULL;};
#endif
/**
* Get Member Pointer Values before the object is destroyed
* @param nd pointer to number of detectors in each dimension

View File

@ -230,7 +230,7 @@ class GotthardData : public GeneralData {
packetIndexMask = 1;
maxFramesPerFile = MAX_FRAMES_PER_FILE;
fifoBufferSize = imageSize;
fifoBufferHeaderSize= FIFO_HEADER_NUMBYTES + FILE_FRAME_HEADER_SIZE;
fifoBufferHeaderSize= FIFO_HEADER_NUMBYTES + sizeof(slsReceiverDefs::sls_detector_header);
defaultFifoDepth = 25000;
nPixelsX_Streamer = nPixelsX;
nPixelsY_Streamer = nPixelsY;
@ -256,7 +256,7 @@ class ShortGotthardData : public GeneralData {
frameIndexMask = 0xFFFFFFFF;
maxFramesPerFile = SHORT_MAX_FRAMES_PER_FILE;
fifoBufferSize = imageSize;
fifoBufferHeaderSize= FIFO_HEADER_NUMBYTES + FILE_FRAME_HEADER_SIZE;
fifoBufferHeaderSize= FIFO_HEADER_NUMBYTES + sizeof(slsReceiverDefs::sls_detector_header);
defaultFifoDepth = 25000;
nPixelsX_Streamer = 1280;
nPixelsY_Streamer = 1;
@ -321,7 +321,7 @@ class PropixData : public GeneralData {
packetIndexMask = 1;
maxFramesPerFile = MAX_FRAMES_PER_FILE;
fifoBufferSize = imageSize;
fifoBufferHeaderSize= FIFO_HEADER_NUMBYTES + FILE_FRAME_HEADER_SIZE;
fifoBufferHeaderSize= FIFO_HEADER_NUMBYTES + sizeof(slsReceiverDefs::sls_detector_header);
defaultFifoDepth = 25000;
nPixelsX_Streamer = nPixelsX;
nPixelsY_Streamer = nPixelsY;
@ -352,7 +352,7 @@ class Moench02Data : public GeneralData {
packetIndexMask = 0xFF;
maxFramesPerFile = MOENCH_MAX_FRAMES_PER_FILE;
fifoBufferSize = imageSize;
fifoBufferHeaderSize= FIFO_HEADER_NUMBYTES + FILE_FRAME_HEADER_SIZE;
fifoBufferHeaderSize= FIFO_HEADER_NUMBYTES + sizeof(slsReceiverDefs::sls_detector_header);
defaultFifoDepth = 2500;
nPixelsX_Streamer = nPixelsX;
nPixelsY_Streamer = nPixelsY;
@ -388,7 +388,7 @@ class Moench03Data : public GeneralData {
packetIndexMask = 0xFFFFFFFF;
maxFramesPerFile = JFRAU_MAX_FRAMES_PER_FILE;
fifoBufferSize = imageSize;
fifoBufferHeaderSize= FIFO_HEADER_NUMBYTES + FILE_FRAME_HEADER_SIZE;
fifoBufferHeaderSize= FIFO_HEADER_NUMBYTES + sizeof(slsReceiverDefs::sls_detector_header);
defaultFifoDepth = 2500;
nPixelsX_Streamer = nPixelsX;
nPixelsY_Streamer = nPixelsY;
@ -416,7 +416,7 @@ class JCTBData : public GeneralData {
imageSize = dataSize*packetsPerFrame;
maxFramesPerFile = JFCTB_MAX_FRAMES_PER_FILE;
fifoBufferSize = imageSize;
fifoBufferHeaderSize= FIFO_HEADER_NUMBYTES + FILE_FRAME_HEADER_SIZE;
fifoBufferHeaderSize= FIFO_HEADER_NUMBYTES + sizeof(slsReceiverDefs::sls_detector_header);
defaultFifoDepth = 2500;
nPixelsX_Streamer = nPixelsX;
nPixelsY_Streamer = nPixelsY;
@ -463,7 +463,7 @@ private:
imageSize = dataSize*packetsPerFrame;
maxFramesPerFile = JFRAU_MAX_FRAMES_PER_FILE;
fifoBufferSize = imageSize;
fifoBufferHeaderSize= FIFO_HEADER_NUMBYTES + FILE_FRAME_HEADER_SIZE;
fifoBufferHeaderSize= FIFO_HEADER_NUMBYTES + sizeof(slsReceiverDefs::sls_detector_header);
defaultFifoDepth = 2500;
nPixelsX_Streamer = nPixelsX;
nPixelsY_Streamer = nPixelsY;
@ -553,7 +553,7 @@ private:
frameIndexMask = 0xffffff;
maxFramesPerFile = EIGER_MAX_FRAMES_PER_FILE;
fifoBufferSize = imageSize;
fifoBufferHeaderSize= FIFO_HEADER_NUMBYTES + FILE_FRAME_HEADER_SIZE;
fifoBufferHeaderSize= FIFO_HEADER_NUMBYTES + sizeof(slsReceiverDefs::sls_detector_header);
defaultFifoDepth = 100;
footerOffset = headerSizeinPacket + dataSize;
threadsPerReceiver = 2;

View File

@ -12,10 +12,14 @@
#include "File.h"
#include "HDF5FileStatic.h"
//#ifndef HDF5DEFINED
//#define HDF5DEFINED
#include "H5Cpp.h"
#ifndef H5_NO_NAMESPACE
using namespace H5;
#endif
//#endif
#include <string>
@ -54,6 +58,12 @@ class HDF5File : private virtual slsReceiverDefs, public File, public HDF5FileSt
*/
void PrintMembers();
/**
* Get File Handle pointer
* @returns file handle pointer
*/
H5File* GetHDF5FileHandle();
/**
* Set Number of pixels
* @param nx number of pixels in x direction

View File

@ -518,31 +518,42 @@ class UDPBaseImplementation : protected virtual slsReceiverDefs, public UDPInter
* fileindex
* datasize
*
* return value is the action which decides what the user and default responsibilities to save data are
* return value is
* 0 callback takes care of open,close,wrie file
* 1 callback writes file, we have to open, close it
* 2 we open, close, write file, callback does not do anything
*/
void registerCallBackStartAcquisition(int (*func)(char*, char*,int, int, void*),void *arg);
void registerCallBackStartAcquisition(int (*func)(char*, char*, uint64_t, uint32_t, void*),void *arg);
/**
* Call back for acquisition finished
* callback argument is
* total frames caught
*/
void registerCallBackAcquisitionFinished(void (*func)(int, void*),void *arg);
void registerCallBackAcquisitionFinished(void (*func)(uint64_t, void*),void *arg);
/**
* Call back for raw data
* args to raw data ready callback are
* framenum
* datapointer
* datasize in bytes
* file descriptor
* guidatapointer (NULL, no data required)
* frameNumber is the frame number
* expLength is the subframe number (32 bit eiger) or real time exposure time in 100ns (others)
* packetNumber is the packet number
* bunchId is the bunch id from beamline
* timestamp is the time stamp with 10 MHz clock
* modId is the unique module id (unique even for left, right, top, bottom)
* xCoord is the x coordinate in the complete detector system
* yCoord is the y coordinate in the complete detector system
* zCoord is the z coordinate in the complete detector system
* debug is for debugging purposes
* roundRNumber is the round robin set number
* detType is the detector type see :: detectorType
* version is the version number of this structure format
* dataPointer is the pointer to the data
* dataSize in bytes is the size of the data in bytes
* fileDescriptor is the file descriptor
*/
void registerCallBackRawDataReady(void (*func)(int, char*, int, FILE*, char*, void*),void *arg);
void registerCallBackRawDataReady(void (*func)(uint64_t, uint32_t, uint32_t, uint64_t, uint64_t, uint16_t, uint16_t, uint16_t, uint16_t, uint32_t, uint16_t, uint8_t, uint8_t,
char*, uint32_t, FILE*, void*),void *arg);
@ -623,7 +634,7 @@ class UDPBaseImplementation : protected virtual slsReceiverDefs, public UDPInter
//***callback parameters***
/**
* function being called back for start acquisition
* Call back for start acquisition
* callback arguments are
* filepath
* filename
@ -635,31 +646,42 @@ class UDPBaseImplementation : protected virtual slsReceiverDefs, public UDPInter
* 1 callback writes file, we have to open, close it
* 2 we open, close, write file, callback does not do anything
*/
int (*startAcquisitionCallBack)(char*, char*,int, int, void*);
int (*startAcquisitionCallBack)(char*, char*, uint64_t, uint32_t, void*);
void *pStartAcquisition;
/**
* function being called back for acquisition finished
* Call back for acquisition finished
* callback argument is
* total frames caught
*/
void (*acquisitionFinishedCallBack)(int, void*);
void (*acquisitionFinishedCallBack)(uint64_t, void*);
void *pAcquisitionFinished;
/**
* function being called back for raw data
* Call back for raw data
* args to raw data ready callback are
* framenum
* datapointer
* datasize in bytes
* file descriptor
* guidatapointer (NULL, no data required)
* frameNumber is the frame number
* expLength is the subframe number (32 bit eiger) or real time exposure time in 100ns (others)
* packetNumber is the packet number
* bunchId is the bunch id from beamline
* timestamp is the time stamp with 10 MHz clock
* modId is the unique module id (unique even for left, right, top, bottom)
* xCoord is the x coordinate in the complete detector system
* yCoord is the y coordinate in the complete detector system
* zCoord is the z coordinate in the complete detector system
* debug is for debugging purposes
* roundRNumber is the round robin set number
* detType is the detector type see :: detectorType
* version is the version number of this structure format
* dataPointer is the pointer to the data
* dataSize in bytes is the size of the data in bytes
* fileDescriptor is the file descriptor
*/
void (*rawDataReadyCallBack)(int, char*, int, FILE*, char*, void*);
void (*rawDataReadyCallBack)(uint64_t, uint32_t, uint32_t, uint64_t, uint64_t, uint16_t, uint16_t, uint16_t, uint16_t, uint32_t, uint16_t, uint8_t, uint8_t,
char*, uint32_t, FILE*, void*);
void *pRawDataReady;
private:
private:
};

View File

@ -582,25 +582,37 @@ class UDPInterface {
* 1 callback writes file, we have to open, close it
* 2 we open, close, write file, callback does not do anything
*/
virtual void registerCallBackStartAcquisition(int (*func)(char*, char*,int, int, void*),void *arg) = 0;
virtual void registerCallBackStartAcquisition(int (*func)(char*, char*, uint64_t, uint32_t, void*),void *arg) = 0;
/**
* Call back for acquisition finished
* callback argument is
* total frames caught
*/
virtual void registerCallBackAcquisitionFinished(void (*func)(int, void*),void *arg) = 0;
virtual void registerCallBackAcquisitionFinished(void (*func)(uint64_t, void*),void *arg) = 0;
/**
* Call back for raw data
* args to raw data ready callback are
* framenum
* datapointer
* datasize in bytes
* file descriptor
* guidatapointer (NULL, no data required)
* frameNumber is the frame number
* expLength is the subframe number (32 bit eiger) or real time exposure time in 100ns (others)
* packetNumber is the packet number
* bunchId is the bunch id from beamline
* timestamp is the time stamp with 10 MHz clock
* modId is the unique module id (unique even for left, right, top, bottom)
* xCoord is the x coordinate in the complete detector system
* yCoord is the y coordinate in the complete detector system
* zCoord is the z coordinate in the complete detector system
* debug is for debugging purposes
* roundRNumber is the round robin set number
* detType is the detector type see :: detectorType
* version is the version number of this structure format
* dataPointer is the pointer to the data
* dataSize in bytes is the size of the data in bytes
* fileDescriptor is the file descriptor
*/
virtual void registerCallBackRawDataReady(void (*func)(int, char*, int, FILE*, char*, void*),void *arg) = 0;
virtual void registerCallBackRawDataReady(void (*func)(uint64_t, uint32_t, uint32_t, uint64_t, uint64_t, uint16_t, uint16_t, uint16_t, uint16_t, uint32_t, uint16_t, uint8_t, uint8_t,
char*, uint32_t, FILE*, void*),void *arg) = 0;
protected:

View File

@ -59,13 +59,6 @@ class UDPStandardImplementation: private virtual slsReceiverDefs, public UDPBase
*/
void setFileFormat(slsReceiverDefs::fileFormat f);
/**
* Set File Name Prefix (without frame index, file index and extension (_f000000000000_8.raw))
* Does not check for file existence since it is created only at startReceiver
* @param c file name (max of 1000 characters)
*/
void setFileName(const char c[]);
/**
* Set Short Frame Enabled, later will be moved to getROI (so far only for gotthard)
* @param i index of adc enabled, else -1 if all enabled

View File

@ -8,6 +8,7 @@
*/
#include "ansi.h"
//#include "sls_receiver_defs.h"
#include <zmq.h>
#include <errno.h>
@ -306,23 +307,13 @@ public:
cprintf (RED,"Error: Could not parse header for socket %d\n",index);
return 0;
}
#ifdef VERYVERBOSE
printf("version:%.1f\n", d["version"].GetDouble());
// shape is an array of ints
rapidjson::Value::Array shape = d["shape"].GetArray();
printf("%d: shape: ", index);
for (int i = 0; i < shape.Size(); i++)
printf("%d: %d ", index, shape[i].GetInt());
printf("\n");
printf("%d: type: %s\n", index, d["type"].GetString());
#endif
if(d["acqIndex"].GetUint64()!=-1){
if(d["acqIndex"].GetUint64()!=(uint64_t)-1) {
acqIndex = d["acqIndex"].GetUint64();
frameIndex = d["fIndex"].GetUint64();
subframeIndex = d["subfnum"].GetUint();
subframeIndex = -1;
if(d["bitmode"].GetInt()==32 && d["detType"].GetUint() == slsReceiverDefs::EIGER) {
subframeIndex = d["expLength"].GetUint();
}
filename = d["fname"].GetString();
#ifdef VERYVERBOSE
cout << "Acquisition index: " << acqIndex << endl;

View File

@ -15,10 +15,12 @@
#define DO_EVERYTHING 2
//binary file/ fifo
#define FILE_FRAME_HDR_FNUM_SIZE 8
#define FILE_FRAME_HDR_SNUM_SIZE 4
#define FILE_FRAME_HDR_BID_SIZE 8
#define FILE_FRAME_HEADER_SIZE (FILE_FRAME_HDR_FNUM_SIZE + FILE_FRAME_HDR_SNUM_SIZE + FILE_FRAME_HDR_BID_SIZE)
//#define FILE_FRAME_HDR_FNUM_SIZE 8
//#define FILE_FRAME_HDR_SNUM_SIZE 8
//#define FILE_FRAME_HDR_BID_SIZE 8
//#define FILE_FRAME_HEADER_SIZE (FILE_FRAME_HDR_FNUM_SIZE + FILE_FRAME_HDR_SNUM_SIZE + FILE_FRAME_HDR_BID_SIZE)
#define FIFO_HEADER_NUMBYTES 4
#define FILE_BUFFER_SIZE (16*1024*1024) //16mb
@ -26,10 +28,10 @@
#define MAX_CHUNKED_IMAGES 1
//versions
#define STREAMER_VERSION 1.0
#define HDF5_WRITER_VERSION 1.0
#define BINARY_WRITER_VERSION 1.0 //1 decimal places
#define HDF5_WRITER_VERSION 1.0 //1 decimal places
#define BINARY_WRITER_VERSION 1.0 //1 decimal places
#define SLS_DETECTOR_HEADER_VERSION 0x1
#define SLS_DETECTOR_JSON_HEADER_VERSION 0x2
//parameters to calculate fifo depth
#define SAMPLE_TIME_IN_NS 100000000//100ms

View File

@ -58,28 +58,49 @@ class slsReceiver : private virtual slsReceiverDefs {
int64_t getReceiverVersion();
/**
@sort register calbback for starting the acquisition
@param func callback to be called when starting the acquisition. Its arguments are filepath filename fileindex data size
\returns 0 callback takes care of open,close,write file; 1 callback writes file, we have to open, close it; 2 we open, close, write file, callback does not do anything
* Call back for start acquisition
* callback arguments are
* filepath
* filename
* fileindex
* datasize
*
* return value is
* 0 callback takes care of open,close,wrie file
* 1 callback writes file, we have to open, close it
* 2 we open, close, write file, callback does not do anything
*/
void registerCallBackStartAcquisition(int (*func)(char*, char*,int, int, void*),void *arg);
void registerCallBackStartAcquisition(int (*func)(char*, char*, uint64_t, uint32_t, void*),void *arg);
/**
callback argument is
toatal farmes caught
* Call back for acquisition finished
* callback argument is
* total frames caught
*/
void registerCallBackAcquisitionFinished(void (*func)(int, void*),void *arg);
void registerCallBackAcquisitionFinished(void (*func)(uint64_t, void*),void *arg);
/**
args to raw data ready callback are
framenum
datapointer
datasize in bytes
file descriptor
guidatapointer (NULL, no data required)
* Call back for raw data
* args to raw data ready callback are
* frameNumber is the frame number
* expLength is the subframe number (32 bit eiger) or real time exposure time in 100ns (others)
* packetNumber is the packet number
* bunchId is the bunch id from beamline
* timestamp is the time stamp with 10 MHz clock
* modId is the unique module id (unique even for left, right, top, bottom)
* xCoord is the x coordinate in the complete detector system
* yCoord is the y coordinate in the complete detector system
* zCoord is the z coordinate in the complete detector system
* debug is for debugging purposes
* roundRNumber is the round robin set number
* detType is the detector type see :: detectorType
* version is the version number of this structure format
* dataPointer is the pointer to the data
* dataSize in bytes is the size of the data in bytes
* fileDescriptor is the file descriptor
*/
void registerCallBackRawDataReady(void (*func)(int, char*, int, FILE*, char*, void*),void *arg);
void registerCallBackRawDataReady(void (*func)(uint64_t, uint32_t, uint32_t, uint64_t, uint64_t, uint16_t, uint16_t, uint16_t, uint16_t, uint32_t, uint16_t, uint8_t, uint8_t,
char*, uint32_t, FILE*, void*),void *arg);
private:

View File

@ -64,30 +64,42 @@ class slsReceiverTCPIPInterface : private virtual slsReceiverDefs {
* fileindex
* datasize
*
* return value is the action which decides what the user and default responsibilities to save data are
* return value is
* 0 callback takes care of open,close,wrie file
* 1 callback writes file, we have to open, close it
* 2 we open, close, write file, callback does not do anything
*/
void registerCallBackStartAcquisition(int (*func)(char*, char*,int, int, void*),void *arg);
void registerCallBackStartAcquisition(int (*func)(char*, char*, uint64_t, uint32_t, void*),void *arg);
/**
* Call back for acquisition finished
* callback argument is
* total frames caught
*/
void registerCallBackAcquisitionFinished(void (*func)(int, void*),void *arg);
void registerCallBackAcquisitionFinished(void (*func)(uint64_t, void*),void *arg);
/**
* Call back for raw data
* args to raw data ready callback are
* framenum
* datapointer
* datasize in bytes
* file descriptor
* guidatapointer (NULL, no data required)
* frameNumber is the frame number
* expLength is the subframe number (32 bit eiger) or real time exposure time in 100ns (others)
* packetNumber is the packet number
* bunchId is the bunch id from beamline
* timestamp is the time stamp with 10 MHz clock
* modId is the unique module id (unique even for left, right, top, bottom)
* xCoord is the x coordinate in the complete detector system
* yCoord is the y coordinate in the complete detector system
* zCoord is the z coordinate in the complete detector system
* debug is for debugging purposes
* roundRNumber is the round robin set number
* detType is the detector type see :: detectorType
* version is the version number of this structure format
* dataPointer is the pointer to the data
* dataSize in bytes is the size of the data in bytes
* fileDescriptor is the file descriptor
*/
void registerCallBackRawDataReady(void (*func)(int, char*, int, FILE*, char*, void*),void *arg);
void registerCallBackRawDataReady(void (*func)(uint64_t, uint32_t, uint32_t, uint64_t, uint64_t, uint16_t, uint16_t, uint16_t, uint16_t, uint32_t, uint16_t, uint8_t, uint8_t,
char*, uint32_t, FILE*, void*),void *arg);
private:
@ -290,7 +302,7 @@ private:
//***callback parameters***
/**
* function being called back for start acquisition
* Call back for start acquisition
* callback arguments are
* filepath
* filename
@ -302,31 +314,44 @@ private:
* 1 callback writes file, we have to open, close it
* 2 we open, close, write file, callback does not do anything
*/
int (*startAcquisitionCallBack)(char*, char*,int, int, void*);
int (*startAcquisitionCallBack)(char*, char*, uint64_t, uint32_t, void*);
void *pStartAcquisition;
/**
* function being called back for acquisition finished
* Call back for acquisition finished
* callback argument is
* total frames caught
*/
void (*acquisitionFinishedCallBack)(int, void*);
void (*acquisitionFinishedCallBack)(uint64_t, void*);
void *pAcquisitionFinished;
/**
* function being called back for raw data
* Call back for raw data
* args to raw data ready callback are
* framenum
* datapointer
* datasize in bytes
* file descriptor
* guidatapointer (NULL, no data required)
* frameNumber is the frame number
* expLength is the subframe number (32 bit eiger) or real time exposure time in 100ns (others)
* packetNumber is the packet number
* bunchId is the bunch id from beamline
* timestamp is the time stamp with 10 MHz clock
* modId is the unique module id (unique even for left, right, top, bottom)
* xCoord is the x coordinate in the complete detector system
* yCoord is the y coordinate in the complete detector system
* zCoord is the z coordinate in the complete detector system
* debug is for debugging purposes
* roundRNumber is the round robin set number
* detType is the detector type see :: detectorType
* version is the version number of this structure format
* dataPointer is the pointer to the data
* dataSize in bytes is the size of the data in bytes
* fileDescriptor is the file descriptor
*/
void (*rawDataReadyCallBack)(int, char*, int, FILE*, char*, void*);
void (*rawDataReadyCallBack)(uint64_t, uint32_t, uint32_t, uint64_t, uint64_t, uint16_t, uint16_t, uint16_t, uint16_t, uint32_t, uint16_t, uint8_t, uint8_t,
char*, uint32_t, FILE*, void*);
void *pRawDataReady;
protected:
/** Socket */
MySocketTCP* mySock;

View File

@ -50,13 +50,10 @@ public:
/**
@sort register calbback for starting the acquisition
\param func callback to be called when starting the acquisition. Its arguments are filepath filename fileindex data size
\param func callback to be called when starting the acquisition. Its arguments are filepath, filename, fileindex, datasize
\returns 0 callback takes care of open,close,write file; 1 callback writes file, we have to open, close it; 2 we open, close, write file, callback does not do anything
*/
void registerCallBackStartAcquisition(int (*func)(char* filepath, char* filename,int fileindex, int datasize, void*),void *arg);
void registerCallBackStartAcquisition(int (*func)(char* filepath, char* filename, uint64_t fileindex, uint32_t datasize, void*),void *arg);
/**
@ -64,20 +61,19 @@ public:
\param func end of acquisition callback. Argument nf is total frames caught
\returns nothing
*/
void registerCallBackAcquisitionFinished(void (*func)(int nf, void*),void *arg);
void registerCallBackAcquisitionFinished(void (*func)(uint64_t nf, void*),void *arg);
/**
@sort register callback to be called when data are available (to process and/or save the data).
\param func raw data ready callback. arguments are framenum datapointer datasize file descriptor guidatapointer (NULL, no data required)
\returns nothing
*/
\param func raw data ready callback. arguments are frameNumber, expLength, packetNumber, bunchId, timestamp, modId, xCoord, yCoord, zCoord, debug, roundRNumber, detType, version, dataPointer, dataSize, fileDescriptor
\returns nothing
*/
void registerCallBackRawDataReady(void (*func)(uint64_t frameNumber, uint32_t expLength, uint32_t packetNumber, uint64_t bunchId, uint64_t timestamp,
uint16_t modId, uint16_t xCoord, uint16_t yCoord, uint16_t zCoord, uint32_t debug, uint16_t roundRNumber, uint8_t detType, uint8_t version,
char* datapointer, uint32_t datasize, FILE* filedescriptor, void*),void *arg);
void registerCallBackRawDataReady(void (*func)(int framenumber, char* datapointer, int datasize, FILE* filedescriptor, char* guidatapointer, void*),void *arg);
//receiver object
slsReceiver* receiver;
};

View File

@ -115,6 +115,40 @@ public:
STOPPED /**< acquisition stopped externally */
};
/**
@short structure for a Detector Packet or Image Header
@li frameNumber is the frame number
@li expLength is the subframe number (32 bit eiger) or real time exposure time in 100ns (others)
@li packetNumber is the packet number
@li bunchId is the bunch id from beamline
@li timestamp is the time stamp with 10 MHz clock
@li modId is the unique module id (unique even for left, right, top, bottom)
@li xCoord is the x coordinate in the complete detector system
@li yCoord is the y coordinate in the complete detector system
@li zCoord is the z coordinate in the complete detector system
@li debug is for debugging purposes
@li roundRNumber is the round robin set number
@li detType is the detector type see :: detectorType
@li version is the version number of this structure format
*/
typedef struct {
uint64_t frameNumber; /**< is the frame number */
uint32_t expLength; /**< is the subframe number (32 bit eiger) or real time exposure time in 100ns (others) */
uint32_t packetNumber; /**< is the packet number */
uint64_t bunchId; /**< is the bunch id from beamline */
uint64_t timestamp; /**< is the time stamp with 10 MHz clock */
uint16_t modId; /**< is the unique module id (unique even for left, right, top, bottom) */
uint16_t xCoord; /**< is the x coordinate in the complete detector system */
uint16_t yCoord; /**< is the y coordinate in the complete detector system */
uint16_t zCoord; /**< is the z coordinate in the complete detector system */
uint32_t debug; /**< is for debugging purposes */
uint16_t roundRNumber; /**< is the round robin set number */
uint8_t detType; /**< is the detector type see :: detectorType */
uint8_t version; /**< is the version number of this structure format */
} sls_detector_header;
/**
format
*/