areaDetector  3-13
EPICS areaDetector framework
NDFileNexus.h
Go to the documentation of this file.
1 /*
2  * NDFileTIFF.h
3  * Writes NDArrays to NeXus (HDF) files.
4  * John Hammonds
5  * April 17, 2009
6  */
7 
8 #ifndef DRV_NDFileNexus_H
9 #define DRV_NDFileNexus_H
10 
11 #include "NDPluginFile.h"
12 #include <napi.h>
13 #include <libxml/parser.h>
14 
15 /* This version number is an attribute in the Nexus file to allow readers
16  * to handle changes in the file contents */
17 #define NDNexusFileVersion 1.0
18 
19 
20 #define NDFileNexusTemplatePathString "TEMPLATE_FILE_PATH"
21 #define NDFileNexusTemplateFileString "TEMPLATE_FILE_NAME"
22 #define NDFileNexusTemplateValidString "TEMPLATE_FILE_VALID"
23 #define NUM_ND_FILE_NEXUS_PARAMS (sizeof(NDFileNexusParamString)/sizeof(NDFileNexusParamString[0]))
24 
32 public:
33  NDFileNexus(const char *portName, int queueSize, int blockingCallbacks,
34  const char *NDArrayPort, int NDArrayAddr,
35  int priority, int stackSize);
36 
37  /* The methods that this class implements */
38  virtual asynStatus openFile(const char *fileName, NDFileOpenMode_t openMode, NDArray *pArray);
39  virtual asynStatus readFile(NDArray **pArray);
40  virtual asynStatus writeFile(NDArray *pArray);
41  virtual asynStatus closeFile();
42  asynStatus writeOctet(asynUser *pasynUser, const char *value,
43  size_t nChars, size_t *nActual);
44 protected:
46  #define FIRST_NDFILE_NEXUS_PARAM NDFileNexusTemplatePath
49 
50 private:
51  NXhandle nxFileHandle;
52  xmlDoc *configDoc;
53  xmlNodePtr rootNode;
54  NDAttributeList *pFileAttributes;
55  NXname dataPath;
56  NXname dataName;
57  int imageNumber;
58 
59  int processNode(xmlNode *curNode, NDArray *);
60  int processStreamData(NDArray *);
61  void getAttrTypeNSize(NDAttribute *pAttr, int *retType, int *retSize);
62  void iterateNodes(xmlNode *curNode, NDArray *pArray);
63  void findConstText(xmlNode *curNode, char *outtext);
64  void * allocConstValue(int dataType, size_t length);
65  void constTextToDataType(char *inText, int dataType, void *pValue);
66  int typeStringToVal( const char * typeStr );
67  void loadTemplateFile();
68 
69 };
70 
71 #endif
72 
NDDataType_t dataType
Definition: ADPylon.cpp:60
#define NDPLUGIN_API
Definition: NDPluginAPI.h:41
int NDFileOpenMode_t
Definition: NDPluginFile.h:17
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
NDAttributeList.h.
Definition: NDAttributeList.h:21
Writes NDArrays in the NeXus file format.
Definition: NDFileNexus.h:31
int NDFileNexusTemplateFile
Definition: NDFileNexus.h:47
int NDFileNexusTemplatePath
Definition: NDFileNexus.h:45
int NDFileNexusTemplateValid
Definition: NDFileNexus.h:48
virtual asynStatus writeOctet(asynUser *pasynUser, const char *value, size_t maxChars, size_t *nActual)
Called when asyn clients call pasynOctet->write().
Definition: NDPluginDriver.cpp:804
Base class for NDArray file writing plugins; actual file writing plugins inherit from this class.
Definition: NDPluginFile.h:28
virtual asynStatus readFile(NDArray **pArray)=0
Read NDArray data from a file; pure virtual function that must be implemented by derived classes.
virtual asynStatus closeFile()=0
Close the file opened with NDPluginFile::openFile; pure virtual function that must be implemented by ...
virtual asynStatus openFile(const char *fileName, NDFileOpenMode_t openMode, NDArray *pArray)=0
Open a file; pure virtual function that must be implemented by derived classes.
virtual asynStatus writeFile(NDArray *pArray)=0
Write NDArray data to a file; pure virtual function that must be implemented by derived classes.
list value
Definition: makeDbAndEdl.py:234