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

Class for read/write access to data in a given format. More...

#include <ByteSinkSource.h>

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

List of all members.

Public Member Functions

 ByteSinkSource ()
 Default constructor.
 ByteSinkSource (TypeIO *typeIO, Bool takeOver=False)
 Construct from given TypeIO object.
 ByteSinkSource (const ByteSinkSource &sinkSource)
 The copy constructor uses reference semantics.
ByteSinkSourceoperator= (const ByteSinkSource &sinkSource)
 The assignment operator uses reference semantics.
 ~ByteSinkSource ()

Detailed Description

Class for read/write 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>tByteSinkSource</dl> 

Prerequisite

Etymology

This class combines ByteSink and ByteSource.

Synopsis

ByteSinkSource provides read/write access to a typed byte stream in the AIPS++ IO framework. It is derived from the classes ByteSink and ByteSource, so it combines their functionality.

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).

Example

    main 
    {
        Bool valb = True;
        RegularFileIO regularFileIO ("test.dat", ByteIO::New);
        CanonicalIO canonicalIO(&regularFileIO);
        ByteSinkSource  sinkSource(&canonicalIO);
        sinkSource << valb;     // Write a boolean
        sinkSource.seek (0);    // Reset to begin of IO stream
        sinkSource >> valb;     // Read a boolean
        cout << valb << endl;   // Print the boolean  
    }

Motivation

This class makes it transparant to do IO with different devices and in different ways.

Definition at line 92 of file ByteSinkSource.h.


Constructor & Destructor Documentation

Default constructor.

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

casa::ByteSinkSource::ByteSinkSource ( 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.


Member Function Documentation

ByteSinkSource& casa::ByteSinkSource::operator= ( const ByteSinkSource sinkSource)

The assignment operator uses reference semantics.


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