Skip to content

GenApi::FileProtocolAdapter#

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

#include <GenApi/Filestream.h>

Inherits from GenApi::IFileProtocolAdapter

Public Functions#

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

Detailed Description#

class GenApi::FileProtocolAdapter;

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

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

Public Functions Documentation#

FileProtocolAdapter#

FileProtocolAdapter()

Constructor.

~FileProtocolAdapter#

virtual ~FileProtocolAdapter()

attach#

virtual bool attach(
    GenApi::INodeMap * pInterface
)

attach file protocol adapter to nodemap

Parameters:

Return: true if attach was successful, false if not

Reimplements: GenApi::IFileProtocolAdapter::attach

openFile#

virtual bool openFile(
    const char * pFileName,
    std::ios_base::openmode mode
)

open a file on the device

Parameters:

  • pFileName file name of the file to open. The file name must exist in the Enumeration FileSelector
  • mode mode to open the file. The mode must exist in the Enumeration FileOpenMode

Return: true on success, false on error

Reimplements: GenApi::IFileProtocolAdapter::openFile

closeFile#

virtual bool closeFile(
    const char * pFileName
)

close a file on the device

Parameters:

  • pFileName file name of the file to open. The file name must exist in the Enumeration FileSelector

Return: true on success, false on error

Reimplements: GenApi::IFileProtocolAdapter::closeFile

write#

virtual GenICam_streamsize write(
    const char * buf,
    int64_t offs,
    int64_t len,
    const char * pFileName
)

writes data into a file.

Parameters:

  • buf source buffer
  • offs offset into the device file
  • len count of bytes to write
  • pFileName file name of the file to write into The file name must exist in the Enumeration FileSelector

Return: count of bytes written

Reimplements: GenApi::IFileProtocolAdapter::write

read#

virtual GenICam_streamsize read(
    char * buf,
    int64_t offs,
    GenICam_streamsize len,
    const char * pFileName
)

read data from the device into a buffer

Parameters:

  • buf target buffer
  • offs offset in the device file to read from
  • len count of bytes to read
  • pFileName file name of the file to write into The file name must exist in the Enumeration FileSelector

Return: count of bytes successfully read

Reimplements: GenApi::IFileProtocolAdapter::read

getBufSize#

virtual int64_t getBufSize(
    const char * pFileName,
    std::ios_base::openmode mode
)

fetch max FileAccessBuffer length for a file

Parameters:

  • pFileName file name of the file to open. The file name must exist in the Enumeration FileSelector
  • mode mode to open the file. The mode must exist in the Enumeration FileOpenMode

Return: max length of FileAccessBuffer in the given mode on the given file

Reimplements: GenApi::IFileProtocolAdapter::getBufSize

deleteFile#

virtual bool deleteFile(
    const char * pFileName
)

Delete the content of the file.

Parameters:

  • pFileName file name of the file to open. The file name must exist in the Enumeration FileSelector

Return: true on success, false on error

Reimplements: GenApi::IFileProtocolAdapter::deleteFile


Updated on 5 July 2022 at 15:30:00