areaDetector  3-5-0
EPICS areaDetector framework
NDPosPlugin.h
Go to the documentation of this file.
1 /*
2  * NDPosPlugin.h
3  *
4  * Created on: 19 May 2015
5  * Author: gnx91527
6  *
7  * Use this plugin to attach positional data to NDArrays
8  * as they pass through. The positional data is appended
9  * as a 1D integer valued attribute [x] or [x,y] etc.
10  *
11  * The following parameters are used to interact with this plugin:
12  *
13  * NDPos_Filename - Filename to load positional data from
14  * NDPos_FileValid - Is the currently selected filename a valid location
15  * NDPos_Load - Load the filename specified above
16  * NDPos_Clear - Clear the current positional data store
17  * NDPos_NameIndex1 - Name of attribute for first index to add to the NDArray
18  * NDPos_NameIndex2 - Name of attribute for second index to add to the NDArray
19  * NDPos_NameIndex3 - Name of attribute for third index to add to the NDArray
20  * NDPos_Running - Used to turn on/off the position attaching
21  * NDPos_Restart - Restart appending from the beginning of the store
22  * NDPos_Mode - [0 - Discard] positions after use (for rolling buffer)
23  * - [1 - Keep] positions in store
24  * NDPos_Append - Add a single position to the end of the store
25  * NDPos_CurrentQty - Number of loaded positions in the store
26  * NDPos_CurrentIndex - Current index of position in store (0 if Discard mode)
27  * NDPos_CurrentPos - Value of the next position to attach to the NDArray
28  */
29 
30 #ifndef NDPosPluginAPP_SRC_NDPosPlugin_H_
31 #define NDPosPluginAPP_SRC_NDPOSPLUGIN_H_
32 
33 #include <epicsTypes.h>
34 #include <string>
35 #include <list>
36 #include <map>
37 
38 #include "NDPluginDriver.h"
39 
40 #define str_NDPos_Filename "NDPos_Filename"
41 #define str_NDPos_FileValid "NDPos_FileValid"
42 #define str_NDPos_Clear "NDPos_Clear"
43 #define str_NDPos_Running "NDPos_Running"
44 #define str_NDPos_Restart "NDPos_Restart"
45 #define str_NDPos_Delete "NDPos_Delete"
46 #define str_NDPos_Mode "NDPos_Mode"
47 #define str_NDPos_Append "NDPos_Append"
48 #define str_NDPos_CurrentQty "NDPos_CurrentQty"
49 #define str_NDPos_CurrentIndex "NDPos_CurrentIndex"
50 #define str_NDPos_CurrentPos "NDPos_CurrentPos"
51 #define str_NDPos_MissingFrames "NDPos_MissingFrames"
52 #define str_NDPos_DuplicateFrames "NDPos_DuplicateFrames"
53 #define str_NDPos_ExpectedID "NDPos_ExpectedID"
54 #define str_NDPos_IDName "NDPos_IDName"
55 #define str_NDPos_IDDifference "NDPos_IDDifference"
56 #define str_NDPos_IDStart "NDPos_IDStart"
57 
58 #define MODE_DISCARD 0
59 #define MODE_KEEP 1
60 
61 #define NDPOS_IDLE 0
62 #define NDPOS_RUNNING 1
63 
65 {
66 
67 public:
68  NDPosPlugin(const char *portName, // The name of the asyn port driver to be created.
69  int queueSize, // The number of NDArrays that the input queue for this plugin can hold.
70  int blockingCallbacks, // Initial setting for the NDPluginDriverBlockingCallbacks flag.
71  const char *NDArrayPort, // Name of asyn port driver for initial source of NDArray callbacks.
72  int NDArrayAddr, // asyn port driver address for initial source of NDArray callbacks.
73  int maxBuffers, // The maximum number of buffers that this driver can allocate.
74  size_t maxMemory, // The maximum amount of memory that this driver can allocate.
75  int priority, // The thread priority for the asyn port driver thread.
76  int stackSize); // The stack size for the asyn port driver thread.
77  virtual ~NDPosPlugin();
78  // These methods override the virtual methods in the base class
79  void processCallbacks(NDArray *pArray);
80  asynStatus writeInt32(asynUser *pasynUser, epicsInt32 value);
81  asynStatus writeOctet(asynUser *pasynUser, const char *value, size_t nChars, size_t *nActual);
82 
83 protected:
84  // plugin parameters
86  #define FIRST_NDPOS_PARAM NDPos_Filename
103 
104 private:
105  // Plugin member variables
106  std::list<std::map<std::string, double> > positionArray;
107 };
108 
109 #endif /* NDPosPluginAPP_SRC_NDPOSPLUGIN_H_ */
Class from which actual plugin drivers are derived; derived from asynNDArrayDriver.
Definition: NDPluginDriver.h:56
void processCallbacks(NDArray *pArray)
Callback function that is called by the NDArray driver with new NDArray data.
Definition: NDPosPlugin.cpp:36
int NDPos_CurrentIndex
Definition: NDPosPlugin.h:95
asynStatus writeOctet(asynUser *pasynUser, const char *value, size_t nChars, size_t *nActual)
Called when asyn clients call pasynOctet->write().
Definition: NDPosPlugin.cpp:289
int NDPos_Append
Definition: NDPosPlugin.h:93
int NDPos_DuplicateFrames
Definition: NDPosPlugin.h:97
int NDPos_IDStart
Definition: NDPosPlugin.h:102
int NDPos_Filename
Definition: NDPosPlugin.h:85
list value
Definition: makeDbAndEdl.py:234
int NDPos_IDDifference
Definition: NDPosPlugin.h:101
int NDPos_Clear
Definition: NDPosPlugin.h:88
NDPosPlugin(const char *portName, int queueSize, int blockingCallbacks, const char *NDArrayPort, int NDArrayAddr, int maxBuffers, size_t maxMemory, int priority, int stackSize)
Constructor for the NDPosPlugin class.
Definition: NDPosPlugin.cpp:361
char * portName
The name of this asyn port.
Definition: asynPortDriver.h:179
asynStatus writeInt32(asynUser *pasynUser, epicsInt32 value)
Sets an int32 parameter.
Definition: NDPosPlugin.cpp:220
int NDPos_Restart
Definition: NDPosPlugin.h:90
int NDPos_ExpectedID
Definition: NDPosPlugin.h:99
virtual ~NDPosPlugin()
Definition: NDPosPlugin.cpp:439
int NDPos_IDName
Definition: NDPosPlugin.h:100
int NDPos_Mode
Definition: NDPosPlugin.h:92
int NDPos_Delete
Definition: NDPosPlugin.h:91
int NDPos_FileValid
Definition: NDPosPlugin.h:87
int NDPos_MissingFrames
Definition: NDPosPlugin.h:98
int NDPos_CurrentQty
Definition: NDPosPlugin.h:94
int NDPos_Running
Definition: NDPosPlugin.h:89
N-dimensional array class; each array has a set of dimensions, a data type, pointer to data,...
Definition: NDArray.h:92
Definition: NDPosPlugin.h:64
int NDPos_CurrentPos
Definition: NDPosPlugin.h:96