Loading...
Searching...
No Matches
casacore::BaseSinkSource Class Reference
casa package (libcasa_casa) » IO_module

More...

`#include <BaseSinkSource.h>`

## Public Member Functions

const std::shared_ptr< TypeIO > & | typeIO () const
| This functions returns the shared pointer to itsTypeIO.
Int64 | seek (Int64 offset, ByteIO::SeekOption=ByteIO::Begin)
| This function sets the position on the given offset.
Int64 | seek (Int offset, ByteIO::SeekOption=ByteIO::Begin)
Bool | isReadable () const
| Is the SinkSource readable?
Bool | isWritable () const
| Is the SinkSource writable?
Bool | isSeekable () const
| Is the SinkSource seekable?
Bool | isNull () const
| Is the BaseSinkSource unusable?

## Protected Member Functions

| BaseSinkSource ()
| BaseSinkSource (const std::shared_ptr< TypeIO > &typeIO)
| Construct using the given TypeIO.
| BaseSinkSource (const BaseSinkSource &BaseSinkSource)
| The copy constructor uses reference semantics.
BaseSinkSource & | operator= (const BaseSinkSource &BaseSinkSource)
| The assignment operator uses reference semantics.
virtual | ~BaseSinkSource ()

## Protected Attributes

std::shared_ptr< TypeIO > | itsTypeIO
| This variable keeps a pointer to a TypeIO.

## Detailed Description

Shared base class for ByteSink and ByteSource.

### Intended use:

Public interface

### Prerequisite

- TypeIO class and derived classes

### 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 81 of file BaseSinkSource.h.

## Constructor & Destructor Documentation

## BaseSinkSource() [1/3]

casacore::BaseSinkSource::BaseSinkSource | ( |  | ) |

protected

Referenced by BaseSinkSource(), and operator=().

## BaseSinkSource() [2/3]

casacore::BaseSinkSource::BaseSinkSource | ( | const std::shared_ptr< TypeIO > & | typeIO | ) |

protected

Construct using the given TypeIO.

The constructor does not copy the object, but only keeps a pointer to it.

References typeIO().

## BaseSinkSource() [3/3]

casacore::BaseSinkSource::BaseSinkSource | ( | const BaseSinkSource & | BaseSinkSource | ) |

protected

The copy constructor uses reference semantics.

References BaseSinkSource().

## ~BaseSinkSource()

virtual casacore::BaseSinkSource::~BaseSinkSource | ( |  | ) |

protected virtual

## Member Function Documentation

## isNull()

Bool casacore::BaseSinkSource::isNull | ( |  | ) | const

Is the BaseSinkSource unusable?

## isReadable()

Bool casacore::BaseSinkSource::isReadable | ( |  | ) | const

Is the SinkSource readable?

## isSeekable()

Bool casacore::BaseSinkSource::isSeekable | ( |  | ) | const

Is the SinkSource seekable?

## isWritable()

Bool casacore::BaseSinkSource::isWritable | ( |  | ) | const

Is the SinkSource writable?

## operator=()

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

protected

The assignment operator uses reference semantics.

References BaseSinkSource().

## seek() [1/2]

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

References casacore::ByteIO::Begin, and casacore::offset().

## seek() [2/2]

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.

References casacore::ByteIO::Begin, and casacore::offset().

## typeIO()

const std::shared_ptr< TypeIO > & casacore::BaseSinkSource::typeIO | ( |  | ) | const

inline

This functions returns the shared pointer to itsTypeIO.

Definition at line 85 of file BaseSinkSource.h.

References itsTypeIO.

Referenced by BaseSinkSource(), casacore::ByteSink::ByteSink(), casacore::ByteSinkSource::ByteSinkSource(), and casacore::ByteSource::ByteSource().

## Member Data Documentation

## itsTypeIO

std::shared_ptr<TypeIO> casacore::BaseSinkSource::itsTypeIO

protected

This variable keeps a pointer to a TypeIO.

Definition at line 124 of file BaseSinkSource.h.

Referenced by typeIO().

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

- casa/IO/BaseSinkSource.h