/************************************************ * @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