1 #ifndef DYSCO_THREADED_DYSCO_COLUMN_H
2 #define DYSCO_THREADED_DYSCO_COLUMN_H
4 #include <casacore/tables/DataMan/DataManError.h>
6 #include <casacore/casa/Arrays/IPosition.h>
7 #include <casacore/tables/Tables/ScalarColumn.h>
9 #include <condition_variable>
31 template <
typename DataType>
84 double distributionTruncation)
override;
117 const float *metaBuffer,
size_t nRow,
121 size_t blockRow,
size_t a1,
size_t a2) = 0;
134 size_t nChannels)
const = 0;
149 std::unique_ptr<TimeBlockBuffer<data_t>>
encoder;
161 static uint32_t
Size() {
return 8; }
163 virtual void Serialize(std::ostream &stream)
const override {
174 typedef std::map<size_t, CacheItem *>
cache_t;
181 unsigned char *packedSymbolBuffer,
182 unsigned int *unpackedSymbolBuffer,
195 std::unique_ptr<casacore::ScalarColumn<double>>
_timeCol;
static uint32_t UnserializeUInt32(std::istream &stream)
static void SerializeToUInt32(std::ostream &stream, T value)
Non-templated base class for templated Array class.
virtual void putArrayV(rownr_t rownr, const ArrayBase &data)
Put the array value into the given row.
virtual void getArrayV(rownr_t rownr, ArrayBase &dataPtr)
Get the array value in the given row.
Base class for columns of the DyscoStMan.
size_t nRowsInBlock() const
The main class for the Dysco storage manager.
virtual ~ThreadDataBase()
A column for storing compressed values in a threaded way, tailored for the data and weight columns th...
virtual void InitializeAfterNRowsPerBlockIsKnown() override
Prepare this column for reading/writing.
TimeBlockBuffer< data_t >::symbol_t symbol_t
std::unique_ptr< TimeBlockBuffer< data_t > > _timeBlockBuffer
std::map< size_t, CacheItem * > cache_t
virtual ~ThreadedDyscoColumn()
Destructor.
std::condition_variable _cacheChangedCondition
virtual void encode(ThreadDataBase *threadData, TimeBlockBuffer< data_t > *buffer, float *metaBuffer, symbol_t *symbolBuffer, size_t nAntennae)=0
virtual void setShapeColumn(const casacore::IPosition &shape) override
Set the dimensions of values in this column.
bool isWriteItemAvailable(typename cache_t::iterator &i)
void getValues(casacore::rownr_t rowNr, casacore::Array< data_t > *dataPtr)
std::unique_ptr< casacore::ScalarColumn< int > > _fieldCol
std::unique_ptr< casacore::ScalarColumn< int > > _dataDescIdCol
ThreadedDyscoColumn(DyscoStMan *parent, int dtype)
Create a new column.
virtual void Prepare(DyscoDistribution distribution, Normalization normalization, double studentsTNu, double distributionTruncation) override
virtual size_t CalculateBlockSize(size_t nRowsInBlock, size_t nAntennae) const final override
virtual size_t symbolCount(size_t nRowsInBlock, size_t nPolarizations, size_t nChannels) const =0
const casacore::IPosition & shape() const
ThreadedDyscoColumn(const ThreadedDyscoColumn &source)=delete
void SetBitsPerSymbol(unsigned bitsPerSymbol)
Set the bits per symbol.
virtual void decode(TimeBlockBuffer< data_t > *buffer, const symbol_t *data, size_t blockRow, size_t a1, size_t a2)=0
virtual void UnserializeExtraHeader(std::istream &stream) final override
ao::uvector< unsigned char > _packedBlockReadBuffer
virtual std::unique_ptr< ThreadDataBase > initializeEncodeThread()=0
size_t getBitsPerSymbol() const
void operator=(const ThreadedDyscoColumn &source)=delete
void putValues(casacore::rownr_t rowNr, const casacore::Array< data_t > *dataPtr)
virtual void initializeDecode(TimeBlockBuffer< data_t > *buffer, const float *metaBuffer, size_t nRow, size_t nAntennae)=0
std::unique_ptr< casacore::ScalarColumn< int > > _ant2Col
virtual size_t defaultThreadCount() const
std::unique_ptr< casacore::ScalarColumn< int > > _ant1Col
virtual casacore::IPosition shape(casacore::rownr_t) override
Get the dimensions of the values in a particular row.
virtual void shutdown() override final
To be called before destructing the class.
virtual size_t ExtraHeaderSize() const override
Get number of bytes needed for column header of this column.
void loadBlock(size_t blockIndex)
int _lastWrittenDataDescId
size_t maxCacheSize() const
virtual size_t metaDataFloatCount(size_t nRow, size_t nPolarizations, size_t nChannels, size_t nAntennae) const =0
virtual void putArrayV(casacore::rownr_t rowNr, const casacore::ArrayBase &dataPtr) override
Write values into a particular row.
std::unique_ptr< casacore::ScalarColumn< double > > _timeCol
ao::uvector< unsigned int > _unpackedSymbolReadBuffer
bool _isCurrentBlockChanged
virtual void getArrayV(casacore::rownr_t rowNr, casacore::ArrayBase &dataPtr) override
Read the values for a particular row.
void encodeAndWrite(size_t blockIndex, const CacheItem &item, unsigned char *packedSymbolBuffer, unsigned int *unpackedSymbolBuffer, ThreadDataBase *threadUserData)
casacore::IPosition _shape
virtual void SerializeExtraHeader(std::ostream &stream) const final override
uInt64 rownr_t
Define the type of a row number in a table.
Define real & complex conjugation for non-complex types and put comparisons into std namespace.
CacheItem(std::unique_ptr< TimeBlockBuffer< data_t >> &&encoder_)
std::unique_ptr< TimeBlockBuffer< data_t > > encoder
ThreadedDyscoColumn * parent
virtual void Serialize(std::ostream &stream) const override
virtual void Unserialize(std::istream &stream) override