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

More...

`#include <ByteSinkSource.h>`

## Public Member Functions

| ByteSinkSource ()
| Default constructor.
| ByteSinkSource (const std::shared_ptr< TypeIO > &typeIO)
| Construct from given TypeIO object.
| ByteSinkSource (const ByteSinkSource &sinkSource)
| The copy constructor uses reference semantics.
ByteSinkSource & | operator= (const ByteSinkSource &sinkSource)
| The assignment operator uses reference semantics.
| ~ByteSinkSource ()
Public Member Functions inherited from casacore::ByteSink
| ByteSink ()
| Default constructor.
| ByteSink (const std::shared_ptr< TypeIO > &typeIO)
| Construct from given TypeIO object.
| ByteSink (const ByteSink &sink)
| The copy constructor uses reference semantics.
ByteSink & | operator= (const ByteSink &sink)
| The assignment operator uses reference semantics.
| ~ByteSink ()
| destructor
ByteSink & | operator<< (Bool value)
| These functions write one value of the given type.
ByteSink & | operator<< (Char value)
ByteSink & | operator<< (uChar value)
ByteSink & | operator<< (Short value)
ByteSink & | operator<< (uShort value)
ByteSink & | operator<< (Int value)
ByteSink & | operator<< (uInt value)
ByteSink & | operator<< (Int64 value)
ByteSink & | operator<< (uInt64 value)
ByteSink & | operator<< (Float value)
ByteSink & | operator<< (Double value)
ByteSink & | operator<< (const Complex &value)
ByteSink & | operator<< (const DComplex &value)
ByteSink & | operator<< (const String &value)
ByteSink & | operator<< (const Char *value)
void | write (size_t nvalues, const Bool *value)
| These functions write multiple values of the given type.
void | write (size_t nvalues, const Char *value)
void | write (size_t nvalues, const uChar *value)
void | write (size_t nvalues, const Short *value)
void | write (size_t nvalues, const uShort *value)
void | write (size_t nvalues, const Int *value)
void | write (size_t nvalues, const uInt *value)
void | write (size_t nvalues, const Int64 *value)
void | write (size_t nvalues, const uInt64 *value)
void | write (size_t nvalues, const Float *value)
void | write (size_t nvalues, const Double *value)
void | write (size_t nvalues, const Complex *value)
void | write (size_t nvalues, const DComplex *value)
void | write (size_t nvalues, const String *value)
Public Member Functions inherited from casacore::BaseSinkSource
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?
Public Member Functions inherited from casacore::ByteSource
| ByteSource ()
| Default constructor.
| ByteSource (const std::shared_ptr< TypeIO > &typeIO)
| Construct from given TypeIO object.
| ByteSource (const ByteSource &source)
| The copy constructor uses reference semantics.
ByteSource & | operator= (const ByteSource &source)
| The assignment operator uses reference semantics.
| ~ByteSource ()
| destructor
ByteSource & | operator>> (Bool &value)
| These functions read one value of the given type.
ByteSource & | operator>> (Char &value)
ByteSource & | operator>> (uChar &value)
ByteSource & | operator>> (Short &value)
ByteSource & | operator>> (uShort &value)
ByteSource & | operator>> (Int &value)
ByteSource & | operator>> (uInt &value)
ByteSource & | operator>> (Int64 &value)
ByteSource & | operator>> (uInt64 &value)
ByteSource & | operator>> (Float &value)
ByteSource & | operator>> (Double &value)
ByteSource & | operator>> (Complex &value)
ByteSource & | operator>> (DComplex &value)
ByteSource & | operator>> (String &value)
void | read (size_t nvalues, Bool *value)
| These functions read multiple values of the given type.
void | read (size_t nvalues, Char *value)
void | read (size_t nvalues, uChar *value)
void | read (size_t nvalues, Short *value)
void | read (size_t nvalues, uShort *value)
void | read (size_t nvalues, Int *value)
void | read (size_t nvalues, uInt *value)
void | read (size_t nvalues, Int64 *value)
void | read (size_t nvalues, uInt64 *value)
void | read (size_t nvalues, Float *value)
void | read (size_t nvalues, Double *value)
void | read (size_t nvalues, Complex *value)
void | read (size_t nvalues, DComplex *value)
void | read (size_t nvalues, String *value)

## Additional Inherited Members

Protected Member Functions inherited from casacore::BaseSinkSource
| 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 inherited from casacore::BaseSinkSource
std::shared_ptr< TypeIO > | itsTypeIO
| This variable keeps a pointer to a TypeIO.

## Detailed Description

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

### Intended use:

Public interface

### Review Status

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

### Prerequisite

- ByteSink class
- ByteSource class
- TypeIO class and derived classes

### Etymology

This class combines ByteSink and ByteSource.

### Synopsis

ByteSinkSource provides read/write access to a typed byte stream in the Casacore 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
}
casacore::ByteIO::New
@ New
read/write; create file if not exist.
Definition ByteIO.h:70
casacore::ByteSinkSource::ByteSinkSource
ByteSinkSource()
Default constructor.
casacore::CanonicalIO
Definition CanonicalIO.h:72
casacore::RegularFileIO
Definition RegularFileIO.h:80
casacore::Bool
bool Bool
Define the standard types used by Casacore.
Definition aipstype.h:40
casacore::True
const Bool True
Definition aipstype.h:41

### Motivation

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

Definition at line 90 of file ByteSinkSource.h.

## Constructor & Destructor Documentation

## ByteSinkSource() [1/3]

casacore::ByteSinkSource::ByteSinkSource | ( |  | ) |

Default constructor.

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

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

## ByteSinkSource() [2/3]

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

Construct from given TypeIO object.

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

References casacore::BaseSinkSource::typeIO().

## ByteSinkSource() [3/3]

casacore::ByteSinkSource::ByteSinkSource | ( | const ByteSinkSource & | sinkSource | ) |

The copy constructor uses reference semantics.

References ByteSinkSource().

## ~ByteSinkSource()

casacore::ByteSinkSource::~ByteSinkSource | ( |  | ) |

## Member Function Documentation

## operator=()

ByteSinkSource & casacore::ByteSinkSource::operator= | ( | const ByteSinkSource & | sinkSource | ) |

The assignment operator uses reference semantics.

References ByteSinkSource().

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

- casa/IO/ByteSinkSource.h