Loading...
Searching...
No Matches
casacore::AntennaPairFile Class Reference

This class is able to store the combination of ANTENNA1 and ANTENNA2 columns in a compressed manner. More...

`#include <AntennaPairFile.h>`

## Public Member Functions

| AntennaPairFile () noexcept=default
| AntennaPairFile (AntennaPairFile &&source) noexcept
| ~AntennaPairFile () noexcept
AntennaPairFile & | operator= (AntennaPairFile &&rhs)
void | WriteAntenna1 (uint64_t row, int32_t antenna1)
void | WriteAntenna2 (uint64_t row, int32_t antenna2)
void | WritePair (uint64_t row, int32_t antenna1, int32_t antenna2)
int32_t | ReadAntenna1 (uint64_t row)
int32_t | ReadAntenna2 (uint64_t row)
void | Close ()
const std::string & | Filename () const
uint64_t | NRowsInPattern () const
| The number of rows that form one repeating pattern.

## Static Public Member Functions

static AntennaPairFile | CreateNew (const std::string &filename)
| Create a new antenna-pair file on disk with the given filename.
static AntennaPairFile | OpenExisting (const std::string &filename)
| Open an already existing antenna-pair file from disk with the given filename.

## Private Member Functions

| AntennaPairFile (const std::string &filename)
| Create a new file on disk.
| AntennaPairFile (const std::string &filename, bool)
| Open an existing file from disk.
template<size_t AntennaNumber>
void | WriteAntenna (uint64_t row, int32_t antenna)
template<size_t AntennaNumber>
int32_t | ReadAntenna (uint64_t row)
void | ReadHeader ()
void | WriteHeader ()
void | ReadData ()
void | WriteData ()

## Static Private Member Functions

static bool | HasUnsetAntenna (const std::array< int32_t, 2 > &pair)

## Private Attributes

BufferedColumnarFile | file_
uint64_t | rows_in_pattern_
| This value remains zero until the repeating pattern was found.
std::vector< std::array< int32_t, 2 > > | data_

## Static Private Attributes

static constexpr size_t | kHeaderSize
| The header: char[8] "AntPair\0" uint64_t rows_per_block.
static constexpr const char | kMagicHeaderTag [8]
static constexpr int32_t | kUnsetAntenna

## Detailed Description

This class is able to store the combination of ANTENNA1 and ANTENNA2 columns in a compressed manner.

It does this by assuming that the pair of antenna indices are repeated, i.e. every timestep in the measurement set follows the same sequence of baselines. By only writing the repeated sequence once, the storage required is reduce to that of only one timestep.

The class checks to see if the writing satisfies the required constraints, and if they do not an exception is thrown.

Definition at line 24 of file AntennaPairFile.h.

## Constructor & Destructor Documentation

## AntennaPairFile() [1/4]

casacore::AntennaPairFile::AntennaPairFile | ( |  | ) |

default noexcept

Referenced by AntennaPairFile(), CreateNew(), OpenExisting(), and operator=().

## AntennaPairFile() [2/4]

casacore::AntennaPairFile::AntennaPairFile | ( | AntennaPairFile && | source | ) |

inline noexcept

Definition at line 28 of file AntennaPairFile.h.

References AntennaPairFile(), data_, file_, casacore::move(), and rows_in_pattern_.

## ~AntennaPairFile()

casacore::AntennaPairFile::~AntennaPairFile | ( |  | ) |

inline noexcept

Definition at line 36 of file AntennaPairFile.h.

References Close().

## AntennaPairFile() [3/4]

casacore::AntennaPairFile::AntennaPairFile | ( | const std::string & | filename | ) |

inline private

Create a new file on disk.

Definition at line 104 of file AntennaPairFile.h.

References CreateNew(), file_, and kHeaderSize.

## AntennaPairFile() [4/4]

casacore::AntennaPairFile::AntennaPairFile | ( | const std::string & | filename,
|  | bool | )

inline private

Open an existing file from disk.

The last parameter is a dummy parameter to distinguish it from the creating constructor.

Definition at line 112 of file AntennaPairFile.h.

References file_, kHeaderSize, OpenExisting(), ReadData(), and ReadHeader().

## Member Function Documentation

## Close()

void casacore::AntennaPairFile::Close | ( |  | ) |

inline

Definition at line 80 of file AntennaPairFile.h.

References data_, file_, rows_in_pattern_, WriteData(), and WriteHeader().

Referenced by operator=(), and ~AntennaPairFile().

## CreateNew()

AntennaPairFile casacore::AntennaPairFile::CreateNew | ( | const std::string & | filename | ) |

inline static

Create a new antenna-pair file on disk with the given filename.

Definition at line 51 of file AntennaPairFile.h.

References AntennaPairFile().

Referenced by AntennaPairFile().

## Filename()

const std::string & casacore::AntennaPairFile::Filename | ( |  | ) | const

inline

Definition at line 92 of file AntennaPairFile.h.

References file_.

## HasUnsetAntenna()

bool casacore::AntennaPairFile::HasUnsetAntenna | ( | const std::array< int32_t, 2 > & | pair | ) |

inline static private

Definition at line 118 of file AntennaPairFile.h.

References kUnsetAntenna.

Referenced by WriteAntenna().

## NRowsInPattern()

uint64_t casacore::AntennaPairFile::NRowsInPattern | ( |  | ) | const

inline

The number of rows that form one repeating pattern.

Function is added for testing purposes.

Definition at line 98 of file AntennaPairFile.h.

References rows_in_pattern_.

## OpenExisting()

AntennaPairFile casacore::AntennaPairFile::OpenExisting | ( | const std::string & | filename | ) |

inline static

Open an already existing antenna-pair file from disk with the given filename.

