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 }
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.
The copy constructor uses reference semantics
The assignment operator uses reference semantics