casa  5.7.0-16
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
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>
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>
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;
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:
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:
110  };
111 
112 } //# NAMESPACE CASACORE - END
113 
114 #endif
ArrayColumn< T > & itsCol
const ArrayColumn< T > & itsCol
PutCellSlices(ArrayColumn< T > &col, uInt rownr)
GetCellSlices(const ArrayColumn< T > &col, uInt rownr)
Functor to put irregular array slices into a cell.
virtual void apply(const Slicer &slicer, Array< T > &arr)=0
PutColumnSlices(ArrayColumn< T > &col)
virtual void apply(const Slicer &slicer, Array< T > &arr)
Read and write access to an array table column with arbitrary data type.
Definition: Reweighter.h:48
virtual void apply(const Slicer &slicer, Array< T > &arr)
template &lt;class T, class U&gt; class vector;
Definition: MSFlagger.h:37
Specify which elements to extract from an n-dimensional array.
Definition: Slicer.h:289
Functor to get irregular array slices from a column.
ArrayColumn< T > & itsCol
Functor to get irregular array slices from a column.
virtual void apply(const Slicer &slicer, Array< T > &arr)
GetColumnSlices(const ArrayColumn< T > &col)
const ArrayColumn< T > & itsCol
Abstract baseclass for slices functors.
virtual void apply(const Slicer &slicer, Array< T > &arr)
unsigned int uInt
Definition: aipstype.h:51
#define casacore
&lt;X11/Intrinsic.h&gt; #defines true, false, casacore::Bool, and String.
Definition: X11Intrinsic.h:42