1 #ifndef DYSCO_THREADED_DYSCO_COLUMN_H
2 #define DYSCO_THREADED_DYSCO_COLUMN_H
9 #include <condition_variable>
22 namespace dyscostman {
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;
125 virtual void encode(ThreadDataBase *threadData,
134 size_t nChannels)
const = 0;
136 virtual void shutdown() override final;
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,
183 ThreadDataBase *threadUserData);
195 std::unique_ptr<casacore::ScalarColumn<double>>
_timeCol;
A Vector of integers, for indexing into Array<T> objects.
virtual void UnserializeExtraHeader(std::istream &stream) finaloverride
size_t getBitsPerSymbol() const
std::unique_ptr< casacore::ScalarColumn< double > > _timeCol
virtual void Prepare(DyscoDistribution distribution, Normalization normalization, double studentsTNu, double distributionTruncation) override
void putValues(casacore::rownr_t rowNr, const casacore::Array< data_t > *dataPtr)
virtual void shutdown() overridefinal
To be called before destructing the class.
virtual size_t CalculateBlockSize(size_t nRowsInBlock, size_t nAntennae) const finaloverride
Non-templated base class for templated Array class.
virtual void setShapeColumn(const casacore::IPosition &shape) override
Set the dimensions of values in this column.
casacore::IPosition _shape
ao::uvector< unsigned char > _packedBlockReadBuffer
virtual void getArrayV(casacore::rownr_t rowNr, casacore::ArrayBase &dataPtr) override
Read the values for a particular row.
const casacore::IPosition & shape() const
virtual void putArrayV(casacore::rownr_t rowNr, const casacore::ArrayBase &dataPtr) override
Write values into a particular row.
std::unique_ptr< casacore::ScalarColumn< int > > _ant1Col
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.
virtual size_t symbolCount(size_t nRowsInBlock, size_t nPolarizations, size_t nChannels) const =0
size_t maxCacheSize() const
virtual ~ThreadDataBase()
std::unique_ptr< casacore::ScalarColumn< int > > _fieldCol
virtual void getArrayV(rownr_t rownr, ArrayBase &dataPtr)
Get the array value in the given row.
virtual void Serialize(std::ostream &stream) const override
ThreadedDyscoColumn * parent
void SetBitsPerSymbol(unsigned bitsPerSymbol)
Set the bits per symbol.
virtual casacore::IPosition shape(casacore::rownr_t) override
Get the dimensions of the values in a particular row.
bool _isCurrentBlockChanged
CacheItem(std::unique_ptr< TimeBlockBuffer< data_t >> &&encoder_)
virtual ~ThreadedDyscoColumn()
Destructor.
static uint32_t UnserializeUInt32(std::istream &stream)
virtual void initializeDecode(TimeBlockBuffer< data_t > *buffer, const float *metaBuffer, size_t nRow, size_t nAntennae)=0
std::condition_variable _cacheChangedCondition
static void SerializeToUInt32(std::ostream &stream, T value)
virtual void encode(ThreadDataBase *threadData, TimeBlockBuffer< data_t > *buffer, float *metaBuffer, symbol_t *symbolBuffer, size_t nAntennae)=0
std::unique_ptr< casacore::ScalarColumn< int > > _dataDescIdCol
void loadBlock(size_t blockIndex)
virtual size_t ExtraHeaderSize() const override
Get number of bytes needed for column header of this column.
virtual void decode(TimeBlockBuffer< data_t > *buffer, const symbol_t *data, size_t blockRow, size_t a1, size_t a2)=0
size_t nRowsInBlock() const
Base class for columns of the DyscoStMan.
virtual void putArrayV(rownr_t rownr, const ArrayBase &data)
Put the array value into the given row.
A templated N-D Array class with zero origin. Array<T, Alloc> is a templated, N-dimensional, Array class. The origin is zero, but by default indices are zero-based. This Array class is the base class for the Vector, Matrix, and Cube subclasses.
bool isWriteItemAvailable(typename cache_t::iterator &i)
virtual void Unserialize(std::istream &stream) override
virtual size_t metaDataFloatCount(size_t nRow, size_t nPolarizations, size_t nChannels, size_t nAntennae) const =0
uInt64 rownr_t
Define the type of a row number in a table.
void getValues(casacore::rownr_t rowNr, casacore::Array< data_t > *dataPtr)
TimeBlockBuffer< data_t >::symbol_t symbol_t
std::map< size_t, CacheItem * > cache_t
std::unique_ptr< casacore::ScalarColumn< int > > _ant2Col
void encodeAndWrite(size_t blockIndex, const CacheItem &item, unsigned char *packedSymbolBuffer, unsigned int *unpackedSymbolBuffer, ThreadDataBase *threadUserData)
int _lastWrittenDataDescId
virtual void SerializeExtraHeader(std::ostream &stream) const finaloverride
void operator=(const ThreadedDyscoColumn &source)=delete
virtual std::unique_ptr< ThreadDataBase > initializeEncodeThread()=0
ThreadedDyscoColumn(DyscoStMan *parent, int dtype)
Create a new column.
std::unique_ptr< TimeBlockBuffer< data_t > > encoder
ao::uvector< unsigned int > _unpackedSymbolReadBuffer
std::unique_ptr< TimeBlockBuffer< data_t > > _timeBlockBuffer
virtual size_t defaultThreadCount() const
The main class for the Dysco storage manager.