MrSID Decode SDK for LiDAR Reference Manual 1.1.4.4709

- Main Page
- Classes
- Files

- Class List
- Class Index
- Class Hierarchy
- Class Members

Public Member Functions | Static Public Member Functions | Protected Attributes | List of all members
FileIO Class Reference

FileIO implements file-based IO. More...

`#include <FileIO.h>`

Inheritance diagram for FileIO:
[legend]
Collaboration diagram for FileIO:
[legend]

## Public Member Functions
void | init (const char *path, const char *mode)
| Initialize with the file path and access mode. More...
void | init (const char *tempdir)
| Create a temporary file for readeing and writing. More...
void | unlink (void)
| Delete the resource when the IO object is deleted. More...
Public Member Functions inherited from IO
virtual void | open (void)=0
| Open the IO object. More...
virtual void | close (void)=0
| Close the IO object. More...
virtual size_t | pread (offset_type offset, void *buffer, size_t nbytes) const =0
| Read data. More...
virtual size_t | pwrite (offset_type offset, const void *buffer, size_t nbytes) const =0
| Write data. More...
virtual offset_type | size (void) const =0
| Get the size of the resource. More...
virtual void | truncate (offset_type length)=0
| Set the size of the resource. More...
Public Member Functions inherited from Object
int | retain (void) const
| Increment the reference count by one. More...
int | release (void) const
| Decrement the reference count by one. More...

## Static Public Member Functions
static void | deleteFile (const char *path)
| Delete a file. More...
static bool | fileExists (const char *path)
| Test if the file exists. More...

## Protected Attributes
Mutex | m_openLock
int | m_openCount
bool | m_unlinkFile

## Additional Inherited Members
Public Types inherited from IO
typedef lt_int64 | offset_type
| Integer data type for file offsets and sizes. More...
Protected Member Functions inherited from Object
| Object (void)
virtual | ~Object (void)

## Detailed Description

The FileIO class implements a file-based IO object. It uses the pread() and pwrite() on POSIX systems and ReadFile() and WriteFile() with overlaps on Windows systems.

See Also
  See examples/src/support.cpp compareFiles() for an example of reading a file.

Definition at line 30 of file FileIO.h.

## Member Function Documentation

static void FileIO::deleteFile | ( | const char * | path) |  |
| static

This is utility function for deleting a file.

Parameters

  path | path to the file

static bool FileIO::fileExists | ( | const char * | path) |  |
| static

This is utility function for seeing if the file exists.

Parameters

  path | path to the file

void FileIO::init | ( | const char * | path,
|  | const char * | mode
| ) |  |

This method initializes the FileIO object with a filename path and access mode.

Modes:

- "r": Open a file for reading.
- "r+": Open a file for reading and writing.
- "w": Truncate or create a file for writing.
- "w+": Truncate or create a file for reading and writing.

Parameters

  path | the filename path (UTF-8 encoded)
  mode | the file access mode

void FileIO::init | ( | const char * | tempdir) |  |

This method creates temporary file for reading and writing. When the FileIO object is deallocted the temporary file is deleted. If tempdir is NULL the default temporary directory is used.

Parameters

  tempdir | the location of the temporary directory (UTF-8 encode)

void FileIO::unlink | ( | void | ) |  |
| virtual

This method marks the resource for deletion when the object goes away.

Implements IO.

## Member Data Documentation

int FileIO::m_openCount
| protected

Definition at line 127 of file FileIO.h.

Mutex FileIO::m_openLock
| protected

Definition at line 125 of file FileIO.h.

bool FileIO::m_unlinkFile
| protected

Definition at line 128 of file FileIO.h.

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

- FileIO.h

LizardTech