casacore
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
Public Member Functions | Protected Member Functions | Protected Attributes | List of all members
casacore::BaseSinkSource Class Reference

Shared base class for ByteSink and ByteSource. More...

#include <BaseSinkSource.h>

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

Public Member Functions

TypeIOtypeIO ()
 This functions returns a reference to itsTypeIO. More...
 
const TypeIOtypeIO () const
 
Int64 seek (Int64 offset, ByteIO::SeekOption=ByteIO::Begin)
 This function sets the position on the given offset. More...
 
Int64 seek (Int offset, ByteIO::SeekOption=ByteIO::Begin)
 
Bool isReadable () const
 Is the SinkSource readable? More...
 
Bool isWritable () const
 Is the SinkSource writable? More...
 
Bool isSeekable () const
 Is the SinkSource seekable? More...
 
Bool isNull () const
 Is the BaseSinkSource unusable? More...
 

Protected Member Functions

 BaseSinkSource ()
 
 BaseSinkSource (TypeIO *typeIO, Bool takeOver=False)
 Construct using the given TypeIO. More...
 
 BaseSinkSource (const BaseSinkSource &BaseSinkSource)
 The copy constructor uses reference semantics. More...
 
BaseSinkSourceoperator= (const BaseSinkSource &BaseSinkSource)
 The assignment operator uses reference semantics. More...
 
virtual ~BaseSinkSource ()
 

Protected Attributes

CountedPtr< TypeIOitsTypeIO
 This variable keeps a pointer to a TypeIO. More...
 

Detailed Description

Shared base class for ByteSink and ByteSource.

Intended use:

Public interface

Prerequisite

Review Status

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

Synopsis

This class provides the common functionality for the classes ByteSink and ByteSource.

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). Class CanonicalIO makes it possible to store the data in a canonical (machine-independent) format, so it can be read on any machine and operating system. The canonical format is big-endian IEEE, where a (unsigned) long is stored as 8 bytes. This means that on common 32-bit big-endian machines like SUN and HP only longs have to be converted and that CanonicalIO is as fast as RawIO. Class RawIO stores the data in native format, so the IO-process is faster on especially little-endian machines (PC, DEC-alpha). Note that RawIO can also be used to read bytes and interprete or convert them thereafter (e.g. using the conversion functions in the Conversion Conversion framework.

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

Motivation

The design of the ByteSink and ByteSource classes resembles the design of the iostream classes in the standard library. A shared base class is needed to allow multiple inheritance needed for class ByteSinkSource.

Definition at line 83 of file BaseSinkSource.h.

Constructor & Destructor Documentation

casacore::BaseSinkSource::BaseSinkSource ( )
protected
casacore::BaseSinkSource::BaseSinkSource ( TypeIO typeIO,
Bool  takeOver = False 
)
protected

Construct using the given TypeIO.

If takeOver is true the this class will delete the supplied pointer. Otherwise the caller is responsible for this.

casacore::BaseSinkSource::BaseSinkSource ( const BaseSinkSource BaseSinkSource)
protected

The copy constructor uses reference semantics.

virtual casacore::BaseSinkSource::~BaseSinkSource ( )
protectedvirtual

Member Function Documentation

Bool casacore::BaseSinkSource::isNull ( ) const

Is the BaseSinkSource unusable?

Bool casacore::BaseSinkSource::isReadable ( ) const

Is the SinkSource readable?

Bool casacore::BaseSinkSource::isSeekable ( ) const

Is the SinkSource seekable?

Bool casacore::BaseSinkSource::isWritable ( ) const

Is the SinkSource writable?

BaseSinkSource& casacore::BaseSinkSource::operator= ( const BaseSinkSource BaseSinkSource)
protected

The assignment operator uses reference semantics.

Int64 casacore::BaseSinkSource::seek ( Int64  offset,
ByteIO::SeekOption  = ByteIO::Begin 
)

This function sets the position on the given offset.

The seek option defines from which position the seek is done.

Int64 casacore::BaseSinkSource::seek ( Int  offset,
ByteIO::SeekOption  = ByteIO::Begin 
)
TypeIO& casacore::BaseSinkSource::typeIO ( )

This functions returns a reference to itsTypeIO.

const TypeIO& casacore::BaseSinkSource::typeIO ( ) const

Member Data Documentation

CountedPtr<TypeIO> casacore::BaseSinkSource::itsTypeIO
protected

This variable keeps a pointer to a TypeIO.

Definition at line 129 of file BaseSinkSource.h.


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