areaDetector  3-5-0
EPICS areaDetector framework
NDPluginCircularBuff.h
Go to the documentation of this file.
1 #ifndef NDPluginCircularBuff_H
2 #define NDPluginCircularBuff_H
3 
4 #include <epicsTypes.h>
5 #include <postfix.h>
6 
7 #include "NDPluginDriver.h"
8 #include "NDArrayRing.h"
9 
10 /* Param definitions */
11 #define NDCircBuffControlString "CIRC_BUFF_CONTROL" /* (asynInt32, r/w) Run scope? */
12 #define NDCircBuffStatusString "CIRC_BUFF_STATUS" /* (asynOctetRead, r/o) Scope status */
13 #define NDCircBuffTriggerAString "CIRC_BUFF_TRIGGER_A" /* (asynOctetWrite, r/w) Trigger A attribute name */
14 #define NDCircBuffTriggerBString "CIRC_BUFF_TRIGGER_B" /* (asynOctetWrite, r/w) Trigger B attribute name */
15 #define NDCircBuffTriggerAValString "CIRC_BUFF_TRIGGER_A_VAL" /* (asynFloat64, r/o) Trigger A value */
16 #define NDCircBuffTriggerBValString "CIRC_BUFF_TRIGGER_B_VAL" /* (asynFloat64, r/o) Trigger B value */
17 #define NDCircBuffTriggerCalcString "CIRC_BUFF_TRIGGER_CALC" /* (asynOctetWrite, r/w) Trigger calculation expression */
18 #define NDCircBuffTriggerCalcValString "CIRC_BUFF_TRIGGER_CALC_VAL" /* (asynFloat64, r/o) Trigger calculation value */
19 #define NDCircBuffPresetTriggerCountString "CIRC_BUFF_PRESET_TRIGGER_COUNT" /* (asynInt32, r/w) Preset number of triggers 0=infinite*/
20 #define NDCircBuffActualTriggerCountString "CIRC_BUFF_ACTUAL_TRIGGER_COUNT" /* (asynInt32, r/w) Actual number of triggers so far */
21 #define NDCircBuffPreTriggerString "CIRC_BUFF_PRE_TRIGGER" /* (asynInt32, r/w) Number of pre-trigger images */
22 #define NDCircBuffPostTriggerString "CIRC_BUFF_POST_TRIGGER" /* (asynInt32, r/w) Number of post-trigger images */
23 #define NDCircBuffCurrentImageString "CIRC_BUFF_CURRENT_IMAGE" /* (asynInt32, r/o) Number of the current image */
24 #define NDCircBuffPostCountString "CIRC_BUFF_POST_COUNT" /* (asynInt32, r/o) Number of the current post count image */
25 #define NDCircBuffSoftTriggerString "CIRC_BUFF_SOFT_TRIGGER" /* (asynInt32, r/w) Force a soft trigger */
26 #define NDCircBuffTriggeredString "CIRC_BUFF_TRIGGERED" /* (asynInt32, r/o) Have we had a trigger event */
27 #define NDCircBuffFlushOnSoftTrigString "CIRC_BUFF_FLUSH_ON_SOFTTRIGGER" /* (asynInt32, r/w) Flush buffer immediatelly when software trigger obtained */
28 
29 
33 class epicsShareClass NDPluginCircularBuff : public NDPluginDriver {
34 public:
35  NDPluginCircularBuff(const char *portName, int queueSize, int blockingCallbacks,
36  const char *NDArrayPort, int NDArrayAddr,
37  int maxBuffers, size_t maxMemory,
38  int priority, int stackSize);
39  /* These methods override the virtual methods in the base class */
40  void processCallbacks(NDArray *pArray);
41  asynStatus writeInt32(asynUser *pasynUser, epicsInt32 value);
42  asynStatus writeOctet(asynUser *pasynUser, const char *value, size_t nChars, size_t *nActual);
43 
44  //template <typename epicsType> asynStatus doProcessCircularBuffT(NDArray *pArray);
45  //asynStatus doProcessCircularBuff(NDArray *pArray);
46 
47 protected:
49  #define FIRST_NDPLUGIN_CIRC_BUFF_PARAM NDCircBuffControl
50  /* Scope */
67 
68  void flushPreBuffer();
69 
70 private:
71 
72  asynStatus calculateTrigger(NDArray *pArray, int *trig);
73  NDArrayRing *preBuffer_;
74  NDArray *pOldArray_;
75  int previousTrigger_;
76  int maxBuffers_;
77  char triggerCalcInfix_[MAX_INFIX_SIZE];
78  char triggerCalcPostfix_[MAX_POSTFIX_SIZE];
79  double triggerCalcArgs_[CALCPERFORM_NARGS];
80 };
81 
82 #endif
83 
int NDCircBuffPresetTriggerCount
Definition: NDPluginCircularBuff.h:58
int NDCircBuffTriggered
Definition: NDPluginCircularBuff.h:65
Class from which actual plugin drivers are derived; derived from asynNDArrayDriver.
Definition: NDPluginDriver.h:56
int NDCircBuffCurrentImage
Definition: NDPluginCircularBuff.h:62
virtual asynStatus writeInt32(asynUser *pasynUser, epicsInt32 value)
Called when asyn clients call pasynInt32->write().
Definition: NDPluginDriver.cpp:684
int NDCircBuffControl
Definition: NDPluginCircularBuff.h:48
int NDCircBuffTriggerAVal
Definition: NDPluginCircularBuff.h:54
list value
Definition: makeDbAndEdl.py:234
int NDCircBuffPostCount
Definition: NDPluginCircularBuff.h:63
int NDCircBuffTriggerA
Definition: NDPluginCircularBuff.h:52
Definition: NDArrayRing.h:6
int NDCircBuffTriggerCalcVal
Definition: NDPluginCircularBuff.h:57
int NDCircBuffStatus
Definition: NDPluginCircularBuff.h:51
int NDCircBuffActualTriggerCount
Definition: NDPluginCircularBuff.h:59
int NDCircBuffPostTrigger
Definition: NDPluginCircularBuff.h:61
virtual void processCallbacks(NDArray *pArray)=0
int NDCircBuffTriggerB
Definition: NDPluginCircularBuff.h:53
int NDCircBuffTriggerCalc
Definition: NDPluginCircularBuff.h:56
int NDCircBuffPreTrigger
Definition: NDPluginCircularBuff.h:60
Performs a scope like capture.
Definition: NDPluginCircularBuff.h:33
N-dimensional array class; each array has a set of dimensions, a data type, pointer to data,...
Definition: NDArray.h:92
int NDCircBuffSoftTrigger
Definition: NDPluginCircularBuff.h:64
virtual asynStatus writeOctet(asynUser *pasynUser, const char *value, size_t maxChars, size_t *nActual)
Called when asyn clients call pasynOctet->write().
Definition: NDPluginDriver.cpp:810
int NDCircBuffTriggerBVal
Definition: NDPluginCircularBuff.h:55
int NDCircBuffFlushOnSoftTrig
Definition: NDPluginCircularBuff.h:66