areaDetector  3-5-0
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 
31 class epicsShareClass NDFileNexus : public NDPluginFile {
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  int bitsPerSample;
53  NDColorMode_t colorMode;
54  xmlDoc *configDoc;
55  xmlNodePtr rootNode;
56  NDAttributeList *pFileAttributes;
57  NXname dataPath;
58  NXname dataName;
59  int imageNumber;
60 
61  int processNode(xmlNode *curNode, NDArray *);
62  int processStreamData(NDArray *);
63  void getAttrTypeNSize(NDAttribute *pAttr, int *retType, int *retSize);
64  void iterateNodes(xmlNode *curNode, NDArray *pArray);
65  void findConstText(xmlNode *curNode, char *outtext);
66  void * allocConstValue(int dataType, size_t length);
67  void constTextToDataType(char *inText, int dataType, void *pValue);
68  int typeStringToVal( const char * typeStr );
69  void loadTemplateFile();
70 
71 };
72 
73 #endif
74 
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
NDAttributeList.h.
Definition: NDAttributeList.h:21
virtual asynStatus readFile(NDArray **pArray)=0
Read NDArray data from a file; pure virtual function that must be implemented by derived classes.
NDColorMode_t
Enumeration of color modes for NDArray attribute "colorMode".
Definition: NDArray.h:28
int NDFileNexusTemplatePath
Definition: NDFileNexus.h:45
Writes NDArrays in the NeXus file format.
Definition: NDFileNexus.h:31
int NDFileNexusTemplateFile
Definition: NDFileNexus.h:47
NDAttribute class; an attribute has a name, description, source type, source string,...
Definition: NDAttribute.h:87
N-dimensional array class; each array has a set of dimensions, a data type, pointer to data,...
Definition: NDArray.h:92
int NDFileOpenMode_t
Definition: NDPluginFile.h:17
virtual asynStatus writeOctet(asynUser *pasynUser, const char *value, size_t maxChars, size_t *nActual)
Called when asyn clients call pasynOctet->write().
Definition: NDPluginDriver.cpp:810
Base class for NDArray file writing plugins; actual file writing plugins inherit from this class.
Definition: NDPluginFile.h:28
int NDFileNexusTemplateValid
Definition: NDFileNexus.h:48