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/ArrayColumnBase.h>
34 #include <casacore/casa/Arrays/Slicer.h>
35 #include <casacore/casa/Arrays/ArrayBase.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. ArrayColumnBase::handleSlices is used to perform all common
43  // operations using a functor derived from this base class.
44  // </synopsis>
46  {
47  public:
49  {}
50  virtual void apply (const Slicer& slicer, ArrayBase& arr) = 0;
51  };
52 
53  // <summary> Functor to get irregular array slices from a cell</summary>
54  class GetCellSlices : public BaseSlicesFunctor
55  {
56  public:
57  GetCellSlices (const ArrayColumnBase& col, rownr_t rownr)
58  : itsCol(col), itsRow(rownr)
59  {}
60  virtual void apply (const Slicer& slicer, ArrayBase& arr)
61  { itsCol.baseGetSlice (itsRow, slicer, arr); }
62  private:
63  const ArrayColumnBase& itsCol;
65  };
66 
67  // <summary> Functor to get irregular array slices from a column</summary>
68  class GetColumnSlices : public BaseSlicesFunctor
69  {
70  public:
71  GetColumnSlices (const ArrayColumnBase& col)
72  : itsCol(col)
73  {}
74  virtual void apply (const Slicer& slicer, ArrayBase& arr)
75  { itsCol.acbGetColumn (slicer, arr, False); }
76  private:
77  const ArrayColumnBase& itsCol;
78  };
79 
80  // <summary> Functor to put irregular array slices into a cell </summary>
81  class PutCellSlices : public BaseSlicesFunctor
82  {
83  public:
85  : itsCol(col), itsRow(rownr)
86  {}
87  virtual void apply (const Slicer& slicer, ArrayBase& arr)
88  { itsCol.basePutSlice (itsRow, slicer, arr); }
89  private:
92  };
93 
94  // <summary> Functor to get irregular array slices from a column</summary>
95  class PutColumnSlices : public BaseSlicesFunctor
96  {
97  public:
99  : itsCol(col)
100  {}
101  virtual void apply (const Slicer& slicer, ArrayBase& arr)
102  { itsCol.acbPutColumn (slicer, arr); }
103  private:
105  };
106 
107 } //# NAMESPACE CASACORE - END
108 
109 #endif
Non-templated base class for templated Array class.
Definition: ArrayBase.h:73
void baseGetSlice(rownr_t rownr, const Slicer &arraySection, ArrayBase &array) const
void acbGetColumn(ArrayBase &array, Bool resize) const
Get the array of all values in a column.
void acbPutColumn(const ArrayBase &array)
Put the array of all values in the column.
void basePutSlice(rownr_t rownr, const Slicer &arraySection, const ArrayBase &array)
virtual void apply(const Slicer &slicer, ArrayBase &arr)=0
Functor to get irregular array slices from a cell.
GetCellSlices(const ArrayColumnBase &col, rownr_t rownr)
const ArrayColumnBase & itsCol
virtual void apply(const Slicer &slicer, ArrayBase &arr)
Functor to get irregular array slices from a column.
const ArrayColumnBase & itsCol
GetColumnSlices(const ArrayColumnBase &col)
virtual void apply(const Slicer &slicer, ArrayBase &arr)
Functor to put irregular array slices into a cell
ArrayColumnBase & itsCol
PutCellSlices(ArrayColumnBase &col, rownr_t rownr)
virtual void apply(const Slicer &slicer, ArrayBase &arr)
Functor to get irregular array slices from a column.
PutColumnSlices(ArrayColumnBase &col)
virtual void apply(const Slicer &slicer, ArrayBase &arr)
ArrayColumnBase & itsCol
this file contains all the compiler specific defines
Definition: mainpage.dox:28
const Bool False
Definition: aipstype.h:44
uInt64 rownr_t
Define the type of a row number in a table.
Definition: aipsxtype.h:46