casacore
|
A column for storing compressed values in a threaded way, tailored for the data and weight columns that use a threaded approach for encoding. More...
#include <threadeddyscocolumn.h>
Classes | |
struct | CacheItem |
struct | EncodingThreadFunctor |
struct | Header |
class | ThreadDataBase |
Public Types | |
typedef DataType | data_t |
Public Member Functions | |
ThreadedDyscoColumn (DyscoStMan *parent, int dtype) | |
Create a new column. More... | |
ThreadedDyscoColumn (const ThreadedDyscoColumn &source)=delete | |
void | operator= (const ThreadedDyscoColumn &source)=delete |
virtual | ~ThreadedDyscoColumn () |
Destructor. More... | |
virtual void | setShapeColumn (const casacore::IPosition &shape) override |
Set the dimensions of values in this column. More... | |
virtual casacore::IPosition | shape (casacore::rownr_t) override |
Get the dimensions of the values in a particular row. More... | |
virtual void | getArrayV (casacore::rownr_t rowNr, casacore::ArrayBase &dataPtr) override |
Read the values for a particular row. More... | |
virtual void | putArrayV (casacore::rownr_t rowNr, const casacore::ArrayBase &dataPtr) override |
Write values into a particular row. More... | |
virtual void | Prepare (DyscoDistribution distribution, Normalization normalization, double studentsTNu, double distributionTruncation) override |
virtual void | InitializeAfterNRowsPerBlockIsKnown () override |
Prepare this column for reading/writing. More... | |
void | SetBitsPerSymbol (unsigned bitsPerSymbol) |
Set the bits per symbol. More... | |
virtual size_t | CalculateBlockSize (size_t nRowsInBlock, size_t nAntennae) const final override |
virtual size_t | ExtraHeaderSize () const override |
Get number of bytes needed for column header of this column. More... | |
virtual void | SerializeExtraHeader (std::ostream &stream) const final override |
virtual void | UnserializeExtraHeader (std::istream &stream) final override |
void | getArrayV (casacore::rownr_t rowNr, casacore::ArrayBase &dataPtr) |
void | putArrayV (casacore::rownr_t rowNr, const casacore::ArrayBase &dataPtr) |
void | getArrayV (casacore::rownr_t rowNr, casacore::ArrayBase &dataPtr) |
void | putArrayV (casacore::rownr_t rowNr, const casacore::ArrayBase &dataPtr) |
![]() | |
DyscoStManColumn (DyscoStMan *parent, int dtype) | |
Constructor, to be overloaded by subclass. More... | |
virtual | ~DyscoStManColumn () |
Destructor. More... | |
virtual casacore::Bool | isWritable () const override |
Whether this column is writable. More... | |
size_t | OffsetInBlock () const |
void | SetOffsetInBlock (size_t offsetInBlock) |
![]() | |
StManColumnBase (int dataType) | |
Default constructor. More... | |
~StManColumnBase () | |
virtual int | dataType () const |
Return the data type of the column. More... | |
DataType | dtype () const |
Int | elemSize () const |
Return the size of an element of the column's data type. More... | |
![]() | |
DataManagerColumn () | |
Create a column. More... | |
virtual | ~DataManagerColumn () |
Frees up the storage. More... | |
void | setIsFixedShape (Bool isFixedShape) |
Set the isFixedShape flag. More... | |
Bool | isFixedShape () const |
Is this a fixed shape column? More... | |
virtual String | dataTypeId () const |
Get the data type id of the column for dataType==TpOther. More... | |
virtual void | setMaxLength (uInt maxLength) |
Set the maximum length of the value (can be used for strings). More... | |
void | setFixedShapeColumn (const IPosition &shape) |
Set the shape of all (fixed-shaped) arrays in the column. More... | |
virtual void | setShape (rownr_t rownr, const IPosition &shape) |
Set the shape of an (variable-shaped) array in the given row. More... | |
virtual void | setShapeTiled (rownr_t rownr, const IPosition &shape, const IPosition &tileShape) |
Set the shape and tile shape of an (variable-shaped) array in the given row. More... | |
virtual Bool | isShapeDefined (rownr_t rownr) |
Is the value shape defined in the given row? By default it returns True. More... | |
virtual uInt | ndim (rownr_t rownr) |
Get the dimensionality of the item in the given row. More... | |
virtual IPosition | shape (rownr_t rownr) |
Get the shape of the item in the given row. More... | |
virtual IPosition | tileShape (rownr_t rownr) |
Get the tile shape of the item in the given row. More... | |
virtual Bool | canChangeShape () const |
Can the data manager handle chaging the shape of an existing array? Default is no. More... | |
ColumnCache & | columnCache () |
Get access to the ColumnCache object. More... | |
const ColumnCache * | columnCachePtr () const |
void | get (rownr_t rownr, Bool *dataPtr) |
Get the scalar value in the given row. More... | |
void | get (rownr_t rownr, uChar *dataPtr) |
void | get (rownr_t rownr, Short *dataPtr) |
void | get (rownr_t rownr, uShort *dataPtr) |
void | get (rownr_t rownr, Int *dataPtr) |
void | get (rownr_t rownr, uInt *dataPtr) |
void | get (rownr_t rownr, Int64 *dataPtr) |
void | get (rownr_t rownr, float *dataPtr) |
void | get (rownr_t rownr, double *dataPtr) |
void | get (rownr_t rownr, Complex *dataPtr) |
void | get (rownr_t rownr, DComplex *dataPtr) |
void | get (rownr_t rownr, String *dataPtr) |
void | get (rownr_t rownr, void *dataPtr) |
This function is the get for all non-standard data types. More... | |
void | put (rownr_t rownr, const Bool *dataPtr) |
Put the scalar value into the given row. More... | |
void | put (rownr_t rownr, const uChar *dataPtr) |
void | put (rownr_t rownr, const Short *dataPtr) |
void | put (rownr_t rownr, const uShort *dataPtr) |
void | put (rownr_t rownr, const Int *dataPtr) |
void | put (rownr_t rownr, const uInt *dataPtr) |
void | put (rownr_t rownr, const Int64 *dataPtr) |
void | put (rownr_t rownr, const float *dataPtr) |
void | put (rownr_t rownr, const double *dataPtr) |
void | put (rownr_t rownr, const Complex *dataPtr) |
void | put (rownr_t rownr, const DComplex *dataPtr) |
void | put (rownr_t rownr, const String *dataPtr) |
void | put (rownr_t rownr, const void *dataPtr) |
This function is the put for all non-standard data types. More... | |
virtual void | getScalarColumnV (ArrayBase &dataPtr) |
Get all scalar values in the column. More... | |
virtual void | putScalarColumnV (const ArrayBase &dataPtr) |
Put all scalar values in the column. More... | |
virtual void | getScalarColumnCellsV (const RefRows &rownrs, ArrayBase &dataPtr) |
Get some scalar values in the column. More... | |
virtual void | putScalarColumnCellsV (const RefRows &rownrs, const ArrayBase &dataPtr) |
Put some scalar values in the column. More... | |
virtual void | getArrayV (rownr_t rownr, ArrayBase &dataPtr) |
Get the array value in the given row. More... | |
virtual void | putArrayV (rownr_t rownr, const ArrayBase &data) |
Put the array value into the given row. More... | |
virtual void | getArrayColumnV (ArrayBase &data) |
Get all array values in the column. More... | |
virtual void | putArrayColumnV (const ArrayBase &data) |
Put all array values in the column. More... | |
virtual void | getArrayColumnCellsV (const RefRows &rownrs, ArrayBase &data) |
Get some array values in the column. More... | |
virtual void | putArrayColumnCellsV (const RefRows &rownrs, const ArrayBase &data) |
Put some array values in the column. More... | |
virtual void | getSliceV (rownr_t rownr, const Slicer &slicer, ArrayBase &data) |
Get a section of the array in the given row. More... | |
virtual void | putSliceV (rownr_t rownr, const Slicer &slicer, const ArrayBase &data) |
Put into a section of the array in the given row. More... | |
virtual void | getColumnSliceV (const Slicer &slicer, ArrayBase &data) |
Get a section of all arrays in the column. More... | |
virtual void | putColumnSliceV (const Slicer &slicer, const ArrayBase &data) |
Put into a section of all arrays in the column. More... | |
virtual void | getColumnSliceCellsV (const RefRows &rownrs, const Slicer &slicer, ArrayBase &data) |
Get a section of some arrays in the column. More... | |
virtual void | putColumnSliceCellsV (const RefRows &rownrs, const Slicer &slicer, const ArrayBase &data) |
Put into a section of some arrays in the column. More... | |
void | throwGet () const |
Throw an "invalid operation" exception for the default implementation of get. More... | |
void | throwPut () const |
Throw an "invalid operation" exception for the default implementation of put. More... | |
void | setColumnName (const String &colName) |
Set the column name. More... | |
const String & | columnName () const |
Get rhe column name. More... | |
Protected Types | |
typedef TimeBlockBuffer< data_t >::symbol_t | symbol_t |
Protected Member Functions | |
virtual void | initializeDecode (TimeBlockBuffer< data_t > *buffer, const float *metaBuffer, size_t nRow, size_t nAntennae)=0 |
virtual void | decode (TimeBlockBuffer< data_t > *buffer, const symbol_t *data, size_t blockRow, size_t a1, size_t a2)=0 |
virtual std::unique_ptr< ThreadDataBase > | initializeEncodeThread ()=0 |
virtual void | encode (ThreadDataBase *threadData, TimeBlockBuffer< data_t > *buffer, float *metaBuffer, symbol_t *symbolBuffer, size_t nAntennae)=0 |
virtual size_t | metaDataFloatCount (size_t nRow, size_t nPolarizations, size_t nChannels, size_t nAntennae) const =0 |
virtual size_t | symbolCount (size_t nRowsInBlock, size_t nPolarizations, size_t nChannels) const =0 |
virtual void | shutdown () override final |
To be called before destructing the class. More... | |
virtual size_t | defaultThreadCount () const |
size_t | getBitsPerSymbol () const |
const casacore::IPosition & | shape () const |
![]() | |
DyscoStMan & | storageManager () const |
Get the storage manager for this column. More... | |
void | readCompressedData (size_t blockIndex, unsigned char *dest, size_t size) |
Read a row of compressed data from the stman file. More... | |
void | writeCompressedData (size_t blockIndex, const unsigned char *data, size_t size) |
Write a row of compressed data to the stman file. More... | |
uint64_t | nBlocksInFile () const |
Get the actual number of blocks in the file. More... | |
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) |
![]() | |
virtual void | getBool (rownr_t rownr, Bool *dataPtr) |
Get the scalar value in the given row. More... | |
virtual void | getuChar (rownr_t rownr, uChar *dataPtr) |
virtual void | getShort (rownr_t rownr, Short *dataPtr) |
virtual void | getuShort (rownr_t rownr, uShort *dataPtr) |
virtual void | getInt (rownr_t rownr, Int *dataPtr) |
virtual void | getuInt (rownr_t rownr, uInt *dataPtr) |
virtual void | getInt64 (rownr_t rownr, Int64 *dataPtr) |
virtual void | getfloat (rownr_t rownr, float *dataPtr) |
virtual void | getdouble (rownr_t rownr, double *dataPtr) |
virtual void | getComplex (rownr_t rownr, Complex *dataPtr) |
virtual void | getDComplex (rownr_t rownr, DComplex *dataPtr) |
virtual void | getString (rownr_t rownr, String *dataPtr) |
virtual void | getOther (rownr_t rownr, void *dataPtr) |
This function is the get for all non-standard data types. More... | |
virtual void | putBool (rownr_t rownr, const Bool *dataPtr) |
Put the scalar value into the given row. More... | |
virtual void | putuChar (rownr_t rownr, const uChar *dataPtr) |
virtual void | putShort (rownr_t rownr, const Short *dataPtr) |
virtual void | putuShort (rownr_t rownr, const uShort *dataPtr) |
virtual void | putInt (rownr_t rownr, const Int *dataPtr) |
virtual void | putuInt (rownr_t rownr, const uInt *dataPtr) |
virtual void | putInt64 (rownr_t rownr, const Int64 *dataPtr) |
virtual void | putfloat (rownr_t rownr, const float *dataPtr) |
virtual void | putdouble (rownr_t rownr, const double *dataPtr) |
virtual void | putComplex (rownr_t rownr, const Complex *dataPtr) |
virtual void | putDComplex (rownr_t rownr, const DComplex *dataPtr) |
virtual void | putString (rownr_t rownr, const String *dataPtr) |
virtual void | putOther (rownr_t rownr, const void *dataPtr) |
This function is the put for all non-standard data types. More... | |
void | getScalarColumnBase (ArrayBase &dataPtr) |
The default implementations of get and put functions. More... | |
void | putScalarColumnBase (const ArrayBase &dataPtr) |
void | getScalarColumnCellsBase (const RefRows &rownrs, ArrayBase &dataPtr) |
void | putScalarColumnCellsBase (const RefRows &rownrs, const ArrayBase &dataPtr) |
void | getArrayColumnBase (ArrayBase &data) |
void | putArrayColumnBase (const ArrayBase &data) |
void | getArrayColumnCellsBase (const RefRows &rownrs, ArrayBase &data) |
void | putArrayColumnCellsBase (const RefRows &rownrs, const ArrayBase &data) |
void | getSliceBase (rownr_t rownr, const Slicer &slicer, ArrayBase &data) |
void | putSliceBase (rownr_t rownr, const Slicer &slicer, const ArrayBase &data) |
void | getColumnSliceBase (const Slicer &slicer, ArrayBase &data) |
void | putColumnSliceBase (const Slicer &slicer, const ArrayBase &data) |
void | getColumnSliceCellsBase (const RefRows &rownrs, const Slicer &slicer, ArrayBase &data) |
void | putColumnSliceCellsBase (const RefRows &rownrs, const Slicer &slicer, const ArrayBase &data) |
Private Types | |
typedef std::map< size_t, CacheItem * > | cache_t |
Private Member Functions | |
void | getValues (casacore::rownr_t rowNr, casacore::Array< data_t > *dataPtr) |
void | putValues (casacore::rownr_t rowNr, const casacore::Array< data_t > *dataPtr) |
void | stopThreads () |
void | encodeAndWrite (size_t blockIndex, const CacheItem &item, unsigned char *packedSymbolBuffer, unsigned int *unpackedSymbolBuffer, ThreadDataBase *threadUserData) |
bool | isWriteItemAvailable (typename cache_t::iterator &i) |
void | loadBlock (size_t blockIndex) |
void | storeBlock () |
size_t | maxCacheSize () const |
Private Attributes | |
unsigned | _bitsPerSymbol |
casacore::IPosition | _shape |
std::unique_ptr< casacore::ScalarColumn< int > > | _ant1Col |
std::unique_ptr< casacore::ScalarColumn< int > > | _ant2Col |
std::unique_ptr< casacore::ScalarColumn< int > > | _fieldCol |
std::unique_ptr< casacore::ScalarColumn< int > > | _dataDescIdCol |
std::unique_ptr< casacore::ScalarColumn< double > > | _timeCol |
double | _lastWrittenTime |
int | _lastWrittenField |
int | _lastWrittenDataDescId |
ao::uvector< unsigned char > | _packedBlockReadBuffer |
ao::uvector< unsigned int > | _unpackedSymbolReadBuffer |
cache_t | _cache |
bool | _stopThreads |
std::mutex | _mutex |
threadgroup | _threadGroup |
std::condition_variable | _cacheChangedCondition |
size_t | _currentBlock |
bool | _isCurrentBlockChanged |
size_t | _blockSize |
size_t | _antennaCount |
std::unique_ptr< TimeBlockBuffer< data_t > > | _timeBlockBuffer |
Additional Inherited Members | |
![]() | |
static Bool | isNativeDataType (int dtype) |
Test if the given data type is supported by storage managers. More... | |
A column for storing compressed values in a threaded way, tailored for the data and weight columns that use a threaded approach for encoding.
Definition at line 32 of file threadeddyscocolumn.h.
|
private |
Definition at line 174 of file threadeddyscocolumn.h.
typedef DataType dyscostman::ThreadedDyscoColumn< DataType >::data_t |
Definition at line 34 of file threadeddyscocolumn.h.
|
protected |
Definition at line 114 of file threadeddyscocolumn.h.
dyscostman::ThreadedDyscoColumn< DataType >::ThreadedDyscoColumn | ( | DyscoStMan * | parent, |
int | dtype | ||
) |
Create a new column.
Internally called by DyscoStMan when creating a new column.
|
delete |
|
virtual |
Destructor.
|
finaloverridevirtual |
Implements dyscostman::DyscoStManColumn.
|
protectedpure virtual |
Implemented in dyscostman::DyscoWeightColumn, and dyscostman::DyscoDataColumn.
|
protectedvirtual |
Reimplemented in dyscostman::DyscoDataColumn.
Referenced by dyscostman::ThreadedDyscoColumn< DataType >::maxCacheSize().
|
protectedpure virtual |
Implemented in dyscostman::DyscoWeightColumn, and dyscostman::DyscoDataColumn.
|
private |
|
inlineoverridevirtual |
Get number of bytes needed for column header of this column.
This is excluding the generic column header.
Reimplemented from dyscostman::DyscoStManColumn.
Definition at line 102 of file threadeddyscocolumn.h.
References dyscostman::ThreadedDyscoColumn< DataType >::Header::Size().
|
inline |
Definition at line 214 of file threadeddyscocolumn.h.
|
inline |
Definition at line 224 of file threadeddyscocolumn.h.
|
inlineoverridevirtual |
Read the values for a particular row.
This will read the required data and decode it.
rowNr | The row number to get the values for. |
dataPtr | The array of values, which should be a contiguous array. |
Definition at line 63 of file threadeddyscocolumn.h.
References casacore::DataManagerColumn::getArrayV().
|
inlineprotected |
Definition at line 140 of file threadeddyscocolumn.h.
References dyscostman::ThreadedDyscoColumn< DataType >::_bitsPerSymbol.
|
private |
|
overridevirtual |
Prepare this column for reading/writing.
Used internally by the stman.
Implements dyscostman::DyscoStManColumn.
|
protectedpure virtual |
Implemented in dyscostman::DyscoWeightColumn, and dyscostman::DyscoDataColumn.
|
protectedpure virtual |
Implemented in dyscostman::DyscoWeightColumn, and dyscostman::DyscoDataColumn.
|
private |
|
private |
|
inlineprivate |
Definition at line 187 of file threadeddyscocolumn.h.
References dyscostman::ThreadedDyscoColumn< DataType >::defaultThreadCount().
|
protectedpure virtual |
Implemented in dyscostman::DyscoWeightColumn, and dyscostman::DyscoDataColumn.
|
delete |
|
overridevirtual |
Implements dyscostman::DyscoStManColumn.
Reimplemented in dyscostman::DyscoWeightColumn, and dyscostman::DyscoDataColumn.
|
inline |
Definition at line 219 of file threadeddyscocolumn.h.
|
inline |
Definition at line 229 of file threadeddyscocolumn.h.
|
inlineoverridevirtual |
Write values into a particular row.
This will add the values into the cache and returns immediately afterwards. A pool of threads will encode the items in the cache and write them to disk.
rowNr | The row number to write the values to. |
dataPtr | The data pointer, which should be a contiguous array. |
Definition at line 76 of file threadeddyscocolumn.h.
References casacore::DataManagerColumn::putArrayV().
|
private |
|
finaloverridevirtual |
Implements dyscostman::DyscoStManColumn.
|
inline |
Set the bits per symbol.
Should only be called by DyscoStMan.
bitsPerSymbol | New number of bits per symbol. |
Definition at line 95 of file threadeddyscocolumn.h.
References dyscostman::ThreadedDyscoColumn< DataType >::_bitsPerSymbol.
|
overridevirtual |
Set the dimensions of values in this column.
Reimplemented from casacore::DataManagerColumn.
|
inlineprotected |
Definition at line 142 of file threadeddyscocolumn.h.
References dyscostman::ThreadedDyscoColumn< DataType >::_shape.
|
inlineoverridevirtual |
Get the dimensions of the values in a particular row.
The rownr parameter is not used as the shape is the same for all rows.
Definition at line 53 of file threadeddyscocolumn.h.
References dyscostman::ThreadedDyscoColumn< DataType >::_shape.
|
finaloverrideprotectedvirtual |
To be called before destructing the class.
Implements dyscostman::DyscoStManColumn.
|
private |
|
private |
|
protectedpure virtual |
Implemented in dyscostman::DyscoWeightColumn, and dyscostman::DyscoDataColumn.
|
finaloverridevirtual |
Implements dyscostman::DyscoStManColumn.
|
private |
Definition at line 193 of file threadeddyscocolumn.h.
|
private |
Definition at line 193 of file threadeddyscocolumn.h.
|
private |
Definition at line 208 of file threadeddyscocolumn.h.
|
private |
Definition at line 191 of file threadeddyscocolumn.h.
Referenced by dyscostman::ThreadedDyscoColumn< DataType >::getBitsPerSymbol(), and dyscostman::ThreadedDyscoColumn< DataType >::SetBitsPerSymbol().
|
private |
Definition at line 207 of file threadeddyscocolumn.h.
|
private |
Definition at line 200 of file threadeddyscocolumn.h.
|
private |
Definition at line 204 of file threadeddyscocolumn.h.
|
private |
Definition at line 205 of file threadeddyscocolumn.h.
|
private |
Definition at line 194 of file threadeddyscocolumn.h.
|
private |
Definition at line 193 of file threadeddyscocolumn.h.
|
private |
Definition at line 206 of file threadeddyscocolumn.h.
|
private |
Definition at line 197 of file threadeddyscocolumn.h.
|
private |
Definition at line 197 of file threadeddyscocolumn.h.
|
private |
Definition at line 196 of file threadeddyscocolumn.h.
|
private |
Definition at line 202 of file threadeddyscocolumn.h.
|
private |
Definition at line 198 of file threadeddyscocolumn.h.
|
private |
Definition at line 192 of file threadeddyscocolumn.h.
Referenced by dyscostman::ThreadedDyscoColumn< DataType >::shape().
|
private |
Definition at line 201 of file threadeddyscocolumn.h.
|
private |
Definition at line 203 of file threadeddyscocolumn.h.
|
private |
Definition at line 210 of file threadeddyscocolumn.h.
|
private |
Definition at line 195 of file threadeddyscocolumn.h.
|
private |
Definition at line 199 of file threadeddyscocolumn.h.