Definition at line 59 of file AntennaPairFile.h.

References AntennaPairFile().

Referenced by AntennaPairFile().

## operator=()

AntennaPairFile & casacore::AntennaPairFile::operator= | ( | AntennaPairFile && | rhs | ) |

inline

Definition at line 38 of file AntennaPairFile.h.

References AntennaPairFile(), Close(), data_, file_, and rows_in_pattern_.

## ReadAntenna()

template<size_t AntennaNumber>

int32_t casacore::AntennaPairFile::ReadAntenna | ( | uint64_t | row | ) |

inline private

Definition at line 184 of file AntennaPairFile.h.

References data_, kUnsetAntenna, and rows_in_pattern_.

Referenced by ReadAntenna1(), and ReadAntenna2().

## ReadAntenna1()

int32_t casacore::AntennaPairFile::ReadAntenna1 | ( | uint64_t | row | ) |

inline

Definition at line 76 of file AntennaPairFile.h.

References ReadAntenna().

## ReadAntenna2()

int32_t casacore::AntennaPairFile::ReadAntenna2 | ( | uint64_t | row | ) |

inline

Definition at line 78 of file AntennaPairFile.h.

References ReadAntenna().

## ReadData()

void casacore::AntennaPairFile::ReadData | ( |  | ) |

inline private

Definition at line 220 of file AntennaPairFile.h.

References data_, and file_.

Referenced by AntennaPairFile().

## ReadHeader()

void casacore::AntennaPairFile::ReadHeader | ( |  | ) |

inline private

Definition at line 202 of file AntennaPairFile.h.

References file_, kHeaderSize, kMagicHeaderTag, and rows_in_pattern_.

Referenced by AntennaPairFile().

## WriteAntenna()

template<size_t AntennaNumber>

void casacore::AntennaPairFile::WriteAntenna | ( | uint64_t | row,
|  | int32_t | antenna )

inline private

Template Parameters

  AntennaNumber | Number of the antenna inside the pair: zero or one.

This row is the same as the first row, so this row is the first row of the next repeated pattern, and we have discovered the size of the pattern.

This is a rewrite of an already written value

Definition at line 126 of file AntennaPairFile.h.

References data_, HasUnsetAntenna(), kUnsetAntenna, rows_in_pattern_, WriteData(), and WriteHeader().

Referenced by WriteAntenna1(), WriteAntenna2(), and WritePair().

## WriteAntenna1()

void casacore::AntennaPairFile::WriteAntenna1 | ( | uint64_t | row,
|  | int32_t | antenna1 )

inline

Definition at line 63 of file AntennaPairFile.h.

References WriteAntenna().

## WriteAntenna2()

void casacore::AntennaPairFile::WriteAntenna2 | ( | uint64_t | row,
|  | int32_t | antenna2 )

inline

Definition at line 67 of file AntennaPairFile.h.

References WriteAntenna().

## WriteData()

void casacore::AntennaPairFile::WriteData | ( |  | ) |

inline private

Note that rows_in_pattern_ might still be zero if the pattern has not been finished. This would happen if MS is partially written, reopened and written further. This is rather unlikely to happen, but it is easy to support.

Definition at line 227 of file AntennaPairFile.h.

References data_, and file_.

Referenced by Close(), and WriteAntenna().

## WriteHeader()

void casacore::AntennaPairFile::WriteHeader | ( |  | ) |

inline private

Definition at line 213 of file AntennaPairFile.h.

References file_, kHeaderSize, kMagicHeaderTag, and rows_in_pattern_.

Referenced by Close(), and WriteAntenna().

## WritePair()

void casacore::AntennaPairFile::WritePair | ( | uint64_t | row,
|  | int32_t | antenna1,
|  | int32_t | antenna2 )

inline

Definition at line 71 of file AntennaPairFile.h.

References WriteAntenna().

## Member Data Documentation

## data_

std::vector<std::array<int32_t, 2> > casacore::AntennaPairFile::data_

private

Definition at line 250 of file AntennaPairFile.h.

Referenced by AntennaPairFile(), Close(), operator=(), ReadAntenna(), ReadData(), WriteAntenna(), and WriteData().

## file_

BufferedColumnarFile casacore::AntennaPairFile::file_

private

Definition at line 245 of file AntennaPairFile.h.

Referenced by AntennaPairFile(), AntennaPairFile(), AntennaPairFile(), Close(), Filename(), operator=(), ReadData(), ReadHeader(), WriteData(), and WriteHeader().

## kHeaderSize

size_t casacore::AntennaPairFile::kHeaderSize

static constexpr private

The header: char[8] "AntPair\0" uint64_t rows_per_block.

Definition at line 242 of file AntennaPairFile.h.

Referenced by AntennaPairFile(), AntennaPairFile(), ReadHeader(), and WriteHeader().

## kMagicHeaderTag

const char casacore::AntennaPairFile::kMagicHeaderTag[8]

static constexpr private

Definition at line 243 of file AntennaPairFile.h.

Referenced by ReadHeader(), and WriteHeader().

## kUnsetAntenna

int32_t casacore::AntennaPairFile::kUnsetAntenna

static constexpr private

Definition at line 244 of file AntennaPairFile.h.

Referenced by HasUnsetAntenna(), ReadAntenna(), and WriteAntenna().

## rows_in_pattern_

uint64_t casacore::AntennaPairFile::rows_in_pattern_

private

This value remains zero until the repeating pattern was found.

Definition at line 249 of file AntennaPairFile.h.

Referenced by AntennaPairFile(), Close(), NRowsInPattern(), operator=(), ReadAntenna(), ReadHeader(), WriteAntenna(), and WriteHeader().

The documentation for this class was generated from the following file:

- tables/AlternateMans/AntennaPairFile.h