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// <summary>
39// Helper functions for users of RetypedArrayEngine
40// </summary>
41
42// <use visibility=export>
43
44// <reviewed reviewer="UNKNOWN" date="before2004/08/25" tests="dRetypedArrayEngine.cc"
45// 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
83// Copy the entire source array to the target array.
84// It will check if the shapes and sizes match.
85// <br>
86// This very efficient copy function can only be called by the static set
87// function in the SourceType when the TargetType array can directly be
88// copied to the SourceType array.
89// <br>See
90// <linkto class=RetypedArrayEngine>RetypedArrayEngine</linkto> for
91// more information.
92template <class SourceType, class TargetType>
94
95// Fill an array with SourceType objects from the target array.
96// This is called when the target is incomplete.
97// The shape and extra argument can help to set the correct
98// elements in the source.
99// <br>
100// It loops through all elements in the SourceType array and
101// calls the SourceType function
102// It calls the SourceType function
103// <srcblock>
104// void setElem (const TargetType* data, const IPosition& shape,
105// const void* extraArgument);
106// </srcblock>
107// for each element.
108// <note role=tip>
109// This retypedArrayEngineSet function is only a convenience function.
110// For optimal performance it may be needed to handcode the loop instead
111// of using this function.
112// </note>
113// <br>See
114// <linkto class=RetypedArrayEngine>RetypedArrayEngine</linkto> for
115// more information.
116template <class SourceType, class TargetType>
118 const IPosition& shape, const void* extraArgument);
119
120// Fill an array with TargetType objects from the source array.
121// This is called when the target is incomplete.
122// The shape and extra argument can help to get the correct
123// elements from the source.
124// <br>
125// It loops through all elements in the SourceType array and
126// calls the SourceType function
127// <srcblock>
128// void getElem (TargetType* data, const IPosition& shape,
129// const void* extraArgument);
130// </srcblock>
131// for each element.
132// <note role=tip>
133// This retypedArrayEngineGet function is only a convenience function.
134// For optimal performance it may be needed to handcode the loop instead
135// of using this function.
136// </note>
137// <br>See
138// <linkto class=RetypedArrayEngine>RetypedArrayEngine</linkto> for
139// more information.
140template <class SourceType, class TargetType>
142 const IPosition& shape, const void* extraArgument);
143
144// </group>
145
146} // namespace casacore
147
148#ifndef CASACORE_NO_AUTO_TEMPLATES
149#include <casacore/tables/DataMan/RetypedArraySetGet.tcc>
150#endif // # CASACORE_NO_AUTO_TEMPLATES
151#endif
For temporary backward namespace compatibility, use casa as alias for casacore.
Definition mainpage.dox:28
IPosition shape(const RecordFieldId &) const
Get the actual shape of this field.
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.