#include <NDPluginFile.h>
Public Member Functions | |
NDPluginFile (const char *portName, int queueSize, int blockingCallbacks, const char *NDArrayPort, int NDArrayAddr, int maxAddr, int paramTableSize, int maxBuffers, size_t maxMemory, int interfaceMask, int interruptMask, int asynFlags, int autoConnect, int priority, int stackSize) | |
Constructor for NDPluginFile; all parameters are simply passed to NDPluginDriver::NDPluginDriver. | |
virtual void | processCallbacks (NDArray *pArray) |
Callback function that is called by the NDArray driver with new NDArray data. | |
virtual asynStatus | writeInt32 (asynUser *pasynUser, epicsInt32 value) |
Called when asyn clients call pasynInt32->write(). | |
virtual asynStatus | writeNDArray (asynUser *pasynUser, void *genericPointer) |
virtual asynStatus | drvUserCreate (asynUser *pasynUser, const char *drvInfo, const char **pptypeName, size_t *psize) |
Sets pasynUser->reason to one of the enum values for the parameters defined for the NDPluginFile class if the drvInfo field matches one the strings defined for it. | |
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 | readFile (NDArray **pArray)=0 |
Read NDArray data from 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. | |
virtual asynStatus | closeFile ()=0 |
Close the file opened with NDPluginFile::openFile; pure virtual function that must be implemented by derived classes. | |
Public Attributes | |
int | supportsMultipleArrays |
Derived classes must set this flag to 0/1 if they cannot/can write multiple NDArrays to a single file. |
This class handles the logic of single file per image, capture into buffer or streaming multiple images to a single file. Derived classes must implement the 4 pure virtual functions: openFile, readFile, writeFile and closeFile.
NDPluginFile::NDPluginFile | ( | const char * | portName, | |
int | queueSize, | |||
int | blockingCallbacks, | |||
const char * | NDArrayPort, | |||
int | NDArrayAddr, | |||
int | maxAddr, | |||
int | paramTableSize, | |||
int | maxBuffers, | |||
size_t | maxMemory, | |||
int | interfaceMask, | |||
int | interruptMask, | |||
int | asynFlags, | |||
int | autoConnect, | |||
int | priority, | |||
int | stackSize | |||
) |
Constructor for NDPluginFile; all parameters are simply passed to NDPluginDriver::NDPluginDriver.
[in] | portName | The name of the asyn port driver to be created. |
[in] | queueSize | The number of NDArrays that the input queue for this plugin can hold when NDPluginDriverBlockingCallbacks=0. Larger queues can decrease the number of dropped arrays, at the expense of more NDArray buffers being allocated from the underlying driver's NDArrayPool. |
[in] | blockingCallbacks | Initial setting for the NDPluginDriverBlockingCallbacks flag. 0=callbacks are queued and executed by the callback thread; 1 callbacks execute in the thread of the driver doing the callbacks. |
[in] | NDArrayPort | Name of asyn port driver for initial source of NDArray callbacks. |
[in] | NDArrayAddr | asyn port driver address for initial source of NDArray callbacks. |
[in] | maxAddr | The maximum number of asyn addr addresses this driver supports. 1 is minimum. |
[in] | paramTableSize | The number of parameters that this driver supports. |
[in] | maxBuffers | The maximum number of NDArray buffers that the NDArrayPool for this driver is allowed to allocate. Set this to -1 to allow an unlimited number of buffers. |
[in] | maxMemory | The maximum amount of memory that the NDArrayPool for this driver is allowed to allocate. Set this to -1 to allow an unlimited amount of memory. |
[in] | interfaceMask | Bit mask defining the asyn interfaces that this driver supports. |
[in] | interruptMask | Bit mask definining the asyn interfaces that can generate interrupts (callbacks) |
[in] | asynFlags | Flags when creating the asyn port driver; includes ASYN_CANBLOCK and ASYN_MULTIDEVICE. |
[in] | autoConnect | The autoConnect flag for the asyn port driver. |
[in] | priority | The thread priority for the asyn port driver thread if ASYN_CANBLOCK is set in asynFlags. |
[in] | stackSize | The stack size for the asyn port driver thread if ASYN_CANBLOCK is set in asynFlags. |
virtual asynStatus NDPluginFile::closeFile | ( | ) | [pure virtual] |
Close the file opened with NDPluginFile::openFile; pure virtual function that must be implemented by derived classes.
Implemented in NDFileJPEG, NDFileNetCDF, NDFileNexus, and NDFileTIFF.
asynStatus NDPluginFile::drvUserCreate | ( | asynUser * | pasynUser, | |
const char * | drvInfo, | |||
const char ** | pptypeName, | |||
size_t * | psize | |||
) | [virtual] |
Sets pasynUser->reason to one of the enum values for the parameters defined for the NDPluginFile class if the drvInfo field matches one the strings defined for it.
If the parameter is not recognized by this class then calls NDPluginDriver::drvUserCreate. Uses asynPortDriver::drvUserCreateParam.
[in] | pasynUser | pasynUser structure that driver modifies |
[in] | drvInfo | String containing information about what driver function is being referenced |
[out] | pptypeName | Location in which driver puts a copy of drvInfo. |
[out] | psize | Location where driver puts size of param |
Reimplemented from NDPluginDriver.
Reimplemented in NDFileJPEG, and NDFileNexus.
virtual asynStatus NDPluginFile::openFile | ( | const char * | fileName, | |
NDFileOpenMode_t | openMode, | |||
NDArray * | pArray | |||
) | [pure virtual] |
Open a file; pure virtual function that must be implemented by derived classes.
[in] | fileName | Absolute path name of the file to open. |
[in] | openMode | Bit mask with one of the access mode bits NDFileModeRead, NDFileModeWrite. NDFileModeAppend. May also have the bit NDFileModeMultiple set if the file is to be opened to write or read multiple NDArrays into a single file. |
[in] | pArray | Pointer to an NDArray; this array does not contain data to be written or read. Rather it can be used to determine the header information and data structure for the file. It is guaranteed that NDArrays pass to NDPluginFile::writeFile or NDPluginFile::readFile will have the same data type, data dimensions and attributes as this array. |
Implemented in NDFileJPEG, NDFileNetCDF, NDFileNexus, and NDFileTIFF.
void NDPluginFile::processCallbacks | ( | NDArray * | pArray | ) | [virtual] |
Callback function that is called by the NDArray driver with new NDArray data.
Saves a single file if NDFileWriteMode=NDFileModeSingle and NDAutoSave=1. Stores array in a capture buffer if NDFileWriteMode=NDFileModeCapture and NDFileCapture=1. Appends data to an open file if NDFileWriteMode=NDFileModeStream and NDFileCapture=1. In capture or stream mode if the desired number of arrays has been saved (NDFileNumCaptured=NDFileNumCapture) then it stops capture or streaming.
[in] | pArray | The NDArray from the callback. |
Reimplemented from NDPluginDriver.
virtual asynStatus NDPluginFile::readFile | ( | NDArray ** | pArray | ) | [pure virtual] |
Read NDArray data from a file; pure virtual function that must be implemented by derived classes.
[in] | pArray | Pointer to the address of an NDArray to read the data into. |
Implemented in NDFileJPEG, NDFileNetCDF, NDFileNexus, and NDFileTIFF.
virtual asynStatus NDPluginFile::writeFile | ( | NDArray * | pArray | ) | [pure virtual] |
Write NDArray data to a file; pure virtual function that must be implemented by derived classes.
[in] | pArray | Pointer to an NDArray to write to the file. This function can be called multiple times between the call to openFile and closeFile if the class set supportsMultipleArrays=1 and NDFileModeMultiple was set in openMode in the call to NDPluginFile::openFile. |
Implemented in NDFileJPEG, NDFileNetCDF, NDFileNexus, and NDFileTIFF.
asynStatus NDPluginFile::writeInt32 | ( | asynUser * | pasynUser, | |
epicsInt32 | value | |||
) | [virtual] |
Called when asyn clients call pasynInt32->write().
This function performs actions for some parameters, including NDReadFile, NDWriteFile and NDFileCapture. For other parameters it calls NDPluginDriver::writeInt32 to see if that method understands the parameter. For all parameters it sets the value in the parameter library and calls any registered callbacks..
[in] | pasynUser | pasynUser structure that encodes the reason and address. |
[in] | value | Value to write. |
Reimplemented from NDPluginDriver.
asynStatus NDPluginFile::writeNDArray | ( | asynUser * | pasynUser, | |
void * | genericPointer | |||
) | [virtual] |
Derived classes must set this flag to 0/1 if they cannot/can write multiple NDArrays to a single file.
Used in capture and stream modes.