casa  5.7.0-16
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
MirDataBuffer.h
Go to the documentation of this file.
1 //# MirDataBuffer.h: this defines a container for filler data buffers
2 //# Copyright (C) 2000,2001
3 //# Associated Universities, Inc. Washington DC, USA.
4 //#
5 //# This library is free software; you can redistribute it and/or modify it
6 //# under the terms of the GNU Library General Public License as published by
7 //# the Free Software Foundation; either version 2 of the License, or (at your
8 //# option) any later version.
9 //#
10 //# This library is distributed in the hope that it will be useful, but WITHOUT
11 //# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
12 //# FITNESS FOR A PARTICULAR PURPOSE. See the GNU Library General Public
13 //# License for more details.
14 //#
15 //# You should have received a copy of the GNU Library General Public License
16 //# along with this library; if not, write to the Free Software Foundation,
17 //# Inc., 675 Massachusetts Ave, Cambridge, MA 02139, USA.
18 //#
19 //# Correspondence concerning AIPS++ should be addressed as follows:
20 //# Internet email: aips2-request@nrao.edu.
21 //# Postal address: AIPS++ Project Office
22 //# National Radio Astronomy Observatory
23 //# 520 Edgemont Road
24 //# Charlottesville, VA 22903-2475 USA
25 //#
26 //#
27 //# $Id: MirDataBuffer.h,v 1.1 2009/09/03 18:54:47 pteuben Exp $
28 
29 #ifndef BIMA_MIRDATABUFFER_H
30 #define BIMA_MIRDATABUFFER_H
31 
32 #include <casa/Containers/Block.h>
33 #include <casa/Arrays/Matrix.h>
34 #include <casa/Arrays/Cube.h>
35 
36 #include <casa/namespace.h>
37 //# Forward Declarations
38 class MirDataBufferIter;
39 
40 // <summary>
41 // a buffer for data read in from a Miriad datatset
42 // </summary>
43 //
44 // <use visibility=local>
45 //
46 // <reviewed reviewer="" date="yyyy/mm/dd" tests="" demos="">
47 // </reviewed>
48 //
49 // <etymology>
50 // this class buffers data from a Miriad dataset
51 // </etymology>
52 //
53 // <motivation>
54 // MSes filled from Miriad data feature multiple windows of differing shapes.
55 // Performance during casacore::MS reads can be aided by collecting together casacore::MS table
56 // records of the same shape (e.g. of the same window). MirFiller accoplishes
57 // this by reading all baselines from a single timestamp at once, so that
58 // they written out in order of spectral window. This class provides a
59 // container for holding the data from different baselines.
60 // </motivation>
61 //
62 // <synopsis>
63 // At the moment, this is intended for use only by the MirFiller class.
64 //
65 //
66 // </synopsis>
67 //
68 // <example>
69 //
70 //
71 // </example>
72 //
73 // <todo asof="2001/02/22">
74 //
75 // </todo>
76 //
78 private:
79  Boolean upd;
80  Boolean hasmore;
81 
87 
89 public:
90  // create the container
91  MirDataBuffer(...);
92 
93  // return true if there is still data to be read from the dataset
94  Boolean hasMore() { return hasmore; }
95 
96  // set the variable update state. A value of true means that some
97  // variables have changed and should be checked for new values. false
98  // means that the variables have not changed since the last time
99  // they were checked.
100  void varUpdated(Boolean val) { upd = val; }
101 
102  // return the variable update state. A value of true means that some
103  // variables have changed and should be checked for new values. false
104  // means that the variables have not changed since the last time
105  // they were checked.
106  Boolean isVarUpdated() { return upd; }
107 
108  // return a pointer to the i-th record in this buffer
109  float *operator[](casacore::Int i) { return recs[i]; }
110 
111  // return the preamble for the i-th record
112  double *getPreamble(casacore::Int i) { return preamble[i]; }
113 
114  // return the current Miriad timestamp
115  double getTime() { return preamble[0][3]; }
116 
117  // return the baseline number for the i-th record
119 
120  // return the baseline vector as a 3-element array holding u, v, & w
121  double *getBaselineVec(casacore::Int i) { return preamble[i]; }
122 
123  // return the Miriad polarization code for the i-th record
125 
126  // return the number of records held in this buffer
128 
129  // update the number of records held by the buffer
130 
131  // reset the buffer for a new time slot
132  void reset() {
133  if (hasmore) {
134 
135  // switch cached record into first position
136  double *tmppre = preamble[0];
137  float *tmpnar = narrow[0];
138  float *tmpwid = wide[0];
139  preamble[0] = preamble[n];
140  narrow[0] = narrow[n];
141  wide[0] = wide[n];
142  pol[0] = pol[n];
143  preamble[n] = tmppre;
144  narrow[n] = tmpnar;
145  wide[n] = tmpwid;
146 
147  hasmore = false;
148  n=1;
149  } else {
150  n=0;
151  }
152  }
153 
154 
155 
156 };
157 
158 #endif
Boolean isVarUpdated()
return the variable update state.
a buffer for data read in from a Miriad datatset
Definition: MirDataBuffer.h:77
int Int
Definition: aipstype.h:50
casacore::Int size()
return the number of records held in this buffer
casacore::Block< float * > narrow
Definition: MirDataBuffer.h:84
casacore::Block< float * > wide
Definition: MirDataBuffer.h:85
casacore::Int nnar
Definition: MirDataBuffer.h:86
float * operator[](casacore::Int i)
return a pointer to the i-th record in this buffer
double * getBaselineVec(casacore::Int i)
return the baseline vector as a 3-element array holding u, v, &amp; w
void varUpdated(Boolean val)
set the variable update state.
void reset()
update the number of records held by the buffer
casacore::Int getBaselineNum(casacore::Int i)
return the baseline number for the i-th record
Boolean hasmore
Definition: MirDataBuffer.h:80
MirDataBuffer(MirDataBuffer &)
double * getPreamble(casacore::Int i)
return the preamble for the i-th record
casacore::Int nrec
Definition: MirDataBuffer.h:86
casacore::Block< double * > preamble
Definition: MirDataBuffer.h:83
casacore::Int nwide
Definition: MirDataBuffer.h:86
double getTime()
return the current Miriad timestamp
casacore::Block< int > pol
Definition: MirDataBuffer.h:82
casacore::Int getPol(casacore::Int i)
return the Miriad polarization code for the i-th record
Boolean hasMore()
return true if there is still data to be read from the dataset
Definition: MirDataBuffer.h:94