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

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

#include <ByteSink.h>

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

Public Member Functions

 ByteSink ()
 Default constructor. More...
 
 ByteSink (TypeIO *typeIO, Bool takeOver=False)
 Construct from given TypeIO object. More...
 
 ByteSink (const ByteSink &sink)
 The copy constructor uses reference semantics. More...
 
ByteSinkoperator= (const ByteSink &sink)
 The assignment operator uses reference semantics. More...
 
 ~ByteSink ()
 destructor More...
 
ByteSinkoperator<< (Bool value)
 These functions write one value of the given type. More...
 
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 (size_t nvalues, const Bool *value)
 These functions write multiple values of the given type. More...
 
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
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...
 

Additional Inherited Members

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

Detailed Description

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

Intended use:

Public interface

Review Status

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

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 Casacore 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

casacore::ByteSink::ByteSink ( )

Default constructor.

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

casacore::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.

casacore::ByteSink::ByteSink ( const ByteSink sink)

The copy constructor uses reference semantics.

casacore::ByteSink::~ByteSink ( )

destructor

Member Function Documentation

ByteSink& casacore::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& casacore::ByteSink::operator<< ( Char  value)
ByteSink& casacore::ByteSink::operator<< ( uChar  value)
ByteSink& casacore::ByteSink::operator<< ( Short  value)
ByteSink& casacore::ByteSink::operator<< ( uShort  value)
ByteSink& casacore::ByteSink::operator<< ( Int  value)
ByteSink& casacore::ByteSink::operator<< ( uInt  value)
ByteSink& casacore::ByteSink::operator<< ( Int64  value)
ByteSink& casacore::ByteSink::operator<< ( uInt64  value)
ByteSink& casacore::ByteSink::operator<< ( Float  value)
ByteSink& casacore::ByteSink::operator<< ( Double  value)
ByteSink& casacore::ByteSink::operator<< ( const Complex &  value)
ByteSink& casacore::ByteSink::operator<< ( const DComplex &  value)
ByteSink& casacore::ByteSink::operator<< ( const String value)
ByteSink& casacore::ByteSink::operator<< ( const Char value)
ByteSink& casacore::ByteSink::operator= ( const ByteSink sink)

The assignment operator uses reference semantics.

void casacore::ByteSink::write ( size_t  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 casacore::ByteSink::write ( size_t  nvalues,
const Char value 
)
void casacore::ByteSink::write ( size_t  nvalues,
const uChar value 
)
void casacore::ByteSink::write ( size_t  nvalues,
const Short value 
)
void casacore::ByteSink::write ( size_t  nvalues,
const uShort value 
)
void casacore::ByteSink::write ( size_t  nvalues,
const Int value 
)
void casacore::ByteSink::write ( size_t  nvalues,
const uInt value 
)
void casacore::ByteSink::write ( size_t  nvalues,
const Int64 value 
)
void casacore::ByteSink::write ( size_t  nvalues,
const uInt64 value 
)
void casacore::ByteSink::write ( size_t  nvalues,
const Float value 
)
void casacore::ByteSink::write ( size_t  nvalues,
const Double value 
)
void casacore::ByteSink::write ( size_t  nvalues,
const Complex *  value 
)
void casacore::ByteSink::write ( size_t  nvalues,
const DComplex *  value 
)
void casacore::ByteSink::write ( size_t  nvalues,
const String value 
)

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