quadEM  7-0
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 <string>
34 #include <list>
35 #include <map>
36 
37 #include "NDPluginDriver.h"
38 
39 #define str_NDPos_Filename "NDPos_Filename"
40 #define str_NDPos_FileValid "NDPos_FileValid"
41 #define str_NDPos_Clear "NDPos_Clear"
42 #define str_NDPos_Running "NDPos_Running"
43 #define str_NDPos_Restart "NDPos_Restart"
44 #define str_NDPos_Delete "NDPos_Delete"
45 #define str_NDPos_Mode "NDPos_Mode"
46 #define str_NDPos_Append "NDPos_Append"
47 #define str_NDPos_CurrentQty "NDPos_CurrentQty"
48 #define str_NDPos_CurrentIndex "NDPos_CurrentIndex"
49 #define str_NDPos_CurrentPos "NDPos_CurrentPos"
50 #define str_NDPos_MissingFrames "NDPos_MissingFrames"
51 #define str_NDPos_DuplicateFrames "NDPos_DuplicateFrames"
52 #define str_NDPos_ExpectedID "NDPos_ExpectedID"
53 #define str_NDPos_IDName "NDPos_IDName"
54 #define str_NDPos_IDDifference "NDPos_IDDifference"
55 #define str_NDPos_IDStart "NDPos_IDStart"
56 
57 #define MODE_DISCARD 0
58 #define MODE_KEEP 1
59 
60 #define NDPOS_IDLE 0
61 #define NDPOS_RUNNING 1
62 
64 {
65 
66 public:
67  NDPosPlugin(const char *portName, // The name of the asyn port driver to be created.
68  int queueSize, // The number of NDArrays that the input queue for this plugin can hold.
69  int blockingCallbacks, // Initial setting for the NDPluginDriverBlockingCallbacks flag.
70  const char *NDArrayPort, // Name of asyn port driver for initial source of NDArray callbacks.
71  int NDArrayAddr, // asyn port driver address for initial source of NDArray callbacks.
72  int maxBuffers, // The maximum number of buffers that this driver can allocate.
73  size_t maxMemory, // The maximum amount of memory that this driver can allocate.
74  int priority, // The thread priority for the asyn port driver thread.
75  int stackSize); // The stack size for the asyn port driver thread.
76  virtual ~NDPosPlugin();
77  // These methods override the virtual methods in the base class
78  void processCallbacks(NDArray *pArray);
79  asynStatus writeInt32(asynUser *pasynUser, epicsInt32 value);
80  asynStatus writeOctet(asynUser *pasynUser, const char *value, size_t nChars, size_t *nActual);
81 
82 protected:
83  // plugin parameters
85  #define FIRST_NDPOS_PARAM NDPos_Filename
102 
103 private:
104  // Plugin member variables
105  std::list<std::map<std::string, double> > positionArray;
106 };
107 
108 #endif /* NDPosPluginAPP_SRC_NDPOSPLUGIN_H_ */
Class from which actual plugin drivers are derived; derived from asynNDArrayDriver.
Definition: NDPluginDriver.h:58
virtual asynStatus writeInt32(asynUser *pasynUser, epicsInt32 value)
Called when asyn clients call pasynInt32-&gt;write().
Definition: NDPluginDriver.cpp:678
int NDPos_CurrentIndex
Definition: NDPosPlugin.h:94
int NDPos_Append
Definition: NDPosPlugin.h:92
int NDPos_DuplicateFrames
Definition: NDPosPlugin.h:96
int NDPos_IDStart
Definition: NDPosPlugin.h:101
int NDPos_Filename
Definition: NDPosPlugin.h:84
int NDPos_IDDifference
Definition: NDPosPlugin.h:100
int NDPos_Clear
Definition: NDPosPlugin.h:87
int NDPos_Restart
Definition: NDPosPlugin.h:89
int NDPos_ExpectedID
Definition: NDPosPlugin.h:98
int NDPos_IDName
Definition: NDPosPlugin.h:99
int NDPos_Mode
Definition: NDPosPlugin.h:91
int NDPos_Delete
Definition: NDPosPlugin.h:90
virtual void processCallbacks(NDArray *pArray)=0
#define NDPLUGIN_API
Definition: NDPluginAPI.h:41
int NDPos_FileValid
Definition: NDPosPlugin.h:86
int NDPos_MissingFrames
Definition: NDPosPlugin.h:97
int NDPos_CurrentQty
Definition: NDPosPlugin.h:93
int NDPos_Running
Definition: NDPosPlugin.h:88
N-dimensional array class; each array has a set of dimensions, a data type, pointer to data...
Definition: NDArray.h:93
virtual asynStatus writeOctet(asynUser *pasynUser, const char *value, size_t maxChars, size_t *nActual)
Called when asyn clients call pasynOctet-&gt;write().
Definition: NDPluginDriver.cpp:804
Definition: NDPosPlugin.h:63
int NDPos_CurrentPos
Definition: NDPosPlugin.h:95