casa::ByteIO Class Reference
[IO]

#include <ByteIO.h>

Inheritance diagram for casa::ByteIO:

Inheritance graph
[legend]
List of all members.

Detailed Description

Abstract base class for IO on a byte stream.

Intended use:

Part of API

Review Status

Reviewed By:
Friso Olnon
Date Reviewed:
1996/11/06
Test programs:
tByteIO

Synopsis

ByteIO is the abstract base class for all classes doing IO on byte streams. Examples of derived classes are RegularFileIO and MemoryIO .

ByteIO contains two enumerations, which define the possible open and seek options on byte streams. These enumerations are used throughout the IO framework.

Motivation

Make polymorphic operations on byte streams possible.

Definition at line 60 of file ByteIO.h.

Public Types

enum  OpenOption
 Define the possible ByteIO open options. More...
enum  SeekOption
 Define the possible seek options. More...

Public Member Functions

 ByteIO ()
 The constructor does nothing.
virtual ~ByteIO ()
virtual void write (uInt size, const void *buf)=0
 Write size bytes to the byte stream.
virtual Int read (uInt size, void *buf, Bool throwException=True)=0
 Read size bytes from the byte stream.
virtual void reopenRW ()
 Reopen the underlying IO stream for read/write access.
virtual Int64 length ()=0
 Get the length of the byte stream.
virtual Bool isReadable () const=0
 Is the byte stream readable?
virtual Bool isWritable () const=0
 Is the byte stream writable?
virtual Bool isSeekable () const=0
 Is the byte stream seekable?
Int64 seek (Int offset, ByteIO::SeekOption=ByteIO::Begin)
 This function sets the position on the given offset.
Int64 seek (Int64 offset, ByteIO::SeekOption=ByteIO::Begin)

Protected Member Functions

virtual Int64 doSeek (Int64 offset, ByteIO::SeekOption)=0
 ByteIO (const ByteIO &byteIO)
 Make copy constructor and assignment protected, so a user cannot use them (but a derived class can).
ByteIOoperator= (const ByteIO &byteIO)


Member Enumeration Documentation

enum casa::ByteIO::OpenOption

Define the possible ByteIO open options.

Definition at line 64 of file ByteIO.h.

enum casa::ByteIO::SeekOption

Define the possible seek options.

Definition at line 81 of file ByteIO.h.


Constructor & Destructor Documentation

casa::ByteIO::ByteIO (  )  [inline]

The constructor does nothing.

Definition at line 147 of file ByteIO.h.

virtual casa::ByteIO::~ByteIO (  )  [virtual]

casa::ByteIO::ByteIO ( const ByteIO byteIO  )  [inline, protected]

Make copy constructor and assignment protected, so a user cannot use them (but a derived class can).

Definition at line 150 of file ByteIO.h.


Member Function Documentation

virtual void casa::ByteIO::write ( uInt  size,
const void *  buf 
) [pure virtual]

Write size bytes to the byte stream.

virtual Int casa::ByteIO::read ( uInt  size,
void *  buf,
Bool  throwException = True 
) [pure virtual]

Read size bytes from the byte stream.

Returns the number of bytes actually read, or a negative number if an error occured. Will also throw an Exception (AipsError) if the requested number of bytes could not be read unless throwException is set to False.

virtual void casa::ByteIO::reopenRW (  )  [virtual]

Reopen the underlying IO stream for read/write access.

Nothing will be done if the stream is writable already. Otherwise it will be reopened and an exception will be thrown if it is not possible to reopen it for read/write access. The default implementation in this base class throws a "not possible" exception if a reopen has to be done.

Int64 casa::ByteIO::seek ( Int  offset,
ByteIO::SeekOption  = ByteIO::Begin 
) [inline]

This function sets the position on the given offset.

The seek option defines from which file position the seek is done. -1 is returned if not seekable.

Definition at line 162 of file ByteIO.h.

References doSeek().

Int64 casa::ByteIO::seek ( Int64  offset,
ByteIO::SeekOption  = ByteIO::Begin 
) [inline]

Definition at line 158 of file ByteIO.h.

References doSeek().

virtual Int64 casa::ByteIO::length (  )  [pure virtual]

Get the length of the byte stream.

virtual Bool casa::ByteIO::isReadable (  )  const [pure virtual]

Is the byte stream readable?

virtual Bool casa::ByteIO::isWritable (  )  const [pure virtual]

Is the byte stream writable?

virtual Bool casa::ByteIO::isSeekable (  )  const [pure virtual]

Is the byte stream seekable?

ByteIO & casa::ByteIO::operator= ( const ByteIO byteIO  )  [inline, protected]

Definition at line 153 of file ByteIO.h.

virtual Int64 casa::ByteIO::doSeek ( Int64  offset,
ByteIO::SeekOption   
) [protected, pure virtual]

Referenced by seek().


The documentation for this class was generated from the following file:
Generated on Mon Sep 1 22:44:07 2008 for NRAOCASA by  doxygen 1.5.1