casacore
Loading...
Searching...
No Matches
RetypedArraySetGet.h
Go to the documentation of this file.
1//# RetypedArraySetGet.h: Helper functions for users of RetypedArrayEngine
2//# Copyright (C) 1994,1995,1996,1999
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_RETYPEDARRAYSETGET_H
27#define TABLES_RETYPEDARRAYSETGET_H
28
29//# Includes
30#include <casacore/casa/aips.h>
31#include <casacore/casa/Arrays/ArrayFwd.h>
32
33namespace casacore { //# NAMESPACE CASACORE - BEGIN
34
35//# Forward Declarations
36class IPosition;
37
38
39// <summary>
40// Helper functions for users of RetypedArrayEngine
41// </summary>
42
43// <use visibility=export>
44
45// <reviewed reviewer="UNKNOWN" date="before2004/08/25" tests="dRetypedArrayEngine.cc" demos=dRetypedArrayEngine.h>
46// </reviewed>
47
48// <prerequisite>
49//# Classes you should understand before using this one.
50// <li> <linkto class=RetypedArrayEngine>RetypedArrayEngine</linkto>
51// </prerequisite>
52
53// <synopsis>
54// The functions in here can be used in the implementation of the
55// CopyInfo class inside a SourceType class used by a RetypedArrayEngine.
56// </synopsis>
57
58// <example>
59// The example in RetypedArrayEngine shows how these functions can be used.
60// </example>
61
62// <motivation>
63// These functions make the implementation of the set and get
64// functions in the SourceType objects of the RetypedArrayEngine easier.
65// They are not part of the RetypedArrayEngine.h file to avoid
66// the inclusion of that (heavy) file in a SourceType.
67// </motivation>
68
69// <group name=RetypedArrayEngineSetGet>
71// Copy the entire target array to the source array.
72// It will check if the shapes and sizes match.
73// <br>
74// This very efficient copy function can only be called by the static set
75// function in the SourceType when the TargetType array can directly be
76// copied to the SourceType array.
77// <br>See
78// <linkto class=RetypedArrayEngine>RetypedArrayEngine</linkto> for
79// more information.
80template<class SourceType, class TargetType>
82 const Array<TargetType>& in);
83
84// Copy the entire source array to the target array.
85// It will check if the shapes and sizes match.
86// <br>
87// This very efficient copy function can only be called by the static set
88// function in the SourceType when the TargetType array can directly be
89// copied to the SourceType array.
90// <br>See
91// <linkto class=RetypedArrayEngine>RetypedArrayEngine</linkto> for
92// more information.
93template<class SourceType, class TargetType>
95 const Array<SourceType>& in);
96
97// Fill an array with SourceType objects from the target array.
98// This is called when the target is incomplete.
99// The shape and extra argument can help to set the correct
100// elements in the source.
101// <br>
102// It loops through all elements in the SourceType array and
103// calls the SourceType function
104// It calls the SourceType function
105// <srcblock>
106// void setElem (const TargetType* data, const IPosition& shape,
107// const void* extraArgument);
108// </srcblock>
109// for each element.
110// <note role=tip>
111// This retypedArrayEngineSet function is only a convenience function.
112// For optimal performance it may be needed to handcode the loop instead
113// of using this function.
114// </note>
115// <br>See
116// <linkto class=RetypedArrayEngine>RetypedArrayEngine</linkto> for
117// more information.
118template<class SourceType, class TargetType>
120 const Array<TargetType>& in,
121 const IPosition& shape,
122 const void* extraArgument);
123
124// Fill an array with TargetType objects from the source array.
125// This is called when the target is incomplete.
126// The shape and extra argument can help to get the correct
127// elements from the source.
128// <br>
129// It loops through all elements in the SourceType array and
130// calls the SourceType function
131// <srcblock>
132// void getElem (TargetType* data, const IPosition& shape,
133// const void* extraArgument);
134// </srcblock>
135// for each element.
136// <note role=tip>
137// This retypedArrayEngineGet function is only a convenience function.
138// For optimal performance it may be needed to handcode the loop instead
139// of using this function.
140// </note>
141// <br>See
142// <linkto class=RetypedArrayEngine>RetypedArrayEngine</linkto> for
143// more information.
144template<class SourceType, class TargetType>
146 const Array<SourceType>& in,
147 const IPosition& shape,
148 const void* extraArgument);
149
150
151// </group>
152
153
154
155} //# NAMESPACE CASACORE - END
156
157#ifndef CASACORE_NO_AUTO_TEMPLATES
158#include <casacore/tables/DataMan/RetypedArraySetGet.tcc>
159#endif //# CASACORE_NO_AUTO_TEMPLATES
160#endif
this file contains all the compiler specific defines
Definition mainpage.dox:28
TableExprNode shape(const TableExprNode &array)
Function operating on any scalar or array resulting in a Double array containing the shape.
Definition ExprNode.h:1991
void retypedArrayEngineSet(Array< SourceType > &out, const Array< TargetType > &in, const IPosition &shape, const void *extraArgument)
Fill an array with SourceType objects from the target array.
void retypedArrayEngineGet(Array< TargetType > &out, const Array< SourceType > &in, const IPosition &shape, const void *extraArgument)
Fill an array with TargetType objects from the source array.
void retypedArrayEngineGet(Array< TargetType > &out, const Array< SourceType > &in)
Copy the entire source array to the target array.
void retypedArrayEngineSet(Array< SourceType > &out, const Array< TargetType > &in)
Copy the entire target array to the source array.