MrSID Decode SDK for LiDAR Reference Manual  1.1.2.4045
FileIO Class Reference

FileIO implements file-based IO. More...

#include <FileIO.h>

Inheritance diagram for FileIO:
IO Object

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
void open (void)
 Open the IO object. More...
 
void close (void)
 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
void retain (void) const
 Increment the reference count by one. More...
 
void 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

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 IO
virtual void popen (void)=0
 The Real Open. More...
 
virtual void pclose (void)=0
 The Real Close. More...
 
- Protected Member Functions inherited from Object
 Object (void)
 
virtual ~Object (void)
 
- Static Protected Member Functions inherited from Object
static void * operator new (size_t size)
 Overide new so all Objects use ALLOC() More...
 
static void operator delete (void *ptr)
 Overide delete so all Objects use DEALLOC() More...
 

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 29 of file FileIO.h.

Member Function Documentation

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

This is utility function for deleting a file.

Parameters
pathpath to the file
static bool FileIO::fileExists ( const char *  path)
static

This is utility function for seeing if the file exists.

Parameters
pathpath 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
paththe filename path
modethe 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
tempdirthe location of the temporary directory
void FileIO::unlink ( void  )
virtual

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

Implements IO.

Member Data Documentation

bool FileIO::m_unlinkFile
protected

Definition at line 114 of file FileIO.h.


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

LizardTech