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

More...

`#include <ByteSink.h>`

## Public Member Functions

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

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

- BaseSinkSource class
- TypeIO class and derived classes

### 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;
casacore::ByteSink::ByteSink
ByteSink()
Default constructor.
casacore::CanonicalIO
Definition CanonicalIO.h:72
casacore::MemoryIO
Definition MemoryIO.h:123
casacore::Int
int Int
Definition aipstype.h:48
casacore::True
const Bool True
Definition aipstype.h:41

### Motivation

This class makes it possible to deny read-access to an IO stream.

Definition at line 93 of file ByteSink.h.

## Constructor & Destructor Documentation

## ByteSink() [1/3]

casacore::ByteSink::ByteSink | ( |  | ) |

Default constructor.

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

Referenced by ByteSink(), operator<<(), operator<<(), operator<<(), operator<<(), operator<<(), operator<<(), operator<<(), operator<<(), operator<<(), operator<<(), operator<<(), operator<<(), operator<<(), operator<<(), operator<<(), and operator=().

## ByteSink() [2/3]

casacore::ByteSink::ByteSink | ( | 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().

## ByteSink() [3/3]

casacore::ByteSink::ByteSink | ( | const ByteSink & | sink | ) |

The copy constructor uses reference semantics.

References ByteSink().

## ~ByteSink()

casacore::ByteSink::~ByteSink | ( |  | ) |

destructor

## Member Function Documentation

## operator<<() [1/15]

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.

References ByteSink(), and casacore::NewDelAllocator< T >::value.

## operator<<() [2/15]

ByteSink & casacore::ByteSink::operator<< | ( | Char | value | ) |

References ByteSink(), and casacore::NewDelAllocator< T >::value.

## operator<<() [3/15]

ByteSink & casacore::ByteSink::operator<< | ( | const Char * | value | ) |

References ByteSink(), and casacore::NewDelAllocator< T >::value.

## operator<<() [4/15]

ByteSink & casacore::ByteSink::operator<< | ( | const Complex & | value | ) |

References ByteSink(), and casacore::NewDelAllocator< T >::value.

## operator<<() [5/15]

ByteSink & casacore::ByteSink::operator<< | ( | const DComplex & | value | ) |

References ByteSink(), and casacore::NewDelAllocator< T >::value.

## operator<<() [6/15]

ByteSink & casacore::ByteSink::operator<< | ( | const String & | value | ) |

References ByteSink(), and casacore::NewDelAllocator< T >::value.

## operator<<() [7/15]

ByteSink & casacore::ByteSink::operator<< | ( | Double | value | ) |

References ByteSink(), and casacore::NewDelAllocator< T >::value.

## operator<<() [8/15]

ByteSink & casacore::ByteSink::operator<< | ( | Float | value | ) |

References ByteSink(), and casacore::NewDelAllocator< T >::value.

## operator<<() [9/15]

ByteSink & casacore::ByteSink::operator<< | ( | Int | value | ) |

References ByteSink(), and casacore::NewDelAllocator< T >::value.

## operator<<() [10/15]

ByteSink & casacore::ByteSink::operator<< | ( | Int64 | value | ) |

References ByteSink(), and casacore::NewDelAllocator< T >::value.

## operator<<() [11/15]

ByteSink & casacore::ByteSink::operator<< | ( | Short | value | ) |

References ByteSink(), and casacore::NewDelAllocator< T >::value.

## operator<<() [12/15]

ByteSink & casacore::ByteSink::operator<< | ( | uChar | value | ) |

References ByteSink(), and casacore::NewDelAllocator< T >::value.

## operator<<() [13/15]

ByteSink & casacore::ByteSink::operator<< | ( | uInt | value | ) |

References ByteSink(), and casacore::NewDelAllocator< T >::value.

## operator<<() [14/15]

ByteSink & casacore::ByteSink::operator<< | ( | uInt64 | value | ) |

References ByteSink(), and casacore::NewDelAllocator< T >::value.

## operator<<() [15/15]

ByteSink & casacore::ByteSink::operator<< | ( | uShort | value | ) |

References ByteSink(), and casacore::NewDelAllocator< T >::value.

## operator=()

ByteSink & casacore::ByteSink::operator= | ( | const ByteSink & | sink | ) |

The assignment operator uses reference semantics.

References ByteSink().

## write() [1/14]

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.

References casacore::NewDelAllocator< T >::value.

## write() [2/14]

void casacore::ByteSink::write | ( | size_t | nvalues,
|  | const Char * | value )

References casacore::NewDelAllocator< T >::value.

## write() [3/14]

void casacore::ByteSink::write | ( | size_t | nvalues,
|  | const Complex * | value )

References casacore::NewDelAllocator< T >::value.

## write() [4/14]

void casacore::ByteSink::write | ( | size_t | nvalues,
|  | const DComplex * | value )

References casacore::NewDelAllocator< T >::value.

## write() [5/14]

void casacore::ByteSink::write | ( | size_t | nvalues,
|  | const Double * | value )

References casacore::NewDelAllocator< T >::value.

## write() [6/14]

void casacore::ByteSink::write | ( | size_t | nvalues,
|  | const Float * | value )

References casacore::NewDelAllocator< T >::value.

## write() [7/14]

void casacore::ByteSink::write | ( | size_t | nvalues,
|  | const Int * | value )

References casacore::NewDelAllocator< T >::value.

## write() [8/14]

void casacore::ByteSink::write | ( | size_t | nvalues,
|  | const Int64 * | value )

References casacore::NewDelAllocator< T >::value.

## write() [9/14]

void casacore::ByteSink::write | ( | size_t | nvalues,
|  | const Short * | value )

References casacore::NewDelAllocator< T >::value.

## write() [10/14]

void casacore::ByteSink::write | ( | size_t | nvalues,
|  | const String * | value )

References casacore::NewDelAllocator< T >::value.

## write() [11/14]

void casacore::ByteSink::write | ( | size_t | nvalues,
|  | const uChar * | value )

References casacore::NewDelAllocator< T >::value.

## write() [12/14]

void casacore::ByteSink::write | ( | size_t | nvalues,
|  | const uInt * | value )

References casacore::NewDelAllocator< T >::value.

## write() [13/14]

void casacore::ByteSink::write | ( | size_t | nvalues,
|  | const uInt64 * | value )

References casacore::NewDelAllocator< T >::value.

## write() [14/14]

void casacore::ByteSink::write | ( | size_t | nvalues,
|  | const uShort * | value )

References casacore::NewDelAllocator< T >::value.

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

- casa/IO/ByteSink.h