casa  $Rev:20696$
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Defines
RetypedArraySetGet.h
Go to the documentation of this file.
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: RetypedArraySetGet.h 20551 2009-03-25 00:11:33Z Malte.Marquarding $
00027 
00028 #ifndef TABLES_RETYPEDARRAYSETGET_H
00029 #define TABLES_RETYPEDARRAYSETGET_H
00030 
00031 //# Includes
00032 
00033 namespace casa { //# NAMESPACE CASA - BEGIN
00034 
00035 //# Forward Declarations
00036 template<class T> class Array;
00037 class IPosition;
00038 
00039 
00040 // <summary>
00041 // Helper functions for users of RetypedArrayEngine
00042 // </summary>
00043 
00044 // <use visibility=export>
00045 
00046 // <reviewed reviewer="UNKNOWN" date="before2004/08/25" tests="dRetypedArrayEngine.cc" demos=dRetypedArrayEngine.h>
00047 // </reviewed>
00048 
00049 // <prerequisite>
00050 //# Classes you should understand before using this one.
00051 //   <li> <linkto class=RetypedArrayEngine>RetypedArrayEngine</linkto>
00052 // </prerequisite>
00053 
00054 // <synopsis> 
00055 // The functions in here can be used in the implementation of the
00056 // CopyInfo class inside a SourceType class used by a RetypedArrayEngine.
00057 // </synopsis>
00058 
00059 // <example>
00060 // The example in RetypedArrayEngine shows how these functions can be used.
00061 // </example>
00062 
00063 // <motivation>
00064 // These functions make the implementation of the set and get
00065 // functions in the SourceType objects of the RetypedArrayEngine easier.
00066 // They are not part of the RetypedArrayEngine.h file to avoid
00067 // the inclusion of that (heavy) file in a SourceType.
00068 // </motivation>
00069 
00070 // <group name=RetypedArrayEngineSetGet>
00071 
00072 // Copy the entire target array to the source array.
00073 // It will check if the shapes and sizes match.
00074 // <br>
00075 // This very efficient copy function can only be called by the static set
00076 // function in the SourceType when the TargetType array can directly be
00077 // copied to the SourceType array.
00078 // <br>See
00079 // <linkto class=RetypedArrayEngine>RetypedArrayEngine</linkto> for
00080 // more information.
00081 template<class SourceType, class TargetType>
00082 void retypedArrayEngineSet (Array<SourceType>& out,
00083                             const Array<TargetType>& in);
00084 
00085 // Copy the entire source array to the target array.
00086 // It will check if the shapes and sizes match.
00087 // <br>
00088 // This very efficient copy function can only be called by the static set
00089 // function in the SourceType when the TargetType array can directly be
00090 // copied to the SourceType array.
00091 // <br>See
00092 // <linkto class=RetypedArrayEngine>RetypedArrayEngine</linkto> for
00093 // more information.
00094 template<class SourceType, class TargetType>
00095 void retypedArrayEngineGet (Array<TargetType>& out,
00096                             const Array<SourceType>& in);
00097 
00098 // Fill an array with SourceType objects from the target array.
00099 // This is called when the target is incomplete.
00100 // The shape and extra argument can help to set the correct
00101 // elements in the source.
00102 // <br>
00103 // It loops through all elements in the SourceType array and
00104 // calls the SourceType function
00105 // It calls the SourceType function
00106 //  <srcblock>
00107 //    void setElem (const TargetType* data, const IPosition& shape,
00108 //                  const void* extraArgument);
00109 //  </srcblock>
00110 // for each element.
00111 // <note role=tip>
00112 // This retypedArrayEngineSet function is only a convenience function.
00113 // For optimal performance it may be needed to handcode the loop instead
00114 // of using this function.
00115 // </note>
00116 // <br>See
00117 // <linkto class=RetypedArrayEngine>RetypedArrayEngine</linkto> for
00118 // more information.
00119 template<class SourceType, class TargetType>
00120 void retypedArrayEngineSet (Array<SourceType>& out,
00121                             const Array<TargetType>& in,
00122                             const IPosition& shape,
00123                             const void* extraArgument);
00124 
00125 // Fill an array with TargetType objects from the source array.
00126 // This is called when the target is incomplete.
00127 // The shape and extra argument can help to get the correct
00128 // elements from the source.
00129 // <br>
00130 // It loops through all elements in the SourceType array and
00131 // calls the SourceType function
00132 //  <srcblock>
00133 //    void getElem (TargetType* data, const IPosition& shape,
00134 //                  const void* extraArgument);
00135 //  </srcblock>
00136 // for each element.
00137 // <note role=tip>
00138 // This retypedArrayEngineGet function is only a convenience function.
00139 // For optimal performance it may be needed to handcode the loop instead
00140 // of using this function.
00141 // </note>
00142 // <br>See
00143 // <linkto class=RetypedArrayEngine>RetypedArrayEngine</linkto> for
00144 // more information.
00145 template<class SourceType, class TargetType>
00146 void retypedArrayEngineGet (Array<TargetType>& out,
00147                             const Array<SourceType>& in,
00148                             const IPosition& shape,
00149                             const void* extraArgument);
00150 
00151 
00152 // </group>
00153 
00154 
00155 
00156 } //# NAMESPACE CASA - END
00157 
00158 #ifndef CASACORE_NO_AUTO_TEMPLATES
00159 #include <tables/Tables/RetypedArraySetGet.tcc>
00160 #endif //# CASACORE_NO_AUTO_TEMPLATES
00161 #endif