areaDetector 3-14
EPICS areaDetector framework
streamApi.h
Go to the documentation of this file.
1#ifndef STREAM_API_H
2#define STREAM_API_H
3
4#include <stdlib.h>
5#include <stdint.h>
6#include <vector>
7#include <NDArray.h>
8#include <zmq.h>
9#include <stream2.h>
10
18
19typedef struct
20{
21 size_t series;
23
25{
26private:
27 char *mHostname;
28 void *mCtx, *mSock;
29 size_t mSeries;
30 size_t mFrame;
31
32 int poll (int timeout); // timeout in seconds
33
34public:
35 StreamAPI (const char *hostname);
36 ~StreamAPI (void);
37 int getHeader (stream_header_t *header, int timeout = 0);
38 int waitFrame (int *end, int timeout = 0);
39 int getFrame (NDArray **pArray, NDArrayPool *pNDArrayPool, int decompress);
40};
41
43{
44private:
45 char *mHostname;
46 void *mCtx, *mSock;
47 uint64_t mSeries_id;
48 char* mImage_dtype;
49 zmq_msg_t mMsg;
50 stream2_image_msg *mImageMsg;
51 uint64_t mImage_size_x;
52 uint64_t mImage_size_y;
53 uint64_t mNumber_of_images;
54 int mNumThresholds;
55 std::vector<stream2_threshold_energy> mThresholdEnergy;
56 struct {
57 std::string tsStr;
58 epicsTimeStamp ts;
59 } mCachedTs;
60
61 epicsTimeStamp extractTimeStampFromMessage(stream2_image_msg *message);
62 int poll (int timeout); // timeout in seconds
63
64public:
65 Stream2API (const char *hostname);
66 ~Stream2API (void);
67 int getHeader (stream_header_t *header, int timeout = 0);
68 int waitFrame (int *end, int *numThresholds, int timeout = 0);
69 int getFrame (NDArray **pArray, NDArrayPool *pNDArrayPool, int thresh, int decompress, bool extractTimeStamp);
70};
71
72
73#endif
N-dimensional array class; each array has a set of dimensions, a data type, pointer to data,...
Definition NDArray.h:99
The NDArrayPool class manages a free list (pool) of NDArray objects.
Definition NDArray.h:168
Definition streamApi.h:43
std::string tsStr
Definition streamApi.h:57
~Stream2API(void)
Definition stream2Api.cpp:153
int getFrame(NDArray **pArray, NDArrayPool *pNDArrayPool, int thresh, int decompress, bool extractTimeStamp)
Definition stream2Api.cpp:223
epicsTimeStamp ts
Definition streamApi.h:58
int getHeader(stream_header_t *header, int timeout=0)
Definition stream2Api.cpp:160
int waitFrame(int *end, int *numThresholds, int timeout=0)
Definition stream2Api.cpp:195
Definition streamApi.h:25
~StreamAPI(void)
Definition streamApi.cpp:186
int getFrame(NDArray **pArray, NDArrayPool *pNDArrayPool, int decompress)
Definition streamApi.cpp:300
int getHeader(stream_header_t *header, int timeout=0)
Definition streamApi.cpp:193
int waitFrame(int *end, int timeout=0)
Definition streamApi.cpp:252
stream_err
Definition streamApi.h:12
@ STREAM_SUCCESS
Definition streamApi.h:13
@ STREAM_ERROR
Definition streamApi.h:16
@ STREAM_TIMEOUT
Definition streamApi.h:14
@ STREAM_WRONG_HTYPE
Definition streamApi.h:15
Definition stream2.h:181
Definition streamApi.h:20
size_t series
Definition streamApi.h:21