Go to the documentation of this file.
28 #ifndef CASA_MULTIFILEBASE_H
29 #define CASA_MULTIFILEBASE_H
32 #include <casacore/casa/aips.h>
33 #include <casacore/casa/IO/ByteIO.h>
34 #include <casacore/casa/BasicSL/String.h>
35 #include <casacore/casa/Utilities/CountedPtr.h>
36 #include <casacore/casa/vector.h>
37 #include <casacore/casa/ostream.h>
89 std::shared_ptr<MultiFileBuffer>
buffer;
237 const vector<MultiFileInfo>&
info()
const
268 const void* buffer) = 0;
virtual void reopenRW()=0
Reopen the underlying file for read/write access.
Int64 blockSize() const
Get the block size used.
Bool useODirect() const
Will O_DIRECT be used?
virtual ~MultiFileBase()
The destructor flushes and closes the file.
void resync()
Resync with another process by clearing the buffers and rereading the header.
AipsIO is the object persistency mechanism of Casacore
Helper class for MultiFileBase containing info per internal file.
Int64 write(Int fileId, const void *buffer, Int64 size, Int64 offset)
Write a block at the given offset.
Referenced counted pointer for constant data.
MultiFileBuffer(const MultiFileBuffer &)
std::shared_ptr< MultiFileBuffer > buffer
Int fileId(const String &name, Bool throwExcp=True) const
Return the file id of a file in the MultiFileBase object.
std::shared_ptr< MultiFileBuffer > itsBuffer
virtual void close()=0
Flush and close the file.
void allocBuffer(Int64 bufSize, Bool useODirect=False)
Allocate the buffer.
void flush()
Flush the file by writing all dirty data and all header info.
virtual void flushFile()=0
Flush the file itself.
CountedPtr< HDF5DataSet > dataSet
AipsIO & operator>>(AipsIO &os, Record &rec)
CountedPtr< HDF5Group > group
vector< MultiFileInfo > itsInfo
MultiFileBuffer(size_t bufSize, Bool useODirect)
uInt nfile() const
Get the nr of virtual files.
Abstract base class to combine multiple files in a single one.
void setNewFile()
Set the flags and blockSize for a new MultiFile/HDF5.
virtual void readBlock(MultiFileInfo &info, Int64 blknr, void *buffer)=0
Read a data block.
void deleteFile(Int fileId)
Delete a file.
virtual void doDeleteFile(MultiFileInfo &)=0
Do the class-specific actions on deleting a file.
virtual void writeHeader()=0
Write the header info.
MultiFileBuffer & operator=(const MultiFileBuffer &)
Int addFile(const String &name)
Add a file to the MultiFileBase object.
this file contains all the compiler specific defines
virtual void fsync()=0
Fsync the file (i.e., force the data to be physically written).
Int64 read(Int fileId, void *buffer, Int64 size, Int64 offset)
Read a block at the given offset.
void writeDirty(MultiFileInfo &info)
MultiFileInfo(Int64 bufSize=0, Bool useODirect=False)
Initialize the object and create the buffer with the proper size.
Bool isWritable() const
Is the file writable?
long long Int64
Define the extra non-standard types used by Casacore (like proposed uSize, Size)
virtual void extend(MultiFileInfo &info, Int64 lastblk)=0
Extend the virtual file to fit lastblk.
MultiFileBase(const String &name, Int blockSize, Bool useODirect)
Open or create a MultiFileBase with the given name.
String: the storage and methods of handling collections of characters.
vector< Int64 > itsFreeBlocks
bool Bool
Define the standard types used by Casacore.
Helper class for MultiFileInfo holding a data buffer.
ostream & operator<<(ostream &os, const IComplex &)
Show on ostream.
Int64 size() const
Get the total nr of data blocks used.
virtual void doAddFile(MultiFileInfo &)=0
Do the class-specific actions on adding a file.
const vector< Int64 > & freeBlocks() const
Get the free blocks (for test purposes mainly).
String fileName() const
Get the file name of the MultiFileBase.
virtual void readHeader(Bool always=True)=0
Read the header info.
const vector< MultiFileInfo > & info() const
Get the info object (for test purposes mainly).
virtual void writeBlock(MultiFileInfo &info, Int64 blknr, const void *buffer)=0
Write a data block.