casacore
Loading...
Searching...
No Matches
MSMDirColumn.h
Go to the documentation of this file.
1//# MSMDirColumn.h: Memory storage manager for fixed shape table arrays
2//# Copyright (C) 2003
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: casa-feedback@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#ifndef TABLES_MSMDIRCOLUMN_H
27#define TABLES_MSMDIRCOLUMN_H
28
29
30//# Includes
31#include <casacore/casa/aips.h>
32#include <casacore/tables/DataMan/MSMColumn.h>
33#include <casacore/casa/Arrays/Array.h>
34
35
36namespace casacore { //# NAMESPACE CASACORE - BEGIN
37
38// <summary>
39// Memory storage manager for table arrays
40// </summary>
41
42// <use visibility=local>
43
44// <reviewed reviewer="UNKNOWN" date="before2004/08/25" tests="">
45// </reviewed>
46
47// <prerequisite>
48//# Classes you should understand before using this one.
49// <li> MSMBase
50// <li> MSMColumn
51// </prerequisite>
52
53// <synopsis>
54// MSMDirColumn handles arrays in a table column.
55// It only keeps them in memory, so they are not persistent.
56// </synopsis>
57
58//# <todo asof="$DATE:$">
59//# A List of bugs, limitations, extensions or planned refinements.
60//# </todo>
61
62
64{
65public:
66 // Create a column of the given type.
68
69 // Frees up the storage.
70 virtual ~MSMDirColumn();
71
72 // Forbid copy constructor.
73 MSMDirColumn (const MSMDirColumn&) = delete;
74
75 // Forbid assignment.
77
78 // Set the (fixed) shape of the arrays in the entire column.
79 virtual void setShapeColumn (const IPosition& shape);
80
81 // Add (newNrrow-oldNrrow) rows to the column.
82 // Allocate the data arrays in these rows if the shape is fixed.
83 virtual void addRow (rownr_t newNrrow, rownr_t oldNrrow);
84
85 // Get the dimensionality of the item in the given row.
86 // 0 is returned if there is no array.
87 virtual uInt ndim (rownr_t rownr);
88
89 // Get the shape of the array in the given row.
90 // An zero-length IPosition is returned if there is no array.
91 virtual IPosition shape (rownr_t rownr);
92
93 // Get an array value in the given row.
94 // The buffer given by <src>arr</src> has to have the correct length
95 // (which is guaranteed by the ArrayColumn get function).
96 virtual void getArrayV (rownr_t rownr, ArrayBase& arr);
97
98 // Put an array value into the given row.
99 // The buffer given by <src>arr</src> has to have the correct length
100 // (which is guaranteed by the ArrayColumn put function).
101 virtual void putArrayV (rownr_t rownr, const ArrayBase& arr);
102
103 // Get a section of the array in the given row.
104 // The buffer given by <src>arr</src> has to have the correct length
105 // (which is guaranteed by the ArrayColumn getSlice function).
106 virtual void getSliceV (rownr_t rownr, const Slicer&, ArrayBase& arr);
107
108 // Put into a section of the array in the given row.
109 // The buffer given by <src>arr</src> has to have the correct length
110 // (which is guaranteed by the ArrayColumn putSlice function).
111 virtual void putSliceV (rownr_t rownr, const Slicer&, const ArrayBase& arr);
112
113 // Remove the value in the given row.
114 void remove (rownr_t rownr);
115
116 // Let the column create its arrays.
117 void doCreate (rownr_t nrrow);
118
119private:
120 template<typename T>
121 inline void doGetSlice (rownr_t rownr, const Slicer& slicer, Array<T>& data)
122 {
123 Array<T> arr(shape_p, static_cast<T*>(getArrayPtr (rownr)), SHARE);
124 data = arr(slicer);
125 }
126
127 template<typename T>
128 inline void doPutSlice (rownr_t rownr, const Slicer& slicer, const Array<T>& data)
129 {
130 Array<T> arr(shape_p, static_cast<T*>(getArrayPtr (rownr)), SHARE);
131 arr(slicer) = data;
132 }
133
134 // Delete the array in the given row.
135 void deleteArray (rownr_t rownr);
136
137 // The shape of the array.
139 // The nr of elements in the array.
141
142};
143
144
145} //# NAMESPACE CASACORE - END
146
147#endif
Non-templated base class for templated Array class.
Definition ArrayBase.h:71
void * getArrayPtr(rownr_t rownr)
Get the pointer for the given row.
virtual void getSliceV(rownr_t rownr, const Slicer &, ArrayBase &arr)
Get a section of the array in the given row.
virtual void getArrayV(rownr_t rownr, ArrayBase &arr)
Get an array value in the given row.
virtual void setShapeColumn(const IPosition &shape)
Set the (fixed) shape of the arrays in the entire column.
void doPutSlice(rownr_t rownr, const Slicer &slicer, const Array< T > &data)
void doGetSlice(rownr_t rownr, const Slicer &slicer, Array< T > &data)
MSMDirColumn & operator=(const MSMDirColumn &)=delete
Forbid assignment.
void doCreate(rownr_t nrrow)
Let the column create its arrays.
IPosition shape_p
The shape of the array.
virtual IPosition shape(rownr_t rownr)
Get the shape of the array in the given row.
void remove(rownr_t rownr)
Remove the value in the given row.
virtual void addRow(rownr_t newNrrow, rownr_t oldNrrow)
Add (newNrrow-oldNrrow) rows to the column.
virtual ~MSMDirColumn()
Frees up the storage.
void deleteArray(rownr_t rownr)
Delete the array in the given row.
MSMDirColumn(MSMBase *smptr, int dataType)
Create a column of the given type.
virtual uInt ndim(rownr_t rownr)
Get the dimensionality of the item in the given row.
virtual void putArrayV(rownr_t rownr, const ArrayBase &arr)
Put an array value into the given row.
MSMDirColumn(const MSMDirColumn &)=delete
Forbid copy constructor.
rownr_t nrelem_p
The nr of elements in the array.
virtual void putSliceV(rownr_t rownr, const Slicer &, const ArrayBase &arr)
Put into a section of the array in the given row.
virtual int dataType() const
Return the data type of the column.
@ SHARE
Share means that the Array will just use the pointer (no copy), however the Array will NOT delete it ...
Definition ArrayBase.h:60
this file contains all the compiler specific defines
Definition mainpage.dox:28
unsigned int uInt
Definition aipstype.h:49
uInt64 rownr_t
Define the type of a row number in a table.
Definition aipsxtype.h:44