Class for read/write access to data in a given format. More...
#include <ByteSinkSource.h>
Public Member Functions | |
| ByteSinkSource () | |
| Default constructor. | |
| ByteSinkSource (TypeIO *typeIO, Bool takeOver=False) | |
| 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 () | |
Class for read/write access to data in a given format.
Public interface
This class combines ByteSink and ByteSource.
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).
main
{
Bool valb = True;
RegularFileIO regularFileIO ("test.dat", ByteIO::New);
CanonicalIO canonicalIO(®ularFileIO);
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
}
This class makes it transparant to do IO with different devices and in different ways.
Definition at line 92 of file ByteSinkSource.h.
| casacore::ByteSinkSource::ByteSinkSource | ( | ) |
Default constructor.
This creates an invalid object, but is present for convenience.
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::ByteSinkSource::ByteSinkSource | ( | const ByteSinkSource & | sinkSource | ) |
The copy constructor uses reference semantics.
| casacore::ByteSinkSource::~ByteSinkSource | ( | ) |
| ByteSinkSource& casacore::ByteSinkSource::operator= | ( | const ByteSinkSource & | sinkSource | ) |
The assignment operator uses reference semantics.
Reimplemented from casacore::ByteSink.
1.6.1