Transient Recorder Framework
|
Class for submitting burst data. More...
#include <TRChannelDataSubmit.h>
Public Member Functions | |
TRChannelDataSubmit () | |
Constructor for the data-submit object. More... | |
~TRChannelDataSubmit () | |
Destructor for the data-submit object. More... | |
bool | allocateArray (TRBaseDriver &driver, int channel_num, NDDataType_t data_type, int num_samples) |
Set parameters for the array and allocate the NDArray. More... | |
void | releaseArray () |
Release any array. More... | |
void * | data () |
Returns the data pointer of the array. More... | |
void | submit (TRBaseDriver &driver, int channel, int unique_id, double timestamp, epicsTimeStamp epics_ts, TRArrayCompletionCallback *compl_cb) |
Submit the array to AreaDetector. More... | |
Class for submitting burst data.
This object does not have any protection from concurrent use. It is intended to be used within a function on the same thread. Multi-threaded use is possible but external locking is needed in that case.
|
inline |
Constructor for the data-submit object.
The constructor does not have any parameters and allocateArray should be used to allocate the array with the right settings. This allows making an array of these objects.
This class has two major states: without-array (default) and with-array (after a successful allocateArray).
|
inline |
Destructor for the data-submit object.
It ensures that any array is released at destruction.
bool TRChannelDataSubmit::allocateArray | ( | TRBaseDriver & | driver, |
int | channel_num, | ||
NDDataType_t | data_type, | ||
int | num_samples | ||
) |
Set parameters for the array and allocate the NDArray.
This may only be called in the without-array state. Upon success, the state changes to with-array.
This function MUST be called with the base and channels drivers unlocked.
driver | The TRBaseDriver to which the data would be submitted. |
channel_num | Channel number for data. Must be a valid channel number for the TRBaseDriver. |
data_type | The AreaDetector data type for the array. |
num_samples | Number of samples for the burst. |
|
inline |
Release any array.
After this the state is witout-array.
|
inline |
Returns the data pointer of the array.
This will return NULL if the state is without-array. It is important that the caller checks for NULL before writing data. To write the data, this pointer should be cast to the pointer to type corresponding to the data type of the array as allocated.
This function is not maximally efficient. Avoid calling this in a tight loop and cache the pointer instead.
void TRChannelDataSubmit::submit | ( | TRBaseDriver & | driver, |
int | channel, | ||
int | unique_id, | ||
double | timestamp, | ||
epicsTimeStamp | epics_ts, | ||
TRArrayCompletionCallback * | compl_cb | ||
) |
Submit the array to AreaDetector.
It is acceptable to call this in the without-array state, notably after a failed allocateArray. After this, the state is without-array (submitting an array implies relasing it).
If called in the with-array state, the driver and channel arguments must be the same as was used in the allocateArray call when the array was allocated.
This function will discard the data if disarming has already been initiated.
This function MUST be called with the base and channels drivers unlocked.
driver | The TRBaseDriver as was passed to allocateArray. |
channel | The channel number as was passed to allocateArray. |
unique_id | The unique_id for the NDArray. |
timestamp | The timestamp for the NDArray. |
epics_ts | The epicsTimeStamp for the NDArray. |
compl_cb | Optional callback to be called just before submitting the NDArray, after meta-information including timestamps and attributes have been set. This allows overriding any information in the array and adding additional attributes. It is called with the channels port (TRChannelsDriver) locked. This callbacks also allows inhibiting array submission. |