Class for IO on a regular file. More...
#include <RegularFileIO.h>
Public Member Functions | |
RegularFileIO (const RegularFile ®ularFile, ByteIO::OpenOption=ByteIO::Old, uInt filebufSize=0) | |
Create an IO stream object for a regular file with the given name. | |
~RegularFileIO () | |
virtual void | reopenRW () |
Reopen the underlying file for read/write access. | |
virtual String | fileName () const |
Get the file name of the file attached. | |
Static Public Member Functions | |
static int | openCreate (const RegularFile &file, ByteIO::OpenOption) |
Convenience function to open or create a file. | |
Private Member Functions | |
RegularFileIO (const RegularFileIO &that) | |
Copy constructor, should not be used. | |
RegularFileIO & | operator= (const RegularFileIO &that) |
Assignment, should not be used. | |
Private Attributes | |
OpenOption | itsOption |
RegularFile | itsRegularFile |
Class for IO on a regular file.
Public interface
This class is a specialization of class ByteIO . It uses a regular file as the data store.
The class is derived from FilebufIO , which contains all functions to access the file. The description of this class explains the use of the filebufSize
argument in the constructor.
// Create a file (which should not exist yet). RegularFileIO regio (RegularFile("file.name"), ByteIO::NewNoReplace); // Use that as the sink of AipsIO. AipsIO stream (®io); // Write values. stream << (Int)10; stream << True; // Seek to beginning of file and read data in. stream.setpos (0); Int vali; Bool valb; stream >> vali >> valb;
Definition at line 81 of file RegularFileIO.h.
casacore::RegularFileIO::RegularFileIO | ( | const RegularFile & | regularFile, | |
ByteIO::OpenOption | = ByteIO::Old , |
|||
uInt | filebufSize = 0 | |||
) | [explicit] |
Create an IO stream object for a regular file with the given name.
The ByteIO option determines if the file will be created or opened for input and/or output.
The argument filebufSize
defines the length of the internal buffer in the underlying FilebufIO object. A zero length uses an appropriate default.
casacore::RegularFileIO::~RegularFileIO | ( | ) |
casacore::RegularFileIO::RegularFileIO | ( | const RegularFileIO & | that | ) | [private] |
Copy constructor, should not be used.
virtual String casacore::RegularFileIO::fileName | ( | ) | const [virtual] |
Get the file name of the file attached.
Reimplemented from casacore::FilebufIO.
static int casacore::RegularFileIO::openCreate | ( | const RegularFile & | file, | |
ByteIO::OpenOption | ||||
) | [static] |
RegularFileIO& casacore::RegularFileIO::operator= | ( | const RegularFileIO & | that | ) | [private] |
Assignment, should not be used.
Reimplemented from casacore::FilebufIO.
virtual void casacore::RegularFileIO::reopenRW | ( | ) | [virtual] |
Reopen the underlying file for read/write access.
Nothing will be done if the stream is writable already. Otherwise it will be reopened and an exception will be thrown if it is not possible to reopen it for read/write access.
Reimplemented from casacore::ByteIO.
OpenOption casacore::RegularFileIO::itsOption [private] |
Definition at line 112 of file RegularFileIO.h.
Definition at line 113 of file RegularFileIO.h.