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

More...

`#include <ByteSource.h>`

## Public Member Functions

| 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)
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 read-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 source is the place where bytes are read from.

### Synopsis

ByteSource provides read-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 read 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 input stream (e.g. file, memory).

### Example

// Construct the correct input stream.
RegularFileIO filio ("file.name");
CanonicalIO canio (&filio);
ByteSource source (&canio);
// Read data.
Int vali;
Bool flag;
source >> vali >> flag;
casacore::ByteSource::ByteSource
ByteSource()
Default constructor.
casacore::CanonicalIO
Definition CanonicalIO.h:72
casacore::RegularFileIO
Definition RegularFileIO.h:80
casacore::Int
int Int
Definition aipstype.h:48
casacore::Bool
bool Bool
Define the standard types used by Casacore.
Definition aipstype.h:40

### Motivation

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

Definition at line 89 of file ByteSource.h.

## Constructor & Destructor Documentation

## ByteSource() [1/3]

casacore::ByteSource::ByteSource | ( |  | ) |

Default constructor.

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

Referenced by ByteSource(), operator=(), operator>>(), operator>>(), operator>>(), operator>>(), operator>>(), operator>>(), operator>>(), operator>>(), operator>>(), operator>>(), operator>>(), operator>>(), operator>>(), and operator>>().

## ByteSource() [2/3]

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

## ByteSource() [3/3]

casacore::ByteSource::ByteSource | ( | const ByteSource & | source | ) |

The copy constructor uses reference semantics.

References ByteSource().

## ~ByteSource()

casacore::ByteSource::~ByteSource | ( |  | ) |

destructor

## Member Function Documentation

## operator=()

ByteSource & casacore::ByteSource::operator= | ( | const ByteSource & | source | ) |

The assignment operator uses reference semantics.

References ByteSource().

## operator>>() [1/14]

ByteSource & casacore::ByteSource::operator>> | ( | Bool & | value | ) |

These functions read one value of the given type.

If this function does not succeed, an exception will be thrown.

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

## operator>>() [2/14]

ByteSource & casacore::ByteSource::operator>> | ( | Char & | value | ) |

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

## operator>>() [3/14]

ByteSource & casacore::ByteSource::operator>> | ( | Complex & | value | ) |

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

## operator>>() [4/14]

ByteSource & casacore::ByteSource::operator>> | ( | DComplex & | value | ) |

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

## operator>>() [5/14]

ByteSource & casacore::ByteSource::operator>> | ( | Double & | value | ) |

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

## operator>>() [6/14]

ByteSource & casacore::ByteSource::operator>> | ( | Float & | value | ) |

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

## operator>>() [7/14]

ByteSource & casacore::ByteSource::operator>> | ( | Int & | value | ) |

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

## operator>>() [8/14]

ByteSource & casacore::ByteSource::operator>> | ( | Int64 & | value | ) |

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

## operator>>() [9/14]

ByteSource & casacore::ByteSource::operator>> | ( | Short & | value | ) |

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

## operator>>() [10/14]

ByteSource & casacore::ByteSource::operator>> | ( | String & | value | ) |

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

## operator>>() [11/14]

ByteSource & casacore::ByteSource::operator>> | ( | uChar & | value | ) |

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

## operator>>() [12/14]

ByteSource & casacore::ByteSource::operator>> | ( | uInt & | value | ) |

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

## operator>>() [13/14]

ByteSource & casacore::ByteSource::operator>> | ( | uInt64 & | value | ) |

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

## operator>>() [14/14]

ByteSource & casacore::ByteSource::operator>> | ( | uShort & | value | ) |

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

## read() [1/14]

void casacore::ByteSource::read | ( | size_t | nvalues,
|  | Bool * | value )

These functions read multiple values of the given type.

If this function does not succeed, an exception will be thrown.

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

## read() [2/14]

void casacore::ByteSource::read | ( | size_t | nvalues,
|  | Char * | value )

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

## read() [3/14]

void casacore::ByteSource::read | ( | size_t | nvalues,
|  | Complex * | value )

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

## read() [4/14]

void casacore::ByteSource::read | ( | size_t | nvalues,
|  | DComplex * | value )

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

## read() [5/14]

void casacore::ByteSource::read | ( | size_t | nvalues,
|  | Double * | value )

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

## read() [6/14]

void casacore::ByteSource::read | ( | size_t | nvalues,
|  | Float * | value )

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

## read() [7/14]

void casacore::ByteSource::read | ( | size_t | nvalues,
|  | Int * | value )

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

## read() [8/14]

void casacore::ByteSource::read | ( | size_t | nvalues,
|  | Int64 * | value )

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

## read() [9/14]

void casacore::ByteSource::read | ( | size_t | nvalues,
|  | Short * | value )

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

## read() [10/14]

void casacore::ByteSource::read | ( | size_t | nvalues,
|  | String * | value )

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

## read() [11/14]

void casacore::ByteSource::read | ( | size_t | nvalues,
|  | uChar * | value )

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

## read() [12/14]

void casacore::ByteSource::read | ( | size_t | nvalues,
|  | uInt * | value )

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

## read() [13/14]

void casacore::ByteSource::read | ( | size_t | nvalues,
|  | uInt64 * | value )

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

## read() [14/14]

void casacore::ByteSource::read | ( | size_t | nvalues,
|  | uShort * | value )

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

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

- casa/IO/ByteSource.h