casa  5.7.0-16
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
ArrayColumn.h
Go to the documentation of this file.
1 //# ArrayColumn.h: access to an array table column with arbitrary data type
2 //# Copyright (C) 1994,1995,1996,1997,1998,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 //# $Id: ArrayColumn.h 21521 2014-12-10 08:06:42Z gervandiepen $
27 
28 #ifndef TABLES_ARRAYCOLUMN_H
29 #define TABLES_ARRAYCOLUMN_H
30 
31 
32 //# Includes
33 #include <casacore/casa/aips.h>
37 
38 namespace casacore { //# NAMESPACE CASACORE - BEGIN
39 
40 //# Forward Declarations
41 class RefRows;
42 template<class T> class Array;
43 template<class T> class BaseSlicesFunctor;
44 class IPosition;
45 class Slice;
46 class Slicer;
47 class ColumnSlicer;
48 class String;
49 
50 
51 // <summary>
52 // Read and write access to an array table column with arbitrary data type
53 // </summary>
54 
55 // <use visibility=export>
56 
57 // <reviewed reviewer="dschieb" date="1994/08/10" tests="none">
58 // </reviewed>
59 
60 // <prerequisite>
61 // <li> Table
62 // <li> TableColumn
63 // </prerequisite>
64 
65 // <etymology>
66 // ArrayColumn<T> gives read and write access to an column in a table
67 // containing an array with data type T.
68 // </etymology>
69 
70 // <synopsis>
71 // The class ArrayColumn allows readonly access to a column
72 // containing arrays with an arbitrary data type. It can handle direct
73 // as well as indirect arrays.
74 // It is possible to get the data in an individual cell (i.e. table row);
75 // either the whole array or a slice of the array can be accessed.
76 // It is also possible to get the column as a whole if the arrays
77 // in all cells of the column have the same shape (which is always true
78 // for direct arrays). As in the case of individual cells it is possible
79 // to get the entire arrays or a slice of the arrays.
80 //
81 // A default constructor is defined to allow construction of an array
82 // of ArrayColumn objects. However, this constructs an object not
83 // referencing a column. Functions like get, etc. will fail (i.e. result
84 // in a segmentation fault) when used on such objects. The functions
85 // isNull and throwIfNull can be used to test on this.
86 // The functions attach and reference can fill in the object.
87 //
88 // The assignment operator is not defined for this class, because it was
89 // felt it would be too confusing. Instead the function reference can
90 // be used to do assignment with reference semantics. An assignment
91 // with copy semantics makes no sense for a readonly column.
92 // </synopsis>
93 
94 // <templating arg=T>
95 // <li> Default constructor
96 // <li> Copy constructor
97 // <li> Assignment operator
98 // </templating>
99 
100 // <example>
101 // See module <linkto module="Tables#open">Tables</linkto>.
102 // </example>
103 
104 
105 template<class T>
106 class ArrayColumn : public TableColumn
107 {
108 public:
109 
110  // The default constructor creates a null object, i.e. it
111  // does not reference a table column.
112  // The sole purpose of this constructor is to allow construction
113  // of an array of ArrayColumn objects.
114  // The functions reference and attach can be used to make a null object
115  // reference a column.
116  // Note that get functions, etc. will cause a segmentation fault
117  // when operating on a null object. It was felt it was too expensive
118  // to test on null over and over again. The user should use the isNull
119  // or throwIfNull function in case of doubt.
120  ArrayColumn();
121 
122  // Construct for the given column in the given table.
123  ArrayColumn (const Table&, const String& columnName);
124 
125  // Construct from the given table column.
126  // This constructor is useful if first a table column was constructed,
127  // its type is determined and thereafter used to construct the
128  // correct column object.
129  explicit ArrayColumn (const TableColumn&);
130 
131  // Copy constructor (reference semantics).
132  ArrayColumn (const ArrayColumn<T>&);
133 
134  ~ArrayColumn();
135 
136  // Clone the object.
137  virtual TableColumn* clone() const;
138 
139  // Assignment uses reference semantics, thus works the same
140  // as function reference.
141  ArrayColumn<T>& operator= (const ArrayColumn<T>&);
142 
143  // Change the reference to another column.
144  // This is in fact an assignment operator with reference semantics.
145  // It removes the reference to the current column and creates
146  // a reference to the column referenced in the other object.
147  // It will handle null objects correctly.
148  void reference (const ArrayColumn<T>&);
149 
150  // Attach a column to the object.
151  // This is in fact only a shorthand for
152  // <br><src> reference (ArrayColumn<T> (table, columnName)); </src>
153  void attach (const Table& table, const String& columnName)
154  { reference (ArrayColumn<T> (table, columnName)); }
155 
156  // Get the #dimensions of an array in a particular cell.
157  // If the cell does not contain an array, 0 is returned.
158  // Use the function isDefined to test if the cell contains an array.
159  uInt ndim (uInt rownr) const
160  { TABLECOLUMNCHECKROW(rownr); return baseColPtr_p->ndim (rownr); }
161 
162  // Get the shape of an array in a particular cell.
163  // If the cell does not contain an array, a 0-dim shape is returned.
164  // Use the function isDefined to test if the cell contains an array.
165  IPosition shape (uInt rownr) const
166  { TABLECOLUMNCHECKROW(rownr); return baseColPtr_p->shape (rownr); }
167 
168  // Get the array value in a particular cell (i.e. table row).
169  // The row numbers count from 0 until #rows-1.
170  // <group>
171  // According to the assignment rules of class Array, the destination
172  // array must be empty or its shape must conform the table array shape.
173  // However, if the resize flag is set the destination array will be
174  // resized if not conforming.
175  void get (uInt rownr, Array<T>& array, Bool resize = False) const;
176  Array<T> get (uInt rownr) const;
177  Array<T> operator() (uInt rownr) const;
178  // </group>
179 
180  // Get a slice of an N-dimensional array in a particular cell
181  // (i.e. table row).
182  // The row numbers count from 0 until #rows-1.
183  // The dimensionality of the slice must match the dimensionality
184  // of the table array and the slice definition should not exceed
185  // the shape of the table array.
186  // <group>
187  // According to the assignment rules of class Array, the destination
188  // array must be empty or its shape must conform the shape of the
189  // table array slice.
190  // However, if the resize flag is set the destination array will be
191  // resized if not conforming.
192  void getSlice (uInt rownr, const Slicer& arraySection, Array<T>& array,
193  Bool resize = False) const;
194  Array<T> getSlice (uInt rownr, const Slicer& arraySection) const;
195  // </group>
196 
197  // Get an irregular slice of an N-dimensional array in a particular cell
198  // (i.e. table row) as given by the vectors of Slice objects.
199  // The outer vector represents the array axes.
200  // A missing or empty axis means the entire axis.
201  // The inner vector represents the slices to take for each axis.
202  // For example, to get slices from 2-dim arrays:
203  // <srcblock>
204  // Vector<Vector<Slice> > slices(2); // 2-dim
205  // slices[1].resize (3); // 3 slices in 2nd dim
206  // slices[1][0] = Slice(100,20);
207  // slices[1][1] = Slice(200,18);
208  // slices[1][2] = Slice(538,30,2);
209  // // Get data. Vector of first axis is empty, thus entire axis is read.
210  // Array<Complex> data = dataCol.getColumn (slices);
211  // </srcblock>
212  // If the column contains n-dim arrays, the resulting array is (n+1)-dim.
213  // with the last dimension representing the number of rows and the
214  // other dimensions representing the shape of the slice.
215  // The arrays in the column must have the same shape in all cells.
216  // <group>
217  // According to the assignment rules of class Array, the destination
218  // array must be empty or its shape must conform the resulting (n+1)-dim
219  // array.
220  // However, if the resize flag is set the destination array will be
221  // resized if not conforming.
222  void getSlice (uInt rownr,
223  const Vector<Vector<Slice> >& arraySlices,
224  Array<T>& arr, Bool resize = False) const;
225  Array<T> getSlice (uInt rownr,
226  const Vector<Vector<Slice> >& arraySlices) const;
227  // </group>
228 
229  // Get the array of all values in a column.
230  // If the column contains n-dim arrays, the resulting array is (n+1)-dim
231  // with the last dimension representing the number of rows.
232  // The arrays in the column must have the same shape in all cells.
233  // <group>
234  // According to the assignment rules of class Array, the destination
235  // array must be empty or its shape must conform the resulting (n+1)-dim
236  // array.
237  // However, if the resize flag is set the destination array will be
238  // resized if not conforming.
239  void getColumn (Array<T>& array, Bool resize = False) const;
240  Array<T> getColumn() const;
241  // </group>
242 
243  // Get regular slices from all arrays in the column.
244  // If the column contains n-dim arrays, the resulting array is (n+1)-dim.
245  // with the last dimension representing the number of rows and the
246  // other dimensions representing the shape of the slice.
247  // The arrays in the column must have the same shape in all cells.
248  // <group>
249  // According to the assignment rules of class Array, the destination
250  // array must be empty or its shape must conform the resulting (n+1)-dim
251  // array.
252  // However, if the resize flag is set the destination array will be
253  // resized if not conforming.
254  void getColumn (const Slicer& arraySection, Array<T>& array,
255  Bool resize = False) const;
256  Array<T> getColumn (const Slicer& arraySection) const;
257  // </group>
258 
259  // Get irregular slices from all arrays in the column as given by the
260  // vectors of Slice objects. The outer vector represents the array axes.
261  // A missing or empty axis means the entire axis.
262  // The inner vector represents the slices to take for each axis.
263  // For example, to get slices from 2-dim arrays:
264  // <srcblock>
265  // Vector<Vector<Slice> > slices(2); // 2-dim
266  // slices[1].resize (3); // 3 slices in 2nd dim
267  // slices[1][0] = Slice(100,20);
268  // slices[1][1] = Slice(200,18);
269  // slices[1][2] = Slice(538,30,2);
270  // // Get data. Vector of first axis is empty, thus entire axis is read.
271  // Array<Complex> data = dataCol.getColumn (slices);
272  // </srcblock>
273  // If the column contains n-dim arrays, the resulting array is (n+1)-dim.
274  // with the last dimension representing the number of rows and the
275  // other dimensions representing the shape of the slice.
276  // The arrays in the column must have the same shape in all cells.
277  // <group>
278  // According to the assignment rules of class Array, the destination
279  // array must be empty or its shape must conform the resulting (n+1)-dim
280  // array.
281  // However, if the resize flag is set the destination array will be
282  // resized if not conforming.
283  void getColumn (const Vector<Vector<Slice> >& arraySection, Array<T>& array,
284  Bool resize = False) const;
285  Array<T> getColumn (const Vector<Vector<Slice> >& arraySection) const;
286  // </group>
287 
288  // Get the array of some values in a column.
289  // The Slicer object can be used to specify start, end (or length),
290  // and stride of the rows to get.
291  // If the column contains n-dim arrays, the resulting array is (n+1)-dim
292  // with the last dimension representing the number of rows in the slicer.
293  // The arrays in the column must have the same shape in all those cells.
294  // According to the assignment rules of class Array, the destination
295  // array must be empty or its shape must conform the resulting (n+1)-dim
296  // array.
297  // However, if the resize flag is set the destination array will be
298  // resized if not conforming.
299  // <group>
300  void getColumnRange (const Slicer& rowRange, Array<T>& arr,
301  Bool resize = False) const;
302  Array<T> getColumnRange (const Slicer& rowRange) const;
303  void getColumnCells (const RefRows& rownrs, Array<T>& arr,
304  Bool resize = False) const;
305  Array<T> getColumnCells (const RefRows& rownrs) const;
306  // </group>
307 
308  // Get slices from some arrays in a column.
309  // The first Slicer object can be used to specify start, end (or length),
310  // and stride of the rows to get. The second Slicer object can be
311  // used to specify the slice to take from each array.
312  // If the column contains n-dim arrays, the resulting array is (n+1)-dim
313  // with the last dimension representing the number of rows in the slicer.
314  // The arrays in the column must have the same shape in all those cells.
315  // According to the assignment rules of class Array, the destination
316  // array must be empty or its shape must conform the resulting (n+1)-dim
317  // array.
318  // However, if the resize flag is set the destination array will be
319  // resized if not conforming.
320  // <group>
321  void getColumnRange (const Slicer& rowRange,
322  const Slicer& arraySection, Array<T>& arr,
323  Bool resize = False) const;
324  Array<T> getColumnRange (const Slicer& rowRange,
325  const Slicer& arraySection) const;
326  void getColumnCells (const RefRows& rownrs,
327  const Slicer& arraySection, Array<T>& arr,
328  Bool resize = False) const;
329  Array<T> getColumnCells (const RefRows& rownrs,
330  const Slicer& arraySection) const;
331  // </group>
332 
333  // Similar to getColumn (arraySlices, arr, resize) except it
334  // gets the slices for the given rows instead of all rows.
335  void getColumnCells (const RefRows& rows,
336  const ColumnSlicer & slicerSet,
337  Array<T>& destination,
338  Bool resize = False) const;
339 
340  // The get() function like above which does not check shapes, etc.
341  // It is faster and can be used for performance reasons if one
342  // knows for sure that the arguments are correct.
343  // E.g. it is used internally in virtual column engines.
344  void baseGet (uInt rownr, Array<T>& array) const
345  { baseColPtr_p->get (rownr, &array); }
346 
347  // Set the shape of the array in the given row.
348  // Setting the shape is needed if the array is put in slices,
349  // otherwise the table system would not know the shape.
350  // <group>
351  void setShape (uInt rownr, const IPosition& shape);
352 
353  // Try to store the array in a tiled way using the given tile shape.
354  void setShape (uInt rownr, const IPosition& shape,
355  const IPosition& tileShape);
356  // </group>
357 
358  // Put the array in a particular cell (i.e. table row).
359  // The row numbers count from 0 until #rows-1.
360  // If the shape of the table array in that cell has not already been
361  // defined, it will be defined implicitly.
362  void put (uInt rownr, const Array<T>& array);
363 
364  // Copy the value of a cell of that column to a cell of this column.
365  // This function uses a generic TableColumn object as input.
366  // The data types of both columns must be the same, otherwise an
367  // exception is thrown.
368  // <group>
369  // Use the same row numbers for both cells.
370  void put (uInt rownr, const TableColumn& that,
371  Bool preserveTileShape=False)
372  { put (rownr, that, rownr, preserveTileShape); }
373  // Use possibly different row numbers for that (i.e. input) and
374  // and this (i.e. output) cell.
375  void put (uInt thisRownr, const TableColumn& that, uInt thatRownr,
376  Bool preserveTileShape=False);
377  // </group>
378 
379  // Put into a slice of an N-dimensional array in a particular cell.
380  // The row numbers count from 0 until #rows-1.
381  // The shape of the table array must have been defined.
382  // The dimensionality of the slice must match the dimensionality
383  // of the table array and the slice definition should not exceed
384  // the shape of the table array.
385  void putSlice (uInt rownr, const Slicer& arraySection,
386  const Array<T>& array);
387 
388  void putSlice (uInt rownr, const Vector<Vector<Slice> >& arraySlices,
389  const Array<T>& arr);
390 
391  // Put the array of all values in the column.
392  // If the column contains n-dim arrays, the source array must be (n+1)-dim
393  // with the last dimension representing the number of rows.
394  void putColumn (const Array<T>& array);
395 
396  // Put into subsections of the table arrays in the entire column.
397  // If the column contains n-dim arrays, the source array is (n+1)-dim
398  // with the last dimension representing the number of rows and
399  // other dimensions representing the shape of the slice.
400  // The dimensionality of the slice must match the dimensionality
401  // of the table array, thus must be n-dim. Also the slice definition
402  // should not exceed the shape of the table arrays.
403  void putColumn (const Slicer& arraySection, const Array<T>& array);
404 
405  void putColumn (const Vector<Vector<Slice> >& arraySlices,
406  const Array<T>& arr);
407 
408  // Put the array of some values in the column.
409  // The Slicer object can be used to specify start, end (or length),
410  // and stride of the rows to put.
411  // If the column contains n-dim arrays, the source array must be (n+1)-dim
412  // with the last dimension representing the number of rows in the slicer.
413  // <group>
414  void putColumnRange (const Slicer& rowRange, const Array<T>& arr);
415  void putColumnCells (const RefRows& rownrs, const Array<T>& arr);
416  // </group>
417 
418  // Put into subsection of the table arrays in some rows of the column.
419  // The first Slicer object can be used to specify start, end (or length),
420  // and stride of the rows to put. The second Slicer object can be
421  // used to specify the slice to take from each array.
422  // If the column contains n-dim arrays, the source array must be (n+1)-dim
423  // with the last dimension representing the number of rows in the slicer.
424  // <group>
425  void putColumnRange (const Slicer& rowRange,
426  const Slicer& arraySection, const Array<T>& arr);
427  void putColumnCells (const RefRows& rownrs,
428  const Slicer& arraySection, const Array<T>& arr);
429  // </group>
430 
431  // Same as putColumn(arraySlices, arr) except that it puts for the given
432  // rows instead of all rows.
433  // <group>
434  void putColumnCells (const RefRows& rows,
435  const Vector<Vector<Slice> >& arraySlices,
436  const Array<T>& arr);
437  void putSliceFromRows (const RefRows& rows,
438  const Vector<Vector<Slice> >& arraySlices,
439  const Array<T>& source)
440  { putColumnCells (rows, arraySlices, source); }
441  void putColumnCells (const RefRows& rows,
442  const ColumnSlicer & columnSlicer,
443  const Array<T>& source);
444  // </group>
445 
446  // Put the same value in all cells of the column.
447  void fillColumn (const Array<T>& value);
448 
449  // Put the contents of a column with the same data type into this column.
450  // To put the contents of a column with a different data type into
451  // this column, the function TableColumn::putColumn can be used
452  // (provided the data type promotion is possible).
453  // In fact, this function is an assignment operator with copy semantics.
454  void putColumn (const ArrayColumn<T>& that);
455 
456  // The put() function like above which does not check shapes, etc.
457  // It is faster and can be used for performance reasons if one
458  // knows for sure that the arguments are correct.
459  // E.g. it is used internally in virtual column engines.
460  void basePut (uInt rownr, const Array<T>& array)
461  { baseColPtr_p->put (rownr, &array); }
462 
463 private:
464  // Check if the data type matches the column data type.
465  void checkDataType() const;
466 
467  // Check the shape of the array. If the array is empty or if
468  // <src>resize=True</src>, the array is resized if needed.
469  // An exception is thrown if not conforming.
470  void checkShape (const IPosition& shp,
471  Array<T>& arr, Bool resize,
472  const String& where) const;
473  void checkShape (const IPosition& shp,
474  Array<T>& arr, Bool resize,
475  const char * where) const;
476 
477 protected:
478  // A common function used by all functions that can get or put irregular
479  // array slices. The functor performs the get or put operation.
480  void handleSlices (const Vector<Vector<Slice> >& slices,
481  BaseSlicesFunctor<T>& functor,
482  const Slicer& slicer,
483  IPosition& arrEnd,
484  Array<T>& array) const;
485 
486  // Keep switches to determine if a slice or an entire column can
487  // be accessed or the change of an array can be changed.
488  // True = yes; False = no.
492  // Keep switches to know if access knowledge is permanent or has
493  // to be asked again the next time.
497 };
498 
500 
501 public:
502 
503  // Create a ColumnSlicer for use in one of the overloads of ArrayColumn::getColumnCells. That method
504  // takes a potentially complex select of data out of a column cell (e.g., multiple slices along each
505  // axis) and then puts them into a selection of a destination array. This is most easily represnted
506  // as a set of source,destination slicers where one is applied to the cell and the other to the
507  // destination array.
508  //
509  // The shape paramter is the shape of the destination excluding the row axis.
510  //
511  //
512  //
513  // The Slicer objects provided (by pointer) will be owned by the ColumnSlicer object which will
514  // delete them in its destructor.
515 
516 
517  ColumnSlicer (const IPosition & shape, Vector<Slicer *> dataSlicers, Vector<Slicer *> destinationSlicers)
518  : dataSlicers_p (dataSlicers),
519  destinationSlicers_p (destinationSlicers),
520  shape_p (shape)
521  {
522  String message = validateParameters ();
523  if (! message.empty()){
524 
525  freeSlicers(); // Call gave them to us; set them free.
526 
527  throw AipsError (String ("ColumnSlicer (ctor):: ") + message);
528  }
529  }
530 
531  // Kill off the Slicer objects.
532 
534 
535  freeSlicers();
536  }
537 
538  // Accessor that returns the dataSlicers.
539 
541  {
542  return dataSlicers_p;
543  }
544 
545  // Accessor that returns the desintation slicers
546 
548  {
549  return destinationSlicers_p;
550  }
551 
552  // Accessor that returns the shape.
553 
554  const IPosition & shape () const
555  {
556  return shape_p;
557  }
558 
559 private:
560 
561  void freeSlicers ()
562  {
563  // The two Vectors contain pointers to objects so they need to be freed.
564  // They should have the same length normally, but during validation it's
565  // possible that they have different lengths.
566 
567  for (uInt i = 0; i < dataSlicers_p.size(); i++){
568  delete dataSlicers_p [i];
569  }
570 
571  for (uInt i = 0; i < destinationSlicers_p.size(); i++){
572  delete destinationSlicers_p [i];
573  }
574  }
575 
577  {
578  // Validate the contruction parameters to see if they are consistent.
579 
580  if (dataSlicers_p.size() != destinationSlicers_p.size()){
581  return String::format ("Number of data slicers (%d) and destination slicers (%d) "
582  "must match", dataSlicers_p.size(), destinationSlicers_p.size());
583  }
584 
585  if (dataSlicers_p.size() == 0){
586  return String::format ("At least one destination and one data slicer required.");
587  }
588 
589  for (uInt i = 0; i < dataSlicers_p.size(); i++){
590 
591  if (dataSlicers_p[i]->length() != destinationSlicers_p[i]->length()){
592 
593  return String::format ("Length of data slicer[%d] (%s) and "
594  "destination slicer [%d] (%s) must be equal",
595  i, dataSlicers_p[i]->length().toString().c_str(),
596  i, destinationSlicers_p[i]->length().toString().c_str());
597  }
598  }
599 
600  return String();
601  }
602 
606 };
607 
608 
609 //# Explicitly instantiate these templates in ArrayColumn_tmpl.cc
610  extern template class ArrayColumn<Bool>;
611  extern template class ArrayColumn<Char>;
612  extern template class ArrayColumn<Short>;
613  extern template class ArrayColumn<uShort>;
614  extern template class ArrayColumn<Int>;
615  extern template class ArrayColumn<uInt>;
616  extern template class ArrayColumn<Int64>;
617  extern template class ArrayColumn<Float>;
618  extern template class ArrayColumn<Double>;
619  extern template class ArrayColumn<Complex>;
620  extern template class ArrayColumn<DComplex>;
621  extern template class ArrayColumn<String>;
622 
623 
624 } //# NAMESPACE CASACORE - END
625 
626 
627 //# Make old name ROArrayColumn still available.
628 #define ROArrayColumn ArrayColumn
629 
630 
631 #ifndef CASACORE_NO_AUTO_TEMPLATES
632 #include <casacore/tables/Tables/ArrayColumn.tcc>
633 #endif //# CASACORE_NO_AUTO_TEMPLATES
634 #endif
A Vector of integers, for indexing into Array&lt;T&gt; objects.
Definition: IPosition.h:119
virtual IPosition shape(uInt rownr) const
Get the shape of an array in a particular cell.
void getSlice(uInt rownr, const Slicer &arraySection, Array< T > &array, Bool resize=False) const
Get a slice of an N-dimensional array in a particular cell (i.e.
A 1-D Specialization of the Array class.
#define TABLECOLUMNCHECKROW(ROWNR)
Definition: TableColumn.h:51
const Vector< Slicer * > & getDestinationSlicers() const
Accessor that returns the desintation slicers.
Definition: ArrayColumn.h:547
ArrayColumn< T > & operator=(const ArrayColumn< T > &)
Assignment uses reference semantics, thus works the same as function reference.
Array< T > getColumn() const
Main interface class to a read/write table.
Definition: Table.h:153
ColumnSlicer(const IPosition &shape, Vector< Slicer * > dataSlicers, Vector< Slicer * > destinationSlicers)
Create a ColumnSlicer for use in one of the overloads of ArrayColumn::getColumnCells.
Definition: ArrayColumn.h:517
TableExprNode array(const TableExprNode &values, const TableExprNodeSet &shape)
Create an array of the given shape and fill it with the values.
Definition: ExprNode.h:1886
void checkDataType() const
Check if the data type matches the column data type.
Vector< Slicer * > dataSlicers_p
Definition: ArrayColumn.h:603
void put(uInt rownr, const Array< T > &array)
Put the array in a particular cell (i.e.
IPosition shape(uInt rownr) const
Get the shape of an array in a particular cell.
Definition: ArrayColumn.h:165
void reference(const ArrayColumn< T > &)
Change the reference to another column.
void baseGet(uInt rownr, Array< T > &array) const
The get() function like above which does not check shapes, etc.
Definition: ArrayColumn.h:344
void putColumn(const Array< T > &array)
Put the array of all values in the column.
Bool canAccessSlice_p
Keep switches to determine if a slice or an entire column can be accessed or the change of an array c...
Definition: ArrayColumn.h:489
const Vector< Slicer * > & getDataSlicers() const
Accessor that returns the dataSlicers.
Definition: ArrayColumn.h:540
TableColumn()
The default constructor creates a null object, i.e.
BaseColumn * baseColPtr_p
Definition: TableColumn.h:388
Vector< Slicer * > destinationSlicers_p
Definition: ArrayColumn.h:604
Table table() const
Get the Table object this column belongs to.
uInt ndim(uInt rownr) const
Get the #dimensions of an array in a particular cell.
Definition: ArrayColumn.h:159
Array< T > operator()(uInt rownr) const
~ColumnSlicer()
Kill off the Slicer objects.
Definition: ArrayColumn.h:533
ArrayColumn()
The default constructor creates a null object, i.e.
void putSliceFromRows(const RefRows &rows, const Vector< Vector< Slice > > &arraySlices, const Array< T > &source)
Definition: ArrayColumn.h:437
Bool reaskAccessSlice_p
Keep switches to know if access knowledge is permanent or has to be asked again the next time...
Definition: ArrayColumn.h:494
void put(uInt rownr, const TableColumn &that, Bool preserveTileShape=False)
Copy the value of a cell of that column to a cell of this column.
Definition: ArrayColumn.h:370
LatticeExprNode length(const LatticeExprNode &expr, const LatticeExprNode &axis)
2-argument function to get the length of an axis.
Class holding the row numbers in a RefTable.
Definition: RefRows.h:85
void handleSlices(const Vector< Vector< Slice > > &slices, BaseSlicesFunctor< T > &functor, const Slicer &slicer, IPosition &arrEnd, Array< T > &array) const
A common function used by all functions that can get or put irregular array slices.
void putSlice(uInt rownr, const Slicer &arraySection, const Array< T > &array)
Put into a slice of an N-dimensional array in a particular cell.
void putColumnRange(const Slicer &rowRange, const Array< T > &arr)
Put the array of some values in the column.
void fillColumn(const Array< T > &value)
Put the same value in all cells of the column.
bool Bool
Define the standard types used by Casacore.
Definition: aipstype.h:42
void attach(const Table &table, const String &columnName)
Attach a column to the object.
Definition: ArrayColumn.h:153
Read and write access to an array table column with arbitrary data type.
Definition: Reweighter.h:48
Read/write access to a table column.
Definition: TableColumn.h:98
static String format(const char *picture,...)
Create a formatted string using the given printf format string.
void basePut(uInt rownr, const Array< T > &array)
The put() function like above which does not check shapes, etc.
Definition: ArrayColumn.h:460
TableExprNode toString(const TableExprNode &node)
Function to convert any value to a string.
Definition: ExprNode.h:1522
void setShape(uInt rownr, const IPosition &shape)
Set the shape of the array in the given row.
const Bool False
Definition: aipstype.h:44
template &lt;class T, class U&gt; class vector;
Definition: MSFlagger.h:37
void putColumnCells(const RefRows &rownrs, const Array< T > &arr)
void getColumnCells(const RefRows &rownrs, Array< T > &arr, Bool resize=False) const
Specify which elements to extract from an n-dimensional array.
Definition: Slicer.h:289
IPosition tileShape(uInt rownr) const
Get the tile shape of an array in a particular cell.
Definition: TableColumn.h:235
Base class for all Casacore library errors.
Definition: Error.h:134
virtual void get(uInt rownr, void *dataPtr) const =0
Get the value from a particular cell.
void getColumnRange(const Slicer &rowRange, Array< T > &arr, Bool resize=False) const
Get the array of some values in a column.
String: the storage and methods of handling collections of characters.
Definition: String.h:223
virtual TableColumn * clone() const
Clone the object.
Abstract baseclass for slices functors.
const IPosition & shape() const
Accessor that returns the shape.
Definition: ArrayColumn.h:554
void checkShape(const IPosition &shp, Array< T > &arr, Bool resize, const String &where) const
Check the shape of the array.
virtual void put(uInt rownr, const void *dataPtr)=0
Put the value in a particular cell.
LatticeExprNode value(const LatticeExprNode &expr)
This function returns the value of the expression without a mask.
unsigned int uInt
Definition: aipstype.h:51
Bool empty() const
Test for empty.
Definition: String.h:375
virtual uInt ndim(uInt rownr) const
Get the #dimensions of an array in a particular cell.
#define casacore
&lt;X11/Intrinsic.h&gt; #defines true, false, casacore::Bool, and String.
Definition: X11Intrinsic.h:42