casa
$Rev:20696$
|
This class interprets a VLA logical record. More...
#include <VLALogicalRecord.h>
Public Member Functions | |
VLALogicalRecord () | |
Create an object that is not good for anything except that it can be assigned to (using the assigment operator). | |
VLALogicalRecord (VLAArchiveInput *input) | |
Create an object that reads its data from the specified VLAArchiveInput object. | |
VLALogicalRecord (const VLALogicalRecord &other) | |
The copy constructor uses reference semantics. | |
~VLALogicalRecord () | |
The destructor just cleans up. | |
VLALogicalRecord & | operator= (const VLALogicalRecord &other) |
The assignment operator uses reference semantics. | |
ByteSource & | logicalRecord () |
This returns the reconstructed VLA archive record from the input stream. | |
Bool | read () |
Reads the next logical record from the ByteSource. | |
Bool | isValid () const |
Returns True if this class is attached to a VLAArchiveInput object. | |
const VLARCA & | RCA () const |
returns a reference to a class which can be used to interpret the data in the Record Control Area of the current logical record. | |
const VLASDA & | SDA () const |
returns a reference to a class which can be used to interpret the data in the Subarray Data Area of the current logical record. | |
const VLACDA & | CDA (uInt which) const |
returns a reference to a class which can be used to interpret the data in the Correlator Data Area of the current logical record. | |
const VLAADA & | ADA (uInt which) const |
returns a reference to a class which can be used to interpret the data in the Antenna Data Area (ADA) of the current logical record. | |
Vector< Stokes::StokesTypes > | polarisations (VLAEnum::CDA cda, uInt ant1=0, uInt ant2=0) const |
Return the polarisations of the data in the specified CDA. | |
Private Attributes | |
CountedPtr< VLAArchiveInput > | itsRecordPtr |
VLARCA | itsRCA |
VLASDA | itsSDA |
Block< VLAADA > | itsADA |
Block< VLACDA > | itsCDA |
This class interprets a VLA logical record.
This class is designed to reconstitute VLA archive data records.
This class is designed to read VLA archive data. The data may be read from a disk, tape drive or any other data source supported by the IO module. A call to the operator++() function assembles the next reconstructed VLA archive data record from the input. A reference to this data can be obtained using the logicalRecord function.
Refer to the "VLA Archive Data Format", VLA Computer Memorandum 186 by G.C. Hunt, K.P. Sowinski, and T.J. Bottomly; June 1993. (This is also available as AIPS++ note 159)
The VLA archive records are always a multiple of 2048 bytes. The record sizes were designed for use with magnetic tapes, so there is a maximum physical record size of 13*2048=26624 bytes.
The low level class (blockio), that actually does the I/O, allows for a record (hereinafter chunk) size and for a input block size of a multiple of the chunk size. The low level read operation tests for the number of bytes actually read from the device.
The helper classes VlaDiskInput, VlaTapeInput, and VlaStdInput are designed to deal with the low level input from the devices in an analogous fashion to the ones used for FITS input.
Since a read may be issued for an arbitrary number of bytes from a disk, the chunk multiple is arbitrary and may be used to tune the speed of operation. There is an obvious trade-off between the block size created in the blockio class and the number of read operations.
The story is quite different for tape input. A read request for at least the maximum physical record size must be made to avoid loss of data. Since a single tape record will be read with a single read operation, there is no point is having it any larger. The chunk multiple must be exactly 13 so that the block size is 26624.
The reconstitution algorithm is as follows:
The first two 16-bit integers should contain the values 1 and n, where n is the number of "physical records" in the current "logical record." (If the first value is not 1, then the chunk is rejected and a new one read until the first 16-bit value is 1.) These two values are not part of the reconstituted "logical record."
The chunks are copied into the buffer until the "logical record" is complete. For "logical records" longer than 26620 byte, this is not the whole story. Each "physical record" contains maximum of 13 chunks. When the first "physical record" of 13 chunks has been read, the next chunk will be the first of the next "physical record." The first two 16-bit integers will now be 2 and n, to indicate that this is the second "physical record" of the sequence. These 4 bytes are decoded and the rest of this chunk is copied to the buffer. And so on...
An end-of-file condition on the input will cause record processing to be declared complete.
To open and read a VLA archive data file VLAArchiveInput *in; Block <Char> *buff; String fileName = " "; String fileType = "tape";
if (fileType == String("tape")) { in = new VLAArchiveInput(fileName.chars(), VLAArchiveInput::Tape); } else { in = new VLAArchiveInput(fileName.chars(), VLAArchiveInput::Disk); }
uInt record = 0; for (buff=&(in->next()); in->atEnd()==False; buff=&(in->next()), record++) { cout << "Record" << record << endl; process record pointed to by buff }
Definition at line 165 of file VLALogicalRecord.h.
Create an object that is not good for anything except that it can be assigned to (using the assigment operator).
Create an object that reads its data from the specified VLAArchiveInput object.
The supplied pointer should be obtained from new and is "taken over". Hence the user should not delete it.
VLALogicalRecord::VLALogicalRecord | ( | const VLALogicalRecord & | other | ) |
The copy constructor uses reference semantics.
The destructor just cleans up.
const VLAADA& VLALogicalRecord::ADA | ( | uInt | which | ) | const |
returns a reference to a class which can be used to interpret the data in the Antenna Data Area (ADA) of the current logical record.
A logical record has one ADA for each antenna that contributed to the data in this record and the argument is used to specify which one you are interested in. And exception is thrown if the input argument is not less than the number of antennas in this subarray.
const VLACDA& VLALogicalRecord::CDA | ( | uInt | which | ) | const |
returns a reference to a class which can be used to interpret the data in the Correlator Data Area of the current logical record.
A logical record can have have up to four correlator data areas and the argument is used to specify which one you are interested in. And exception is thrown if the input argument is greater than three.
Bool VLALogicalRecord::isValid | ( | ) | const |
Returns True if this class is attached to a VLAArchiveInput object.
ByteSource& VLALogicalRecord::logicalRecord | ( | ) |
This returns the reconstructed VLA archive record from the input stream.
This ByteSource has the data stored in memory, and hence is seekable. Data read from this ByteSource will have the ModComp numeric conversions applied.
VLALogicalRecord& VLALogicalRecord::operator= | ( | const VLALogicalRecord & | other | ) |
The assignment operator uses reference semantics.
Vector<Stokes::StokesTypes> VLALogicalRecord::polarisations | ( | VLAEnum::CDA | cda, |
uInt | ant1 = 0 , |
||
uInt | ant2 = 0 |
||
) | const |
Return the polarisations of the data in the specified CDA.
This information is obtained from knowing what the correlator modes represent and checking the IF transfer switch for the specified antennas.
const VLARCA& VLALogicalRecord::RCA | ( | ) | const |
returns a reference to a class which can be used to interpret the data in the Record Control Area of the current logical record.
Bool VLALogicalRecord::read | ( | ) |
Reads the next logical record from the ByteSource.
Returns False if there was a problem assembling the next record.
const VLASDA& VLALogicalRecord::SDA | ( | ) | const |
returns a reference to a class which can be used to interpret the data in the Subarray Data Area of the current logical record.
Block<VLAADA> VLALogicalRecord::itsADA [private] |
Definition at line 243 of file VLALogicalRecord.h.
Block<VLACDA> VLALogicalRecord::itsCDA [private] |
Definition at line 247 of file VLALogicalRecord.h.
VLARCA VLALogicalRecord::itsRCA [private] |
Definition at line 235 of file VLALogicalRecord.h.
CountedPtr<VLAArchiveInput> VLALogicalRecord::itsRecordPtr [private] |
Definition at line 231 of file VLALogicalRecord.h.
VLASDA VLALogicalRecord::itsSDA [private] |
Definition at line 239 of file VLALogicalRecord.h.