casacore
ArrayColumnFunc.h
Go to the documentation of this file.
1 //# ArrayColumnFunbc.h: Functors to operate on an ArrayColumn
2 //# Copyright (C) 2009
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$
27 
28 #ifndef TABLES_ARRAYCOLUMNFUNC_H
29 #define TABLES_ARRAYCOLUMNFUNC_H
30 
31 //# Includes
32 #include <casacore/casa/aips.h>
33 #include <casacore/tables/Tables/ArrayColumn.h>
34 #include <casacore/casa/Arrays/Slicer.h>
35 #include <casacore/casa/Arrays/Array.h>
36 
37 namespace casacore { //# NAMESPACE CASACORE - BEGIN
38 
39  // <summary> Abstract baseclass for slices functors </summary>
40  // <synopsis>
41  // There are several ArrayColumn functions to get or put irregular array
42  // slices. ArrayColumn::handleSlices is used to perform all common
43  // operations using a functor derived from this base class.
44  // </synopsis>
45  template<typename T>
46  class BaseSlicesFunctor
47  {
48  public:
50  {}
51  virtual void apply (const Slicer& slicer, Array<T>& arr) = 0;
52  };
53 
54  // <summary> Functor to get irregular array slices from a cell</summary>
55  template<typename T>
56  class GetCellSlices : public BaseSlicesFunctor<T>
57  {
58  public:
59  GetCellSlices (const ArrayColumn<T>& col, uInt rownr)
60  : itsCol(col), itsRow(rownr)
61  {}
62  virtual void apply (const Slicer& slicer, Array<T>& arr)
63  { itsCol.getSlice (itsRow, slicer, arr); }
64  private:
65  const ArrayColumn<T>& itsCol;
66  uInt itsRow;
67  };
68 
69  // <summary> Functor to get irregular array slices from a column</summary>
70  template<typename T>
71  class GetColumnSlices : public BaseSlicesFunctor<T>
72  {
73  public:
74  GetColumnSlices (const ArrayColumn<T>& col)
75  : itsCol(col)
76  {}
77  virtual void apply (const Slicer& slicer, Array<T>& arr)
78  { itsCol.getColumn (slicer, arr); }
79  private:
80  const ArrayColumn<T>& itsCol;
81  };
82 
83  // <summary> Functor to put irregular array slices into a cell </summary>
84  template<typename T>
85  class PutCellSlices : public BaseSlicesFunctor<T>
86  {
87  public:
88  PutCellSlices (ArrayColumn<T>& col, uInt rownr)
89  : itsCol(col), itsRow(rownr)
90  {}
91  virtual void apply (const Slicer& slicer, Array<T>& arr)
92  { itsCol.putSlice (itsRow, slicer, arr); }
93  private:
94  ArrayColumn<T>& itsCol;
95  uInt itsRow;
96  };
97 
98  // <summary> Functor to get irregular array slices from a column</summary>
99  template<typename T>
100  class PutColumnSlices : public BaseSlicesFunctor<T>
101  {
102  public:
104  : itsCol(col)
105  {}
106  virtual void apply (const Slicer& slicer, Array<T>& arr)
107  { itsCol.putColumn (slicer, arr); }
108  private:
109  ArrayColumn<T>& itsCol;
110  };
111 
112 } //# NAMESPACE CASACORE - END
113 
114 #endif
void putColumn(const Array< T > &array)
Put the array of all values in the column.
Functor to put irregular array slices into a cell.
Functor to get irregular array slices from a cell.
virtual void apply(const Slicer &slicer, Array< T > &arr)=0
void putSlice(uInt rownr, const Slicer &arraySection, const Array< T > &array)
Put into a slice of an N-dimensional array in a particular cell.
Read and write access to an array table column with arbitrary data type.
Definition: CopyRecord.h:48
template <class T, class U> class vector;
Definition: Array.h:169
Specify which elements to extract from an n-dimensional array.
Definition: Slicer.h:275
Functor to get irregular array slices from a column.
Functor to get irregular array slices from a column.
Abstract baseclass for slices functors.
Definition: ArrayColumn.h:43
this file contains all the compiler specific defines
Definition: mainpage.dox:28
unsigned int uInt
Definition: aipstype.h:48