somewhere

This commit is contained in:
Dhanya Maliakal
2017-02-10 10:08:00 +01:00
parent c89f6e649c
commit b260d08225
18 changed files with 1076 additions and 356 deletions

View File

@ -27,8 +27,16 @@ class DataProcessor : private virtual slsReceiverDefs, public ThreadObject {
* @param f address of Fifo pointer
* @param s pointer to receiver status
* @param m pointer to mutex for status
* @param ftype pointer to file format type
* @param fwenable pointer to file writer enable
* @param cbaction pointer to call back action
* @param dataReadycb pointer to data ready call back function
* @param pDataReadycb pointer to arguments of data ready call back function
*/
DataProcessor(Fifo*& f, runStatus* s, pthread_mutex_t* m);
DataProcessor(Fifo*& f, runStatus* s, pthread_mutex_t* m, fileFormat* ftype, bool* fwenable,
int* cbaction,
void (*dataReadycb)(int, char*, int, FILE*, char*, void*),
void *pDataReadycb);
/**
* Destructor
@ -37,23 +45,18 @@ class DataProcessor : private virtual slsReceiverDefs, public ThreadObject {
~DataProcessor();
//*** static functions ***
/**
* Get RunningMask
* @return RunningMask
* Get ErrorMask
* @return ErrorMask
*/
static uint64_t GetErrorMask();
/**
* Get acquisition started flag
* @return acquisition started flag
* Get RunningMask
* @return RunningMask
*/
static bool GetAcquisitionStartedFlag();
/**
* Get measurement started flag
* @return measurement started flag
*/
static bool GetMeasurementStartedFlag();
static uint64_t GetRunningMask();
/**
* Set GeneralData pointer to the one given
@ -61,6 +64,22 @@ class DataProcessor : private virtual slsReceiverDefs, public ThreadObject {
*/
static void SetGeneralData(GeneralData*& g);
//*** non static functions ***
//*** getters ***
/**
* Get acquisition started flag
* @return acquisition started flag
*/
bool GetAcquisitionStartedFlag();
/**
* Get measurement started flag
* @return measurement started flag
*/
bool GetMeasurementStartedFlag();
/**
* Get Total Complete Frames Caught for an entire acquisition (including all scans)
* @return total number of frames caught for entire acquisition
@ -79,6 +98,8 @@ class DataProcessor : private virtual slsReceiverDefs, public ThreadObject {
*/
uint64_t GetProcessedAcquisitionIndex();
//*** setters ***
/**
* Set bit in RunningMask to allow thread to run
*/
@ -105,6 +126,31 @@ class DataProcessor : private virtual slsReceiverDefs, public ThreadObject {
*/
void ResetParametersforNewMeasurement();
/**
* Set Max frames per file
*/
void SetMaxFramesPerFile();
/**
* Set File Format
* @param f file format
*/
void SetFileFormat(const fileFormat fs);
/**
* Set up file writer object and call backs
* @param fname pointer to file name prefix
* @param fpath pointer to file path
* @param findex pointer to file index
* @param frindexenable pointer to frame index enable
* @param owenable pointer to over write enable
* @param dindex pointer to detector index
* @param nunits pointer to number of theads/ units per detector
*/
void SetupFileWriter(char* fname, char* fpath, uint64_t* findex,
bool* frindexenable, bool* owenable, int* dindex, int* nunits);
/**
* Create New File
*/
@ -129,6 +175,18 @@ class DataProcessor : private virtual slsReceiverDefs, public ThreadObject {
*/
bool IsRunning();
/**
* Record First Indices (firstAcquisitionIndex, firstMeasurementIndex)
* @param fnum frame index to record
*/
void RecordFirstIndices(uint64_t fnum);
/**
* Destroy file writer object
* @return OK or FAIL
*/
void DestroyFileWriter();
/**
* Thread Exeution for DataProcessor Class
* Pop bound addresses, process them,
@ -143,6 +201,13 @@ class DataProcessor : private virtual slsReceiverDefs, public ThreadObject {
*/
void StopProcessing(char* buf);
/**
* Process an image popped from fifo,
* write to file if fw enabled & update parameters
* @param buffer
*/
void ProcessAnImage(char* buf);
/** type of thread */
@ -169,10 +234,10 @@ class DataProcessor : private virtual slsReceiverDefs, public ThreadObject {
// individual members
/** Aquisition Started flag */
static bool acquisitionStartedFlag;
bool acquisitionStartedFlag;
/** Measurement Started flag */
static bool measurementStartedFlag;
bool measurementStartedFlag;
/** Receiver Status */
runStatus* status;
@ -196,7 +261,37 @@ class DataProcessor : private virtual slsReceiverDefs, public ThreadObject {
uint64_t currentFrameIndex;
/** File writer implemented as binary or hdf5 filewriter */
std::vector <FileWriter*> fileWriter;
FileWriter* fileWriter;
/** File Format Type */
fileFormat* fileFormatType;
/** File Write Enable */
bool* fileWriteEnable;
//***callback parameters***
/** Pointer to the action which decides what the user and default responsibilities to save data are
* 0 raw data ready 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 */
int* callbackAction;
/**
* function being called back for raw data
* args to raw data ready callback are
* framenum
* datapointer
* datasize in bytes
* file descriptor
* guidatapointer (NULL, no data required)
*/
void (*rawDataReadyCallBack)(int, char*, int, FILE*, char*, void*);
void *pRawDataReady;
};
#endif