00001 //# RetypedArraySetGet.h: Helper functions for users of RetypedArrayEngine 00002 //# Copyright (C) 1994,1995,1996,1999 00003 //# Associated Universities, Inc. Washington DC, USA. 00004 //# 00005 //# This library is free software; you can redistribute it and/or modify it 00006 //# under the terms of the GNU Library General Public License as published by 00007 //# the Free Software Foundation; either version 2 of the License, or (at your 00008 //# option) any later version. 00009 //# 00010 //# This library is distributed in the hope that it will be useful, but WITHOUT 00011 //# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or 00012 //# FITNESS FOR A PARTICULAR PURPOSE. See the GNU Library General Public 00013 //# License for more details. 00014 //# 00015 //# You should have received a copy of the GNU Library General Public License 00016 //# along with this library; if not, write to the Free Software Foundation, 00017 //# Inc., 675 Massachusetts Ave, Cambridge, MA 02139, USA. 00018 //# 00019 //# Correspondence concerning AIPS++ should be addressed as follows: 00020 //# Internet email: aips2-request@nrao.edu. 00021 //# Postal address: AIPS++ Project Office 00022 //# National Radio Astronomy Observatory 00023 //# 520 Edgemont Road 00024 //# Charlottesville, VA 22903-2475 USA 00025 //# 00026 //# $Id$ 00027 00028 #ifndef TABLES_RETYPEDARRAYSETGET_H 00029 #define TABLES_RETYPEDARRAYSETGET_H 00030 00031 //# Includes 00032 #include <casacore/casa/aips.h> 00033 00034 namespace casacore { //# NAMESPACE CASACORE - BEGIN 00035 00036 //# Forward Declarations 00037 template<class T> class Array; 00038 class IPosition; 00039 00040 00041 // <summary> 00042 // Helper functions for users of RetypedArrayEngine 00043 // </summary> 00044 00045 // <use visibility=export> 00046 00047 // <reviewed reviewer="UNKNOWN" date="before2004/08/25" tests="dRetypedArrayEngine.cc" demos=dRetypedArrayEngine.h> 00048 // </reviewed> 00049 00050 // <prerequisite> 00051 //# Classes you should understand before using this one. 00052 // <li> <linkto class=RetypedArrayEngine>RetypedArrayEngine</linkto> 00053 // </prerequisite> 00054 00055 // <synopsis> 00056 // The functions in here can be used in the implementation of the 00057 // CopyInfo class inside a SourceType class used by a RetypedArrayEngine. 00058 // </synopsis> 00059 00060 // <example> 00061 // The example in RetypedArrayEngine shows how these functions can be used. 00062 // </example> 00063 00064 // <motivation> 00065 // These functions make the implementation of the set and get 00066 // functions in the SourceType objects of the RetypedArrayEngine easier. 00067 // They are not part of the RetypedArrayEngine.h file to avoid 00068 // the inclusion of that (heavy) file in a SourceType. 00069 // </motivation> 00070 00071 // <group name=RetypedArrayEngineSetGet> 00072 00073 // Copy the entire target array to the source array. 00074 // It will check if the shapes and sizes match. 00075 // <br> 00076 // This very efficient copy function can only be called by the static set 00077 // function in the SourceType when the TargetType array can directly be 00078 // copied to the SourceType array. 00079 // <br>See 00080 // <linkto class=RetypedArrayEngine>RetypedArrayEngine</linkto> for 00081 // more information. 00082 template<class SourceType, class TargetType> 00083 void retypedArrayEngineSet (Array<SourceType>& out, 00084 const Array<TargetType>& in); 00085 00086 // Copy the entire source array to the target array. 00087 // It will check if the shapes and sizes match. 00088 // <br> 00089 // This very efficient copy function can only be called by the static set 00090 // function in the SourceType when the TargetType array can directly be 00091 // copied to the SourceType array. 00092 // <br>See 00093 // <linkto class=RetypedArrayEngine>RetypedArrayEngine</linkto> for 00094 // more information. 00095 template<class SourceType, class TargetType> 00096 void retypedArrayEngineGet (Array<TargetType>& out, 00097 const Array<SourceType>& in); 00098 00099 // Fill an array with SourceType objects from the target array. 00100 // This is called when the target is incomplete. 00101 // The shape and extra argument can help to set the correct 00102 // elements in the source. 00103 // <br> 00104 // It loops through all elements in the SourceType array and 00105 // calls the SourceType function 00106 // It calls the SourceType function 00107 // <srcblock> 00108 // void setElem (const TargetType* data, const IPosition& shape, 00109 // const void* extraArgument); 00110 // </srcblock> 00111 // for each element. 00112 // <note role=tip> 00113 // This retypedArrayEngineSet function is only a convenience function. 00114 // For optimal performance it may be needed to handcode the loop instead 00115 // of using this function. 00116 // </note> 00117 // <br>See 00118 // <linkto class=RetypedArrayEngine>RetypedArrayEngine</linkto> for 00119 // more information. 00120 template<class SourceType, class TargetType> 00121 void retypedArrayEngineSet (Array<SourceType>& out, 00122 const Array<TargetType>& in, 00123 const IPosition& shape, 00124 const void* extraArgument); 00125 00126 // Fill an array with TargetType objects from the source array. 00127 // This is called when the target is incomplete. 00128 // The shape and extra argument can help to get the correct 00129 // elements from the source. 00130 // <br> 00131 // It loops through all elements in the SourceType array and 00132 // calls the SourceType function 00133 // <srcblock> 00134 // void getElem (TargetType* data, const IPosition& shape, 00135 // const void* extraArgument); 00136 // </srcblock> 00137 // for each element. 00138 // <note role=tip> 00139 // This retypedArrayEngineGet function is only a convenience function. 00140 // For optimal performance it may be needed to handcode the loop instead 00141 // of using this function. 00142 // </note> 00143 // <br>See 00144 // <linkto class=RetypedArrayEngine>RetypedArrayEngine</linkto> for 00145 // more information. 00146 template<class SourceType, class TargetType> 00147 void retypedArrayEngineGet (Array<TargetType>& out, 00148 const Array<SourceType>& in, 00149 const IPosition& shape, 00150 const void* extraArgument); 00151 00152 00153 // </group> 00154 00155 00156 00157 } //# NAMESPACE CASACORE - END 00158 00159 #ifndef CASACORE_NO_AUTO_TEMPLATES 00160 #include <casacore/tables/DataMan/RetypedArraySetGet.tcc> 00161 #endif //# CASACORE_NO_AUTO_TEMPLATES 00162 #endif