CFEL - ASG Software Suite
2.5.0
CASS
|
Input base class. More...
#include <input_base.h>
Public Types | |
typedef std::tr1::shared_ptr< InputBase > | shared_pointer |
shared pointer of this type More... | |
typedef RingBuffer< CASSEvent >::iter_type | rbItem_t |
define an item in the ringbuffer More... | |
![]() | |
enum | status_t { running, paused, notstarted } |
enum describing the internal status of the thread More... | |
enum | control_t { _run, _quit, _pause } |
enum describing the control status of the thread More... | |
enum | exception_t { NO_EXCEPTION, INVALID_ARGUMENT_EXCEPTION, RUNTIME_ERROR_EXCEPTION, OUT_OF_RANGE_EXCEPTION, LOGIC_ERROR_EXCEPTION, STANDART_EXCEPTION, UNKNOWN_EXCEPTION } |
enum describing which exception was thrown More... | |
Public Member Functions | |
virtual | ~InputBase () |
destructor More... | |
virtual void | runthis ()=0 |
function with the main loop More... | |
virtual void | load ()=0 |
load the settings of the input module from ini file More... | |
virtual double | progress () |
retrieve the fraction of how much of the input has been processed More... | |
virtual uint64_t | eventcounter () |
retrieve the number of events that have been input so far More... | |
virtual uint64_t | skippedeventcounter () |
retrieve the number of skipped events that have been input so far More... | |
void | newEventAdded (const size_t eventsize) |
increment the numer of events received in the ratemeter More... | |
RingBuffer< CASSEvent > & | ringbuffer () |
retrieve a reference to the the ringbuffer More... | |
rbItem_t | getNextFillable (unsigned timeout=500) |
retrieve an iterator to the next fillable event More... | |
![]() | |
PausableThread (control_t control=_run, QObject *parent=0) | |
constructor More... | |
virtual | ~PausableThread () |
destructor More... | |
void | run () |
run the thread More... | |
void | pause (bool block=false) |
pause the thread More... | |
void | waitUntilPaused () |
waits until thread is paused More... | |
void | resume () |
resume the thread More... | |
status_t | status () const |
return the current status of the thread More... | |
bool | shouldQuit () const |
query whether this thread is told to quit More... | |
void | rethrowException () const |
rethrow the thrown exception More... | |
exception_t | exceptionThrown () const |
![]() | |
QThread (QObject *parent=0) | |
currentThread () | |
HANDLE QThread::currentThreadId() | |
exec () | |
exit (int returnCode=0) | |
finished () | |
idealThreadCount () | |
isFinished () | |
isRunning () | |
msleep (unsigned long msecs) | |
priority () | |
quit () | |
run () | |
setPriority (Priority priority) | |
setStackSize (uint stackSize) | |
setTerminationEnabled (bool enabled=true) | |
sleep (unsigned long secs) | |
stackSize () | |
start (Priority priority=InheritPriority) | |
started () | |
terminate () | |
terminated () | |
usleep (unsigned long usecs) | |
wait (unsigned long time=ULONG_MAX) | |
yieldCurrentThread () | |
Static Public Member Functions | |
static shared_pointer | instance () |
get the signelton instance More... | |
static shared_pointer::element_type & | reference () |
get reference to the singelton instance More... | |
Public Attributes | |
QMutex | lock |
a mutex so that external program can lock access to this More... | |
Protected Member Functions | |
InputBase (RingBuffer< CASSEvent > &ringbuffer, Ratemeter &ratemeter, Ratemeter &loadmeter, QObject *parent=0) | |
protected constructor since it should be a singelton More... | |
![]() | |
void | pausePoint () |
point where the thread will be paused More... | |
Protected Attributes | |
RingBuffer< CASSEvent > & | _ringbuffer |
reference to the ringbuffer More... | |
Ratemeter & | _ratemeter |
ratemeter to measure the rate More... | |
Ratemeter & | _loadmeter |
meter to measure the data load More... | |
![]() | |
QMutex | _pauseMutex |
mutex to wait on until thread is paused More... | |
QWaitCondition | _pauseCondition |
wait condition to wait on until thread is resumed More... | |
QWaitCondition | _waitUntilPausedCondition |
wait condition to wait unitl thread is paused More... | |
status_t | _status |
the internal status of the thread More... | |
control_t | _control |
the internal control status of the thread More... | |
size_t | _pausecount |
a counter how many threads have pause this thread More... | |
exception_t | _exception_thrown |
flag to show that general exception was thrown More... | |
std::invalid_argument | _invarg_excep |
the invalid arguemnt exception thrown More... | |
std::runtime_error | _runt_excep |
the invalid arguemnt exception thrown More... | |
std::out_of_range | _outrange_excep |
the invalid arguemnt exception thrown More... | |
std::logic_error | _logic_excep |
the invalid arguemnt exception thrown More... | |
Static Protected Attributes | |
static shared_pointer | _instance |
singelton instance More... | |
Static Private Attributes | |
static QMutex | _mutex |
a mutex to lock operations More... | |
Additional Inherited Members | |
![]() | |
virtual void | end () |
tell the thread to quit More... | |
Input base class.
This class acts as base class for all input modules.
Definition at line 31 of file input_base.h.
typedef RingBuffer<CASSEvent>::iter_type cass::InputBase::rbItem_t |
define an item in the ringbuffer
Definition at line 109 of file input_base.h.
typedef std::tr1::shared_ptr<InputBase> cass::InputBase::shared_pointer |
shared pointer of this type
Definition at line 35 of file input_base.h.
|
inlinevirtual |
destructor
Definition at line 38 of file input_base.h.
|
inlineprotected |
protected constructor since it should be a singelton
ringbuffer | reference to the ringbuffer containing the CASSEvents |
ratemeter | reference to the ratemeter to measure the rate of the input |
loadmeter | reference to the ratemeter to measure the load of the input |
parent | The parent QT Object of this class |
Definition at line 129 of file input_base.h.
|
virtual |
retrieve the number of events that have been input so far
needs to be implemented by the individual imputs, defaults to 0 otherwise
Reimplemented in cass::SACLAOnlineInput, cass::XFELHDF5FileInput, cass::SharedMemoryInput, cass::SACLAOfflineInput, cass::FileInput, cass::XFELOnlineInput, and cass::ZMQInput.
Definition at line 62 of file input_base.cpp.
Referenced by cass::HDF5FileInput::runthis().
InputBase::rbItem_t InputBase::getNextFillable | ( | unsigned | timeout = 500 | ) |
retrieve an iterator to the next fillable event
try to get an event to be filled from the buffer. Do this until either an event could be retrieved or the thread has been told to quit.
Definition at line 48 of file input_base.cpp.
Referenced by cass::SharedMemoryInput::processDgram(), cass::MultiFileInput::readEventData(), cass::ZMQInput::runthis(), cass::XFELOnlineInput::runthis(), cass::TCPInput::runthis(), cass::XFELHDF5FileInput::runthis(), cass::SACLAOnlineInput::runthis(), and cass::HDF5FileInput::runthis().
|
static |
get the signelton instance
throws logic error when instance does not exist yet
Definition at line 20 of file input_base.cpp.
|
pure virtual |
load the settings of the input module from ini file
Implemented in cass::HDF5FileInput, cass::SACLAOnlineInput, cass::XFELHDF5FileInput, cass::SharedMemoryInput, cass::MultiFileInput, cass::TCPInput, cass::SACLAOfflineInput, cass::XFELOnlineInput, cass::FileInput, cass::ZMQInput, and cass::TestInput.
void InputBase::newEventAdded | ( | const size_t | eventsize | ) |
increment the numer of events received in the ratemeter
To indicate that we are done processing an event this signal is emitted. This is used for by the ratemeter to evaluate how fast we get events.
eventsize | size of the event in bytes |
Definition at line 37 of file input_base.cpp.
Referenced by cass::SharedMemoryInput::processDgram(), cass::MultiFileInput::readEventData(), cass::TestInput::run(), cass::ZMQInput::runthis(), cass::XFELOnlineInput::runthis(), cass::TCPInput::runthis(), cass::XFELHDF5FileInput::runthis(), cass::SACLAOnlineInput::runthis(), and cass::HDF5FileInput::runthis().
|
virtual |
retrieve the fraction of how much of the input has been processed
needs to be implemented by the individual inputs, defaults to 0 in case it has not been implemented
Reimplemented in cass::XFELHDF5FileInput, cass::SACLAOfflineInput, and cass::FileInput.
Definition at line 57 of file input_base.cpp.
|
static |
get reference to the singelton instance
throws logic error when instance does not exist yet
Definition at line 28 of file input_base.cpp.
Referenced by cass::pp76::processEvent(), cass::RatePlotter::run(), cass::TxtParser::runthis(), cass::XtcParser::runthis(), and cass::ACQIRIS::LMAParser::runthis().
RingBuffer< CASSEvent > & InputBase::ringbuffer | ( | ) |
retrieve a reference to the the ringbuffer
Definition at line 43 of file input_base.cpp.
|
pure virtual |
function with the main loop
the implementation of this function needs to start by setting the _status variable of the PausableThread to running.like follows: _status = lmf::PausableThread::running;
Implements lmf::PausableThread.
Implemented in cass::HDF5FileInput, cass::SACLAOnlineInput, cass::XFELHDF5FileInput, cass::MultiFileInput, cass::TCPInput, cass::SACLAOfflineInput, cass::XFELOnlineInput, cass::FileInput, cass::SharedMemoryInput, and cass::ZMQInput.
|
virtual |
retrieve the number of skipped events that have been input so far
needs to be implemented by the individual imputs, defaults to 0 otherwise
Reimplemented in cass::SACLAOnlineInput, cass::XFELHDF5FileInput, cass::SharedMemoryInput, cass::SACLAOfflineInput, cass::FileInput, cass::XFELOnlineInput, and cass::ZMQInput.
Definition at line 67 of file input_base.cpp.
|
staticprotected |
singelton instance
Definition at line 149 of file input_base.h.
|
protected |
meter to measure the data load
Definition at line 146 of file input_base.h.
|
staticprivate |
a mutex to lock operations
Definition at line 153 of file input_base.h.
|
protected |
ratemeter to measure the rate
Definition at line 143 of file input_base.h.
|
protected |
reference to the ringbuffer
Definition at line 140 of file input_base.h.
Referenced by cass::SharedMemoryInput::processDgram(), cass::MultiFileInput::readEventData(), cass::TestInput::run(), cass::ZMQInput::runthis(), cass::XFELOnlineInput::runthis(), cass::TCPInput::runthis(), cass::XFELHDF5FileInput::runthis(), cass::SACLAOnlineInput::runthis(), and cass::HDF5FileInput::runthis().
QMutex cass::InputBase::lock |
a mutex so that external program can lock access to this
Definition at line 106 of file input_base.h.
Referenced by cass::MultiFileInput::runthis().