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