kanzi::ReadOnlyDiskFile Class Reference

Implements the File interface for files residing on a disk. More...

#include <kanzi/core/platform/file/win32/read_only_disk_file.hpp>

Inheritance diagram for kanzi::ReadOnlyDiskFile:
kanzi::File

Public Member Functions

 ReadOnlyDiskFile (string_view filename)
 Constructor. More...
 
 ReadOnlyDiskFile (const char *filename)
 Constructor. More...
 
virtual ~ReadOnlyDiskFile () KZ_OVERRIDE
 Destructor. More...
 
virtual void read (char *buffer, uint64_t count) KZ_OVERRIDE
 
virtual void write (const char *buffer, uint64_t count) KZ_OVERRIDE
 
virtual uint64_t size () const KZ_OVERRIDE
 
virtual uint64_t tell () const KZ_OVERRIDE
 
virtual void seek (SeekPosition position, int64_t offset) KZ_OVERRIDE
 
virtual const bytemap () KZ_OVERRIDE
 Creates a memory mapping of the disk file. More...
 
- Public Member Functions inherited from kanzi::File
virtual ~File ()
 

Static Public Member Functions

static ReadOnlyDiskFileUniquePtr tryOpen (string_view filename)
 Factory function. More...
 

Protected Member Functions

 ReadOnlyDiskFile (HANDLE fileHandle)
 Constructor. More...
 
- Protected Member Functions inherited from kanzi::File
 File ()
 

Protected Attributes

HANDLE m_fileHandle
 Opaque handle to the disk file. More...
 
HANDLE m_mapHandle
 Opaque handle to the memory map of the disk file. More...
 
void * m_mapView
 Pointer to the view of the memory map of the disk file. More...
 

Additional Inherited Members

- Public Types inherited from kanzi::File
enum  SeekPosition { SeekBegin, SeekCurrent }
 

Detailed Description

Implements the File interface for files residing on a disk.

Constructor & Destructor Documentation

kanzi::ReadOnlyDiskFile::ReadOnlyDiskFile ( string_view  filename)
explicit

Constructor.

Parameters
filenameThe name (including path) of the disk file to handle. Throws runtime_error if file cannot be accessed.
kanzi::ReadOnlyDiskFile::ReadOnlyDiskFile ( const char *  filename)
inlineexplicit

Constructor.

Parameters
filenameThe name (including path) of the disk file to handle. Throws runtime_error if file cannot be accessed.
virtual kanzi::ReadOnlyDiskFile::~ReadOnlyDiskFile ( )
virtual

Destructor.

Closes the file handle and unmaps the file as needed.

kanzi::ReadOnlyDiskFile::ReadOnlyDiskFile ( HANDLE  fileHandle)
explicitprotected

Constructor.

Parameters
fileHandleAn open disk file handle.

Member Function Documentation

static ReadOnlyDiskFileUniquePtr kanzi::ReadOnlyDiskFile::tryOpen ( string_view  filename)
static

Factory function.

Creates an object representing an open file handle to a disk file.

Parameters
filenameThe name (including path) of the disk file to handle.
Returns
Pointer to the object, or null when file cannot be accessed.
virtual void kanzi::ReadOnlyDiskFile::read ( char *  buffer,
uint64_t  count 
)
virtual

Implements kanzi::File.

virtual void kanzi::ReadOnlyDiskFile::write ( const char *  buffer,
uint64_t  count 
)
virtual

Implements kanzi::File.

virtual uint64_t kanzi::ReadOnlyDiskFile::size ( ) const
virtual

Implements kanzi::File.

virtual uint64_t kanzi::ReadOnlyDiskFile::tell ( ) const
virtual

Implements kanzi::File.

virtual void kanzi::ReadOnlyDiskFile::seek ( SeekPosition  position,
int64_t  offset 
)
virtual

Implements kanzi::File.

virtual const byte* kanzi::ReadOnlyDiskFile::map ( )
virtual

Creates a memory mapping of the disk file.

Does nothing if the disk file has already been memory mapped.

Returns
Pointer to the view of the memory map.

Implements kanzi::File.

Member Data Documentation

HANDLE kanzi::ReadOnlyDiskFile::m_fileHandle
protected

Opaque handle to the disk file.

HANDLE kanzi::ReadOnlyDiskFile::m_mapHandle
protected

Opaque handle to the memory map of the disk file.

void* kanzi::ReadOnlyDiskFile::m_mapView
protected

Pointer to the view of the memory map of the disk file.


The documentation for this class was generated from the following file: