1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79
|
#ifndef MSPROVIDERS_MSREADERS_MSREADER_H
#define MSPROVIDERS_MSREADERS_MSREADER_H
#include "../msprovider.h"
namespace wsclean {
/**
* The abstract MSReader class is the base class for classes that read
* visibilities. Derived classes are usually instantiated via
* MSProvider::MakeReader(). This class is designed such that each instance of
* a reader provides independent read access to the underlying visibilities.
*
* This class maintains a reading position, that goes sequentially through the
* data. The interface of this class is implemented in @ref ContiguousMSReader
* and @ref ReorderedMsReader.
*/
class MSReader {
public:
MSReader(MSProvider* ms_provider) : ms_provider_(ms_provider){};
virtual ~MSReader(){};
/**
* This provides a unique, consecutive number that corresponds to
* the current reading position. Note that this number does not have
* to map directly to measurement set row indices, because unselected
* data does not affect the RowId.
*/
virtual size_t RowId() const = 0;
/**
* Returns true as long as there is more data available for reading.
*/
virtual bool CurrentRowAvailable() = 0;
/**
* Move the reading position to the next row.
*/
virtual void NextInputRow() = 0;
/**
* Read meta data from the current reading position.
*/
virtual void ReadMeta(MSProvider::MetaData& metadata) = 0;
/**
* Read visibility data from current reading position.
*/
virtual void ReadData(std::complex<float>* buffer) = 0;
/**
* Read the model visibilities from the current reading position.
*/
virtual void ReadModel(std::complex<float>* buffer) = 0;
virtual void ReadWeights(float* buffer) = 0;
/**
* Write imaging weights to the current READING position.
* Note that despite this is a write operation, the reading position is
* used nevertheless. This is because it is written while reading the meta
* data inside WSClean, hence it would be inconvenient if the writing position
* would be used.
*/
virtual void WriteImagingWeights(const float* buffer) = 0;
/// @returns MSProvider::NPolarizations().
size_t NPolarizations() const { return ms_provider_->NPolarizations(); }
MSProvider& Provider() const { return *ms_provider_; }
protected:
MSProvider* ms_provider_;
};
} // namespace wsclean
#endif
|