mirror of
https://github.com/slsdetectorgroup/slsDetectorPackage.git
synced 2025-06-11 04:17:15 +02:00
Complete rewrite of receiver, with new changes
This commit is contained in:
90
slsReceiverSoftware/include/DataStreamer.h
Normal file
90
slsReceiverSoftware/include/DataStreamer.h
Normal file
@ -0,0 +1,90 @@
|
||||
/************************************************
|
||||
* @file DataStreamer.h
|
||||
* @short streams data from receiver via ZMQ
|
||||
***********************************************/
|
||||
#ifndef DATASTREAMER_H
|
||||
#define DATASTREAMER_H
|
||||
/**
|
||||
*@short creates & manages a data streamer thread each
|
||||
*/
|
||||
|
||||
#include "ThreadObject.h"
|
||||
|
||||
class DataStreamer : private virtual slsReceiverDefs, public ThreadObject {
|
||||
|
||||
public:
|
||||
/**
|
||||
* Constructor
|
||||
* Calls Base Class CreateThread(), sets ErrorMask if error and increments NumberofDataStreamers
|
||||
*/
|
||||
DataStreamer();
|
||||
|
||||
/**
|
||||
* Destructor
|
||||
* Calls Base Class DestroyThread() and decrements NumberofDataStreamers
|
||||
*/
|
||||
~DataStreamer();
|
||||
|
||||
|
||||
/**
|
||||
* Get RunningMask
|
||||
* @return RunningMask
|
||||
*/
|
||||
static uint64_t GetErrorMask();
|
||||
|
||||
/**
|
||||
* Reset RunningMask
|
||||
*/
|
||||
static void ResetRunningMask();
|
||||
|
||||
|
||||
/**
|
||||
* Set bit in RunningMask to allow thread to run
|
||||
*/
|
||||
void StartRunning();
|
||||
|
||||
/**
|
||||
* Reset bit in RunningMask to prevent thread from running
|
||||
*/
|
||||
void StopRunning();
|
||||
|
||||
|
||||
private:
|
||||
|
||||
/**
|
||||
* Get Type
|
||||
* @return type
|
||||
*/
|
||||
std::string GetType();
|
||||
|
||||
/**
|
||||
* Returns if the thread is currently running
|
||||
* @returns true if thread is running, else false
|
||||
*/
|
||||
bool IsRunning();
|
||||
|
||||
/**
|
||||
* Thread Exeution for DataStreamer Class
|
||||
* Stream an image via zmq
|
||||
*/
|
||||
void ThreadExecution();
|
||||
|
||||
|
||||
|
||||
/** type of thread */
|
||||
static const std::string TypeName;
|
||||
|
||||
/** Total Number of DataStreamer Objects */
|
||||
static int NumberofDataStreamers;
|
||||
|
||||
/** Mask of errors on any object eg.thread creation */
|
||||
static uint64_t ErrorMask;
|
||||
|
||||
/** Mask of all listener objects running */
|
||||
static uint64_t RunningMask;
|
||||
|
||||
/** mutex to update static items among objects (threads)*/
|
||||
static pthread_mutex_t Mutex;
|
||||
};
|
||||
|
||||
#endif
|
Reference in New Issue
Block a user