Loading...
Searching...
No Matches
dyscostmancol.h
Go to the documentation of this file.
#ifndef DYSCO_STORAGE_MAN_COLUMN_H
#define DYSCO_STORAGE_MAN_COLUMN_H
#include "dyscodistribution.h"
#include "dysconormalization.h"
#include <casacore/tables/DataMan/StManColumnBase.h>
#include <casa/Arrays/IPosition.h>
#include <cstdint>
#include <map>
namespace dyscostman {
class DyscoStMan;
class DyscoStManColumn : public casacore::StManColumnBase {
public:
explicit DyscoStManColumn(DyscoStMan *parent, int dtype)
: casacore::StManColumnBase(dtype),
_offsetInBlock(0),
_storageManager(parent) {}
virtual ~DyscoStManColumn() {}
virtual void shutdown() = 0;
virtual casacore::Bool isWritable() const override { return true; }
virtual void Prepare(DyscoDistribution distribution,
Normalization normalization, double studentsTNu,
double distributionTruncation) = 0;
virtual void InitializeAfterNRowsPerBlockIsKnown() = 0;
virtual size_t CalculateBlockSize(size_t nRowsInBlock,
size_t nAntennae) const = 0;
virtual size_t ExtraHeaderSize() const { return 0; }
virtual void SerializeExtraHeader(std::ostream &stream) const = 0;
virtual void UnserializeExtraHeader(std::istream &stream) = 0;
size_t OffsetInBlock() const { return _offsetInBlock; }
void SetOffsetInBlock(size_t offsetInBlock) {
_offsetInBlock = offsetInBlock;
}
protected:
DyscoStMan &storageManager() const { return *_storageManager; }
void readCompressedData(size_t blockIndex, unsigned char *dest, size_t size);
void writeCompressedData(size_t blockIndex, const unsigned char *data,
size_t size);
uint64_t nBlocksInFile() const;
size_t getBlockIndex(uint64_t row) const;
size_t getRowWithinBlock(uint64_t row) const;
size_t nRowsInBlock() const;
size_t nAntennae() const;
uint64_t getRowIndex(size_t block) const;
bool areOffsetsInitialized() const;
void initializeRowsPerBlock(size_t rowsPerBlock, size_t antennaCount);
private:
DyscoStManColumn(const DyscoStManColumn &source) = delete;
void operator=(const DyscoStManColumn &source) = delete;
size_t _offsetInBlock;
DyscoStMan *_storageManager;
};
} // namespace dyscostman
#include "dyscostman.h"
namespace dyscostman {
inline void DyscoStManColumn::readCompressedData(size_t blockIndex,
unsigned char *dest,
size_t size) {
_storageManager->readCompressedData(blockIndex, this, dest, size);
}
inline void DyscoStManColumn::writeCompressedData(size_t blockIndex,
const unsigned char *data,
size_t size) {
_storageManager->writeCompressedData(blockIndex, this, data, size);
}
inline uint64_t DyscoStManColumn::nBlocksInFile() const {
return _storageManager->nBlocksInFile();
}
inline size_t DyscoStManColumn::getBlockIndex(uint64_t row) const {
return _storageManager->getBlockIndex(row);
}
inline size_t DyscoStManColumn::nRowsInBlock() const {
return _storageManager->nRowsInBlock();
}
inline size_t DyscoStManColumn::nAntennae() const {
return _storageManager->nAntennae();
}
inline uint64_t DyscoStManColumn::getRowIndex(size_t block) const {
return _storageManager->getRowIndex(block);
}
inline size_t DyscoStManColumn::getRowWithinBlock(uint64_t rowIndex) const {
return _storageManager->getRowWithinBlock(rowIndex);
}
inline bool DyscoStManColumn::areOffsetsInitialized() const {
return _storageManager->areOffsetsInitialized();
}
inline void DyscoStManColumn::initializeRowsPerBlock(size_t rowsPerBlock,
size_t antennaCount) {
_storageManager->initializeRowsPerBlock(rowsPerBlock, antennaCount, true);
}
} // namespace dyscostman
#endif
IPosition.h
casacore::StManColumnBase
Definition StManColumnBase.h:69
casacore::StManColumnBase::StManColumnBase
StManColumnBase(int dataType)
Default constructor.
casacore::StManColumnBase::dtype
DataType dtype() const
Definition StManColumnBase.h:90
dyscostman::DyscoStManColumn::_storageManager
DyscoStMan * _storageManager
Definition dyscostmancol.h:117
dyscostman::DyscoStManColumn::InitializeAfterNRowsPerBlockIsKnown
virtual void InitializeAfterNRowsPerBlockIsKnown()=0
dyscostman::DyscoStManColumn::writeCompressedData
void writeCompressedData(size_t blockIndex, const unsigned char *data, size_t size)
Write a row of compressed data to the stman file.
Definition dyscostmancol.h:132
dyscostman::DyscoStManColumn::getRowIndex
uint64_t getRowIndex(size_t block) const
Definition dyscostmancol.h:154
dyscostman::DyscoStManColumn::nBlocksInFile
uint64_t nBlocksInFile() const
Get the actual number of blocks in the file.
Definition dyscostmancol.h:138
dyscostman::DyscoStManColumn::CalculateBlockSize
virtual size_t CalculateBlockSize(size_t nRowsInBlock, size_t nAntennae) const =0
dyscostman::DyscoStManColumn::SerializeExtraHeader
virtual void SerializeExtraHeader(std::ostream &stream) const =0
dyscostman::DyscoStManColumn::operator=
void operator=(const DyscoStManColumn &source)=delete
dyscostman::DyscoStManColumn::ExtraHeaderSize
virtual size_t ExtraHeaderSize() const
Get number of bytes needed for column header of this column.
Definition dyscostmancol.h:60
dyscostman::DyscoStManColumn::areOffsetsInitialized
bool areOffsetsInitialized() const
Definition dyscostmancol.h:162
dyscostman::DyscoStManColumn::readCompressedData
void readCompressedData(size_t blockIndex, unsigned char *dest, size_t size)
Read a row of compressed data from the stman file.
Definition dyscostmancol.h:126
dyscostman::DyscoStManColumn::_offsetInBlock
size_t _offsetInBlock
Definition dyscostmancol.h:116
dyscostman::DyscoStManColumn::getRowWithinBlock
size_t getRowWithinBlock(uint64_t row) const
Definition dyscostmancol.h:158
dyscostman::DyscoStManColumn::SetOffsetInBlock
void SetOffsetInBlock(size_t offsetInBlock)
Definition dyscostmancol.h:68
dyscostman::DyscoStManColumn::Prepare
virtual void Prepare(DyscoDistribution distribution, Normalization normalization, double studentsTNu, double distributionTruncation)=0
dyscostman::DyscoStManColumn::DyscoStManColumn
DyscoStManColumn(const DyscoStManColumn &source)=delete
dyscostman::DyscoStManColumn::isWritable
virtual casacore::Bool isWritable() const override
Whether this column is writable.
Definition dyscostmancol.h:44
dyscostman::DyscoStManColumn::~DyscoStManColumn
virtual ~DyscoStManColumn()
Destructor.
Definition dyscostmancol.h:35
dyscostman::DyscoStManColumn::DyscoStManColumn
DyscoStManColumn(DyscoStMan *parent, int dtype)
Constructor, to be overloaded by subclass.
Definition dyscostmancol.h:29
dyscostman::DyscoStManColumn::UnserializeExtraHeader
virtual void UnserializeExtraHeader(std::istream &stream)=0
dyscostman::DyscoStManColumn::shutdown
virtual void shutdown()=0
To be called before destructing the class.
dyscostman::DyscoStManColumn::storageManager
DyscoStMan & storageManager() const
Get the storage manager for this column.
Definition dyscostmancol.h:74
dyscostman::DyscoStManColumn::initializeRowsPerBlock
void initializeRowsPerBlock(size_t rowsPerBlock, size_t antennaCount)
Definition dyscostmancol.h:166
dyscostman::DyscoStManColumn::OffsetInBlock
size_t OffsetInBlock() const
Definition dyscostmancol.h:66
dyscostman::DyscoStManColumn::nAntennae
size_t nAntennae() const
Definition dyscostmancol.h:150
dyscostman::DyscoStManColumn::getBlockIndex
size_t getBlockIndex(uint64_t row) const
Definition dyscostmancol.h:142
dyscostman::DyscoStManColumn::nRowsInBlock
size_t nRowsInBlock() const
Definition dyscostmancol.h:146
dyscostman::DyscoStMan
The main class for the Dysco storage manager.
Definition dyscostman.h:46
dyscodistribution.h
dysconormalization.h
dyscostman.h
Contains DyscoStMan and its global register function register_dyscostman().
casacore
this file contains all the compiler specific defines
Definition mainpage.dox:28
casacore::Bool
bool Bool
Define the standard types used by Casacore.
Definition aipstype.h:40
dyscostman
Definition bytepacker.h:7
dyscostman::Normalization
Normalization
Definition dysconormalization.h:5
dyscostman::DyscoDistribution
DyscoDistribution
Definition dyscodistribution.h:5