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

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

#include <ByteSink.h>

Inheritance diagram for casa::ByteSink:
casa::BaseSinkSource casa::ByteSinkSource

List of all members.

Public Member Functions

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

Detailed Description

Class for write-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 sink is the place where bytes are written to.

Synopsis

ByteSink provides write-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 store 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 output stream (e.g. file, memory).

Note that in general ByteSink will only be used for write-only streams like sockets or pipes. Class ByteSinkSource is the obvious choice for read/write streams.

Example

       // Construct the correct output stream.
       MemoryIO memio;
       CanonicalIO canio (&memio);
       ByteSink sink (&canio);
       // Write data.
       Int vali;
       sink << vali << True;

Motivation

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

Definition at line 95 of file ByteSink.h.


Constructor & Destructor Documentation

Default constructor.

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

casa::ByteSink::ByteSink ( 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

ByteSink& casa::ByteSink::operator<< ( Bool  value)

These functions write one value of the given type.

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

ByteSink& casa::ByteSink::operator<< ( Char  value)
ByteSink& casa::ByteSink::operator<< ( uChar  value)
ByteSink& casa::ByteSink::operator<< ( Short  value)
ByteSink& casa::ByteSink::operator<< ( uShort  value)
ByteSink& casa::ByteSink::operator<< ( Int  value)
ByteSink& casa::ByteSink::operator<< ( uInt  value)
ByteSink& casa::ByteSink::operator<< ( Int64  value)
ByteSink& casa::ByteSink::operator<< ( uInt64  value)
ByteSink& casa::ByteSink::operator<< ( Float  value)
ByteSink& casa::ByteSink::operator<< ( Double  value)
ByteSink& casa::ByteSink::operator<< ( const Complex &  value)
ByteSink& casa::ByteSink::operator<< ( const DComplex &  value)
ByteSink& casa::ByteSink::operator<< ( const String value)
ByteSink& casa::ByteSink::operator<< ( const Char value)
ByteSink& casa::ByteSink::operator= ( const ByteSink sink)

The assignment operator uses reference semantics.

void casa::ByteSink::write ( uInt  nvalues,
const Bool value 
)

These functions write multiple values of the given type.

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

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

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