MrSID Decode SDK for LiDAR Reference Manual  1.1.2.4045
IO Class Referenceabstract

IO is the base class for binary input and output. More...

#include <IO.h>

Inheritance diagram for IO:
Object FileIO

Classes

struct  Location
 Location is a helper structure for holding the location of data in a IO object. More...
 

Public Types

typedef lt_int64 offset_type
 Integer data type for file offsets and sizes. More...
 

Public Member Functions

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...
 
virtual void unlink (void)=0
 Delete the resource when the IO object is deleted. 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...
 

Protected Member Functions

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)
 

Additional Inherited Members

- 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 IO class was designed to thread safe for reading and writing. The reading and writing functions do not have a internal file position, the offset is passed into pread() and pwrite(). This is based off the POSIX pread() and pwrite() interfaces. Unlike the libc's FILE structure the buffering is not part of the IO object. Buffering is handled by the StreamReader and the StreamWriter classes.

Definition at line 30 of file IO.h.

Member Typedef Documentation

Definition at line 37 of file IO.h.

Member Function Documentation

void IO::close ( void  )

This method closes the IO object. open() and close() are reference counted so you must call close() the some number of times as open().

void IO::open ( void  )

This method opens the IO object. open() and close() are reference counted so you must call close() the some number of times as open().

virtual void IO::pclose ( void  )
protectedpure virtual

This method gets called by close() when the resource needs to be closed.

virtual void IO::popen ( void  )
protectedpure virtual

This method gets called by open() when the resource needs to be opened.

virtual size_t IO::pread ( offset_type  offset,
void *  buffer,
size_t  nbytes 
) const
pure virtual

This method tries to read nbytes bytes at the given offset.

Parameters
offsetthe file offset to read from
bufferthe destination memory location
nbytesthe number of bytes to read
Returns
the number of bytes read
virtual size_t IO::pwrite ( offset_type  offset,
const void *  buffer,
size_t  nbytes 
) const
pure virtual

This method tries to write nbytes bytes at the given offset.

Parameters
offsetthe file offset to write to
bufferthe source memory location
nbytesthe number of bytes to write
Returns
the number of bytes written
virtual offset_type IO::size ( void  ) const
pure virtual

This method returns the size of the resource.

virtual void IO::truncate ( offset_type  length)
pure virtual

This method sets the size of the resource. If the new size is smaller the data is lost. If the new size is larger the resource padded with zeros.

Note
The object must be open.
virtual void IO::unlink ( void  )
pure virtual

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

Implemented in FileIO.


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

LizardTech