GenApi  3.5.1
Public Member Functions | List of all members
FileProtocolAdapter Class Reference

Adapter between the std::iostreambuf and the SFNC Features representing the device filesystem. More...

Inherits IFileProtocolAdapter.

Public Member Functions

 FileProtocolAdapter ()
 Constructor.
 
virtual bool attach (GENAPI_NAMESPACE::INodeMap *pInterface)
 attach file protocol adapter to nodemap More...
 
virtual bool openFile (const char *pFileName, std::ios_base::openmode mode)
 open a file on the device More...
 
virtual bool closeFile (const char *pFileName)
 close a file on the device More...
 
virtual GenICam_streamsize write (const char *buf, int64_t offs, int64_t len, const char *pFileName)
 writes data into a file More...
 
virtual GenICam_streamsize read (char *buf, int64_t offs, GenICam_streamsize len, const char *pFileName)
 read data from the device into a buffer More...
 
virtual int64_t getBufSize (const char *pFileName, std::ios_base::openmode mode)
 fetch max FileAccessBuffer length for a file More...
 
virtual bool deleteFile (const char *pFileName)
 Delete the content of the file. More...
 

Detailed Description

The adapter assumes, that the features provide stdio fileaccess compatible semantic

Member Function Documentation

◆ attach()

virtual bool attach ( GENAPI_NAMESPACE::INodeMap *  pInterface)
virtual
Parameters
pInterfaceNodeMap of the device to which the FileProtocolAdapter is attached
Returns
true if attach was successful, false if not

◆ openFile()

virtual bool openFile ( const char *  pFileName,
std::ios_base::openmode  mode 
)
virtual
Parameters
pFileNamefile name of the file to open. The file name must exist in the Enumeration FileSelector
modemode to open the file. The mode must exist in the Enumeration FileOpenMode
Returns
true on success, false on error

◆ closeFile()

virtual bool closeFile ( const char *  pFileName)
virtual
Parameters
pFileNamefile name of the file to open. The file name must exist in the Enumeration FileSelector
Returns
true on success, false on error

◆ write()

virtual GenICam_streamsize write ( const char *  buf,
int64_t  offs,
int64_t  len,
const char *  pFileName 
)
virtual
Parameters
bufsource buffer
offsoffset into the device file
lencount of bytes to write
pFileNamefile name of the file to write into. The file name must exist in the Enumeration FileSelector
Returns
count of bytes written. If less than len bytes are written an error has occurred.

◆ read()

virtual GenICam_streamsize read ( char *  buf,
int64_t  offs,
GenICam_streamsize  len,
const char *  pFileName 
)
virtual
Parameters
buftarget buffer
offsoffset in the device file to read from
lencount of bytes to read
pFileNamefile name of the file to write into. The file name must exist in the Enumeration FileSelector
Returns
count of bytes successfully read. . If less than len bytes are written an error has occurred.

◆ getBufSize()

virtual int64_t getBufSize ( const char *  pFileName,
std::ios_base::openmode  mode 
)
virtual
Parameters
pFileNamefile name of the file to open. The file name must exist in the Enumeration FileSelector
modemode to open the file. The mode must exist in the Enumeration FileOpenMode
Returns
max length of FileAccessBuffer in the given mode on the given file

◆ deleteFile()

virtual bool deleteFile ( const char *  pFileName)
virtual
Parameters
pFileNamefile name of the file to open. The file name must exist in the Enumeration FileSelector
Returns
true on success, false on error