areaDetector  3-14
EPICS areaDetector framework
ntndArrayConverter.h
Go to the documentation of this file.
1 #include <math.h>
2 
4 #include <NDArray.h>
5 #include <pv/ntndarray.h>
6 
7 typedef struct NTNDArrayInfo
8 {
9  int ndims;
16 
17  struct
18  {
19  int dim;
20  size_t size, stride;
21  }x, y, color;
23 
25 {
26 public:
27  NTNDArrayConverter(epics::nt::NTNDArrayPtr array);
28 
29  NTNDArrayInfo_t getInfo (void);
30  void toArray (NDArray *dest);
31  void fromArray (NDArray *src);
32 
33 private:
34  epics::nt::NTNDArrayPtr m_array;
35 
36  epics::pvData::ScalarType getValueType (void);
37  NDColorMode_t getColorMode (void);
38 
39  template <typename arrayType>
40  void toValue (NDArray *dest);
41  void toValue (NDArray *dest);
42 
43  void toDimensions (NDArray *dest);
44  void toTimeStamp (NDArray *dest);
45  void toDataTimeStamp (NDArray *dest);
46 
47  template <typename pvAttrType, typename valueType>
48  void toAttribute (NDArray *dest, epics::pvData::PVStructurePtr src);
49  void toStringAttribute (NDArray *dest, epics::pvData::PVStructurePtr src);
50  void toUndefinedAttribute (NDArray *dest, epics::pvData::PVStructurePtr src);
51  void toAttributes (NDArray *dest);
52 
53  template <typename arrayType, typename srcDataType>
54  void fromValue (NDArray *src);
55  void fromValue (NDArray *src);
56 
57  void fromDimensions (NDArray *src);
58  void fromTimeStamp (NDArray *src);
59  void fromDataTimeStamp (NDArray *src);
60 
61  template <typename pvAttrType, typename valueType>
62  void fromAttribute (epics::pvData::PVStructurePtr dest, NDAttribute *src);
63  void fromStringAttribute (epics::pvData::PVStructurePtr dest, NDAttribute *src);
64  void fromUndefinedAttribute (epics::pvData::PVStructurePtr dest);
65  void fromAttributes (NDArray *src);
66 };
67 
68 typedef std::tr1::shared_ptr<NTNDArrayConverter> NTNDArrayConverterPtr;
NDColorMode_t
Enumeration of color modes for NDArray attribute "colorMode".
Definition: NDArray.h:35
#define ND_ARRAY_MAX_DIMS
NDArray.h.
Definition: NDArray.h:26
NDDataType_t
Enumeration of NDArray data types.
Definition: NDAttribute.h:30
N-dimensional array class; each array has a set of dimensions, a data type, pointer to data,...
Definition: NDArray.h:99
NDAttribute class; an attribute has a name, description, source type, source string,...
Definition: NDAttribute.h:96
Definition: ntndArrayConverter.h:25
@ string
Definition: NDFileHDF5Layout.h:44
std::tr1::shared_ptr< NTNDArrayConverter > NTNDArrayConverterPtr
Definition: ntndArrayConverter.h:68
struct NTNDArrayInfo NTNDArrayInfo_t
#define NTNDARRAYCONVERTER_API
Definition: ntndArrayConverterAPI.h:25
Definition: ntndArrayConverter.h:8
int dim
Definition: ntndArrayConverter.h:19
struct NTNDArrayInfo::@1 y
size_t totalBytes
Definition: ntndArrayConverter.h:11
size_t stride
Definition: ntndArrayConverter.h:20
struct NTNDArrayInfo::@1 color
int ndims
Definition: ntndArrayConverter.h:9
size_t size
Definition: ntndArrayConverter.h:20
NDColorMode_t colorMode
Definition: ntndArrayConverter.h:13
NDDataType_t dataType
Definition: ntndArrayConverter.h:14
size_t nElements
Definition: ntndArrayConverter.h:11
size_t dims[ND_ARRAY_MAX_DIMS]
Definition: ntndArrayConverter.h:10
std::string codec
Definition: ntndArrayConverter.h:15
struct NTNDArrayInfo::@1 x
int bytesPerElement
Definition: ntndArrayConverter.h:12