1 #ifndef DYSCO_STORAGE_MANAGER_H
2 #define DYSCO_STORAGE_MANAGER_H
28 #ifndef DOXYGEN_SHOULD_SKIP_THIS
32 #ifndef DOXYGEN_SHOULD_SKIP_THIS
39 namespace dyscostman {
41 class DyscoStManColumn;
59 DyscoStMan(
unsigned dataBitRate,
unsigned weightBitRate,
240 std::lock_guard<std::mutex> lock(
_mutex);
313 unsigned char *dest,
size_t size);
316 const unsigned char *data,
size_t size);
348 const casacore::String &name,
int dataType,
349 const casacore::String &dataTypeID) final override;
353 const casacore::String &name,
int dataType,
354 const casacore::String &dataTypeID) final override;
358 const casacore::String &name,
int dataType,
359 const casacore::String &dataTypeID) final override;
369 virtual
void prepare() final override;
372 virtual
void reopenRW() final override;
381 virtual
void addColumn(casacore::DataManagerColumn *) final override;
384 virtual
void removeColumn(casacore::DataManagerColumn *) final override;
virtual casacore::Bool canRemoveColumn() const finaloverride
Whether columns can be removed.
virtual casacore::DataManagerColumn * makeScalarColumn(const casacore::String &name, int dataType, const casacore::String &dataTypeID) finaloverride
Create a column in the storage manager on behalf of a table column.
double _distributionTruncation
void SetStaticSeed(bool staticSeed)
virtual void prepare() finaloverride
Prepare the columns, let the data manager initialize itself further.
std::unique_ptr< std::fstream > _fStream
void readCompressedData(size_t blockIndex, const DyscoStManColumn *column, unsigned char *dest, size_t size)
virtual casacore::Record dataManagerSpec() const finaloverride
Get manager specifications.
AipsIO is the object persistency mechanism of Casacore.
size_t getBlockIndex(uint64_t row) const
Return index of block that contains the given measurement set row.
virtual casacore::Bool canRemoveRow() const finaloverride
Whether rows can be removed.
uint getNRow() const
Get the number of rows in the measurement set.
void register_dyscostman()
void SetStudentsTDistribution(double nu)
Initialize the storage manager to use a Student T distribution for the quantization (i...
static const unsigned short VERSION_MINOR
virtual casacore::Bool canAddRow() const finaloverride
Whether rows can be added.
DyscoDistribution _distribution
size_t nRowsInBlock() const
Number of rows in one "time-block", i.e.
size_t nAntennae() const
Number of antennae used in a time block.
void SetNormalization(Normalization normalization)
Set the type of normalization.
virtual void addRow64(casacore::rownr_t nrrow) finaloverride
Add rows to the storage manager.
void SetTruncatedGaussianDistribution(double truncationSigma)
Initialize the storage manager to use a Uniform distribution for the quantization (i...
size_t getRowWithinBlock(uint64_t row) const
Return the offset of the row within the block.
virtual casacore::rownr_t resync64(casacore::rownr_t nRow) finaloverride
uint64_t getRowIndex(size_t block) const
Calculate first measurement set row index of a given block index.
virtual casacore::rownr_t open64(casacore::rownr_t nRow, casacore::AipsIO &) finaloverride
Open the storage manager file for an existing table.
void SetGaussianDistribution()
Initialize the storage manager to use a Gaussian distribution for the quantization.
virtual void reopenRW() finaloverride
Reopen the storage manager files for read/write.
void writeCompressedData(size_t blockIndex, const DyscoStManColumn *column, const unsigned char *data, size_t size)
virtual casacore::Bool flush(casacore::AipsIO &, casacore::Bool doFsync) finaloverride
Flush and optionally fsync the data.
virtual void create64(casacore::rownr_t nRow) finaloverride
Let the storage manager create files as needed for a new table.
Normalization _normalization
static const unsigned short VERSION_MAJOR
virtual void deleteManager() finaloverride
The data manager will be deleted (because all its columns are requested to be deleted).
A hierarchical collection of named fields of various types.
uint64_t nBlocksInFile() const
The number of rows that are actually stored in the file.
bool Bool
Define the standard types used by Casacore.
Base class for columns of the DyscoStMan.
virtual void removeColumn(casacore::DataManagerColumn *) finaloverride
Remove a column from the data file.
Header file for uvector and its relational and swap functions.
virtual casacore::String dataManagerType() const finaloverride
Type of manager.
void SetUniformDistribution()
Initialize the storage manager to use a Uniform distribution for the quantization (i...
size_t getFileOffset(size_t blockIndex) const
DyscoStMan(unsigned dataBitRate, unsigned weightBitRate, const casacore::String &name="DyscoStMan")
Convenience constructor to create a new storage manager with some settings without having to fill a '...
bool areOffsetsInitialized() const
This method returns true when the number of rows per block and the number of antennae per block are k...
uInt64 rownr_t
Define the type of a row number in a table.
virtual casacore::DataManagerColumn * makeDirArrColumn(const casacore::String &name, int dataType, const casacore::String &dataTypeID) finaloverride
Create a direct array column.
virtual void addColumn(casacore::DataManagerColumn *) finaloverride
Do the final addition of a column.
static casacore::DataManager * makeObject(const casacore::String &name, const casacore::Record &spec)
Create an object with given name and spec.
Abstract base class for a data manager.
std::vector< std::unique_ptr< DyscoStManColumn > > _columns
String: the storage and methods of handling collections of characters.
virtual casacore::DataManagerColumn * makeIndArrColumn(const casacore::String &name, int dataType, const casacore::String &dataTypeID) finaloverride
Create an indirect array column.
static void registerClass()
This function makes the DyscoStMan known to casacore.
void setFromSpec(const casacore::Record &spec)
virtual void removeRow64(casacore::rownr_t rowNr) finaloverride
Delete a row from all columns.
virtual casacore::Bool canAddColumn() const finaloverride
Whether columns can be added.
DyscoStMan & operator=(const DyscoStMan &source)=delete
Assignment – new dyscostman takes the settings of the source (but not the columns and/or data)...
virtual casacore::String dataManagerName() const finaloverride
Returns the name of this manager as specified during construction.
void initializeRowsPerBlock(size_t rowsPerBlock, size_t antennaCount, bool writeToHeader)
To be called by a column once it determines rowsPerBlock and antennaCount.
virtual casacore::DataManager * clone() const finaloverride
Polymorphical copy constructor, equal to DyscoStMan(const DyscoStMan&).
The main class for the Dysco storage manager.