casa  $Rev:20696$
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Defines
Public Member Functions
casa::ByteSource Class Reference

Class for read-only access to data in a given format. More...

#include <ByteSource.h>

Inheritance diagram for casa::ByteSource:
casa::BaseSinkSource casa::ByteSinkSource

List of all members.

Public Member Functions

 ByteSource ()
 Default constructor.
 ByteSource (TypeIO *typeIO, Bool takeOver=False)
 Construct from given TypeIO object.
 ByteSource (const ByteSource &source)
 The copy constructor uses reference semantics.
ByteSourceoperator= (const ByteSource &source)
 The assignment operator uses reference semantics.
 ~ByteSource ()
 destructor
ByteSourceoperator>> (Bool &value)
 These functions read one value of the given type.
ByteSourceoperator>> (Char &value)
ByteSourceoperator>> (uChar &value)
ByteSourceoperator>> (Short &value)
ByteSourceoperator>> (uShort &value)
ByteSourceoperator>> (Int &value)
ByteSourceoperator>> (uInt &value)
ByteSourceoperator>> (Int64 &value)
ByteSourceoperator>> (uInt64 &value)
ByteSourceoperator>> (Float &value)
ByteSourceoperator>> (Double &value)
ByteSourceoperator>> (Complex &value)
ByteSourceoperator>> (DComplex &value)
ByteSourceoperator>> (String &value)
void read (uInt nvalues, Bool *value)
 These functions read multiple values of the given type.
void read (uInt nvalues, Char *value)
void read (uInt nvalues, uChar *value)
void read (uInt nvalues, Short *value)
void read (uInt nvalues, uShort *value)
void read (uInt nvalues, Int *value)
void read (uInt nvalues, uInt *value)
void read (uInt nvalues, Int64 *value)
void read (uInt nvalues, uInt64 *value)
void read (uInt nvalues, Float *value)
void read (uInt nvalues, Double *value)
void read (uInt nvalues, Complex *value)
void read (uInt nvalues, DComplex *value)
void read (uInt nvalues, String *value)

Detailed Description

Class for read-only access to data in a given format.

Intended use:

Public interface

 <h3>Review Status</h3><dl><dt>Reviewed By:<dd>Friso Olnon<dt>Date Reviewed:<dd>1996/11/06<dt>Test programs:<dd>tByteSink</dl> 

Prerequisite

Etymology

A source is the place where bytes are read from.

Synopsis

ByteSource provides read-only access to a typed byte stream in the AIPS++ IO framework. The base class BaseSinkSource contains common functions like seek.

The object is constructed using a typed byte stream. This stream is an instance of a class derived from class TypeIO . This makes it possible to read the data in any format (e.g. CanonicalIO or RawIO).
In its turn TypeIO uses an instance of a class derived from class ByteIO . This makes it possible to use any input stream (e.g. file, memory).

Example

       // Construct the correct input stream.
       RegularFileIO filio ("file.name");
       CanonicalIO canio (&filio);
       ByteSource source (&canio);
       // Read data.
       Int vali;
       Bool flag;
       source >> vali >> flag;

Motivation

This class makes it possible to deny write-access to an IO stream.

Definition at line 91 of file ByteSource.h.


Constructor & Destructor Documentation

Default constructor.

This creates an invalid object, but is present for convenience.

casa::ByteSource::ByteSource ( TypeIO typeIO,
Bool  takeOver = False 
)

Construct from given TypeIO object.

The constructor does not copy the object, but only keeps a pointer to it. If takeOver is true the this class will delete the supplied pointer. Otherwise the caller is responsible for this.

The copy constructor uses reference semantics.

destructor


Member Function Documentation

ByteSource& casa::ByteSource::operator= ( const ByteSource source)

The assignment operator uses reference semantics.

ByteSource& casa::ByteSource::operator>> ( Bool value)

These functions read one value of the given type.

If this function does not succeed, an exception will be thrown.

ByteSource& casa::ByteSource::operator>> ( Char value)
ByteSource& casa::ByteSource::operator>> ( uChar value)
ByteSource& casa::ByteSource::operator>> ( Short value)
ByteSource& casa::ByteSource::operator>> ( uShort value)
ByteSource& casa::ByteSource::operator>> ( Int value)
ByteSource& casa::ByteSource::operator>> ( uInt value)
ByteSource& casa::ByteSource::operator>> ( Int64 value)
ByteSource& casa::ByteSource::operator>> ( uInt64 value)
ByteSource& casa::ByteSource::operator>> ( Float value)
ByteSource& casa::ByteSource::operator>> ( Double value)
ByteSource& casa::ByteSource::operator>> ( Complex &  value)
ByteSource& casa::ByteSource::operator>> ( DComplex &  value)
ByteSource& casa::ByteSource::operator>> ( String value)
void casa::ByteSource::read ( uInt  nvalues,
Bool value 
)

These functions read multiple values of the given type.

If this function does not succeed, an exception will be thrown.

void casa::ByteSource::read ( uInt  nvalues,
Char value 
)
void casa::ByteSource::read ( uInt  nvalues,
uChar value 
)
void casa::ByteSource::read ( uInt  nvalues,
Short value 
)
void casa::ByteSource::read ( uInt  nvalues,
uShort value 
)
void casa::ByteSource::read ( uInt  nvalues,
Int value 
)
void casa::ByteSource::read ( uInt  nvalues,
uInt value 
)
void casa::ByteSource::read ( uInt  nvalues,
Int64 value 
)
void casa::ByteSource::read ( uInt  nvalues,
uInt64 value 
)
void casa::ByteSource::read ( uInt  nvalues,
Float value 
)
void casa::ByteSource::read ( uInt  nvalues,
Double value 
)
void casa::ByteSource::read ( uInt  nvalues,
Complex *  value 
)
void casa::ByteSource::read ( uInt  nvalues,
DComplex *  value 
)
void casa::ByteSource::read ( uInt  nvalues,
String value 
)

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