areaDetector 3-14
EPICS areaDetector framework
NDPluginAttrPlot.h
Go to the documentation of this file.
1#ifndef NDATTRPLOT_H_
2#define NDATTRPLOT_H_
3
18#include "CircularBuffer.h"
19
20#include <NDPluginAPI.h>
21#include <NDPluginDriver.h>
22#include <epicsThread.h>
23
24#include <string>
25#include <vector>
26
27#define NDAttrPlotDataString "AP_Data"
28#define NDAttrPlotDataLabelString "AP_DataLabel"
29#define NDAttrPlotDataSelectString "AP_DataSelect"
30#define NDAttrPlotAttributeString "AP_Attribute"
31#define NDAttrPlotResetString "AP_Reset"
32#define NDAttrPlotNPtsString "AP_NPts"
33
34#define ND_ATTRPLOT_UID_INDEX -1
35#define ND_ATTRPLOT_UID_LABEL "UID"
36#define ND_ATTRPLOT_NONE_INDEX -2
37#define ND_ATTRPLOT_NONE_LABEL "None"
38
39#define ND_ATTRPLOT_DATA_EXPOSURE_PERIOD 1. // Data callback period in seconds
40
42
46class NDPLUGIN_API ExposeDataTask : public epicsThreadRunable
47{
48public:
55
59 void run();
60
64 void start();
65
69 void stop();
70
71private:
73 NDPluginAttrPlot& plugin_;
74
76 bool stop_;
77
79 epicsThread thread_;
80};
81
95{
97
98public:
113 NDPluginAttrPlot(const char * port, int max_attributes, int cache_size,
114 int max_selected, const char * in_port, int in_addr, int queue_size,
115 int blocking_callbacks, int priority, int stackSize);
116
120 void start_expose();
121
122 friend class ExposeDataTask;
123
124public:
133 void processCallbacks(NDArray * pArray);
134
141 asynStatus writeInt32(asynUser * pasynUser, epicsInt32 value);
142
143protected:
145#define NDATTRPLOT_FIRST_PARAM NDAttrPlotData
151
152private:
156 enum NDAttrPlotState {
157 NDAttrPlot_InitState,
158 NDAttrPlot_ActiveState
159 };
160
173 void rebuild_attributes(NDAttributeList& attr_list);
174
178 void reset_data();
179
185 asynStatus push_data(epicsInt32 uid, NDAttributeList& attr_list);
186
190 void callback_data();
191
195 void callback_attributes();
196
200 void callback_selected();
201
202private:
204 NDAttrPlotState state_;
205
207 std::vector<CB> data_;
208
210 CB uids_;
211
213 const size_t n_attributes_;
214
216 std::vector<std::string> attributes_;
217
218 const unsigned n_data_blocks_;
219 std::vector<int> data_selections_;
220
222 ExposeDataTask expose_task_;
223};
224
225#endif // NDATTRPLOT_H_
226
#define NDPLUGIN_API
Definition NDPluginAPI.h:41
NDPluginAttrPlot * plugin
Definition NDPluginAttrPlot.cpp:300
Definition CircularBuffer.h:8
A task that periodically executes the data exposure method of the plugin.
Definition NDPluginAttrPlot.h:47
N-dimensional array class; each array has a set of dimensions, a data type, pointer to data,...
Definition NDArray.h:99
NDAttributeList.h.
Definition NDAttributeList.h:21
AD plugin that saves attribute values from recieved NDArrays.
Definition NDPluginAttrPlot.h:95
int NDAttrPlotDataSelect
Definition NDPluginAttrPlot.h:147
int NDAttrPlotReset
Definition NDPluginAttrPlot.h:149
int NDAttrPlotDataLabel
Definition NDPluginAttrPlot.h:146
int NDAttrPlotData
Definition NDPluginAttrPlot.h:144
int NDAttrPlotAttribute
Definition NDPluginAttrPlot.h:148
int NDAttrPlotNPts
Definition NDPluginAttrPlot.h:150
Class from which actual plugin drivers are derived; derived from asynNDArrayDriver.
Definition NDPluginDriver.h:57