areaDetector  3-13
EPICS areaDetector framework
NDDriverStdArrays.h
Go to the documentation of this file.
1 /* NDDriverStdArrays.h
2  *
3  * This is a driver for converting standard EPICS arrays (waveform records)
4  * into NDArrays.
5  *
6  * It allows any Channel Access client to inject NDArrays into an areaDetector IOC.
7  *
8  * Mark Rivers
9  * University of Chicago
10  *
11  * Created: November 8, 2016
12  *
13  */
14 
15 
16 #include "ADDriver.h"
17 
18 #define DRIVER_VERSION 1
19 #define DRIVER_REVISION 3
20 #define DRIVER_MODIFICATION 0
21 
22 typedef enum {
27 
28 class epicsShareClass NDDriverStdArrays : public ADDriver {
29 public:
30  NDDriverStdArrays(const char *portName,
31  int maxBuffers, size_t maxMemory,
32  int priority, int stackSize);
33 
34  virtual asynStatus writeInt8Array (asynUser *pasynUser, epicsInt8 *value, size_t nElements);
35  virtual asynStatus writeInt16Array(asynUser *pasynUser, epicsInt16 *value, size_t nElements);
36  virtual asynStatus writeInt32Array(asynUser *pasynUser, epicsInt32 *value, size_t nElements);
37  virtual asynStatus writeFloat32Array(asynUser *pasynUser, epicsFloat32 *value, size_t nElements);
38  virtual asynStatus writeFloat64Array(asynUser *pasynUser, epicsFloat64 *value, size_t nElements);
39  virtual asynStatus writeInt32(asynUser *pasynUser, epicsInt32 value);
40  virtual void report (FILE *fp, int details);
41 
42 protected:
44 #define FIRST_NDSA_DRIVER_PARAM NDSA_CallbackMode_
54 #define LAST_NDSA_DRIVER_PARAM NDSA_ArrayData_
55 
56 private:
57  template <typename epicsType> asynStatus writeXXXArray(asynUser *pasynUser, void *pValue, size_t nElements);
58  template <typename epicsType, typename NDArrayType> void copyBuffer(size_t nextElement, size_t stride, void *pValue, size_t nElements);
59  template <typename NDArrayType> void fillBuffer(double fillValueDouble);
60  void doCallbacks();
61  void setArrayComplete();
62  size_t arrayDimensions_[ND_ARRAY_MAX_DIMS];
63  NDArrayInfo arrayInfo_;
64  size_t dimProd_[ND_ARRAY_MAX_DIMS];
65 };
66 
67 #define NDSA_CallbackModeString "NDSA_CALLBACK_MODE" /* (asynInt32, r/w) Every update, when complete */
68 #define NDSA_DoCallbacksString "NDSA_DO_CALLBACKS" /* (asynInt32, r/w) Force callbacks */
69 #define NDSA_AppendModeString "NDSA_APPEND_MODE" /* (asynInt32, r/w) Enable or disable */
70 #define NDSA_NumElementsString "NDSA_NUM_ELEMENTS" /* (asynInt32, r/o) Number of elements currently in array */
71 #define NDSA_NextElementString "NDSA_NEXT_ELEMENT" /* (asynInt32, r/w) Next element to write to in array */
72 #define NDSA_StrideString "NDSA_STRIDE" /* (asynInt32, r/w) Stride between elements in array */
73 #define NDSA_FillValueString "NDSA_FILL_VALUE" /* (asynFloat64, r/w) Fill value in append mode */
74 #define NDSA_NewArrayString "NDSA_NEW_ARRAY" /* (asynInt32, r/o) Start a new array in append mode */
75 #define NDSA_ArrayCompleteString "NDSA_ARRAY_COMPLETE" /* (asynInt32, r/o) Array is complete in append mode */
76 #define NDSA_ArrayDataString "NDSA_ARRAY_DATA" /* (asynXXXArray, r/o) Array data */
77 
78 #define NUM_NDSA_DRIVER_PARAMS ((int)(&LAST_NDSA_DRIVER_PARAM - &FIRST_NDSA_DRIVER_PARAM + 1))
#define ND_ARRAY_MAX_DIMS
NDArray.h.
Definition: NDArray.h:26
NDSA_CallbackMode_t
Definition: NDDriverStdArrays.h:22
@ NDSA_OnComplete
Definition: NDDriverStdArrays.h:24
@ NDSA_OnCommand
Definition: NDDriverStdArrays.h:25
@ NDSA_OnUpdate
Definition: NDDriverStdArrays.h:23
Class from which areaDetector drivers are directly derived.
Definition: ADDriver.h:132
virtual asynStatus writeInt32(asynUser *pasynUser, epicsInt32 value)
Sets an int32 parameter.
Definition: ADDriver.cpp:84
Definition: NDDriverStdArrays.h:28
int NDSA_NumElements_
Definition: NDDriverStdArrays.h:47
int NDSA_ArrayData_
Definition: NDDriverStdArrays.h:53
int NDSA_AppendMode_
Definition: NDDriverStdArrays.h:46
int NDSA_ArrayComplete_
Definition: NDDriverStdArrays.h:52
int NDSA_Stride_
Definition: NDDriverStdArrays.h:49
int NDSA_CallbackMode_
Definition: NDDriverStdArrays.h:43
int NDSA_NewArray_
Definition: NDDriverStdArrays.h:51
int NDSA_NextElement_
Definition: NDDriverStdArrays.h:48
int NDSA_DoCallbacks_
Definition: NDDriverStdArrays.h:45
int NDSA_FillValue_
Definition: NDDriverStdArrays.h:50
virtual void report(FILE *fp, int details)
Report status of the driver.
Definition: asynNDArrayDriver.cpp:753
list value
Definition: makeDbAndEdl.py:234
Structure returned by NDArray::getInfo.
Definition: NDArray.h:78