00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026 #ifndef MLN_METAL_ARRAY_HH
00027 # define MLN_METAL_ARRAY_HH
00028
00029 # include <mln/metal/array1d.hh>
00030 # include <mln/metal/array2d.hh>
00031 # include <mln/metal/array3d.hh>
00032
00033 namespace mln
00034 {
00035
00036 namespace metal
00037 {
00038
00039
00040
00041 template<unsigned i, class T, unsigned n> inline
00042 T get_at(const array1d<T, n>& arr)
00043 {
00044 return arr.template get_at_<i>();
00045 }
00046
00047 template<unsigned i, class T, unsigned n> inline
00048 T get(const array1d<T, n>& arr)
00049 {
00050 return arr.template get_<i>();
00051 }
00052
00053
00054
00055 template<unsigned row, unsigned col, class T,
00056 unsigned r, unsigned c> inline
00057 T get_at(const array2d<T, r, c>& arr)
00058 {
00059 return arr.template get_at_<row, col>();
00060 }
00061
00062 template<unsigned row, unsigned col, class T,
00063 unsigned r, unsigned c> inline
00064 T get(const array2d<T, r, c>& arr)
00065 {
00066 return arr.template get_<row, col>();
00067 }
00068
00069
00070
00071 template<unsigned sli, unsigned row, unsigned col,
00072 class T, unsigned s, unsigned r, unsigned c> inline
00073 T get_at(const array3d<T, s, r, c>& arr)
00074 {
00075 return arr.template get_at_<sli, row, col>();
00076 }
00077
00078 template<unsigned sli, unsigned row, unsigned col,
00079 class T, unsigned s, unsigned r, unsigned c> inline
00080 T get_(const array3d<T, s, r, c>& arr)
00081 {
00082 return arr.template get_<sli, row, col>();
00083 }
00084
00085
00086
00087 template<typename T, unsigned n>
00088 std::ostream& operator<<(std::ostream& ostr, const array1d<T, n>& rhs)
00089 {
00090 for (unsigned i = 0; i < n; ++i)
00091 ostr << rhs[i] << " ";
00092 ostr << std::endl;
00093
00094 return ostr;
00095 }
00096
00097 template<typename T, unsigned r, unsigned c>
00098 std::ostream& operator<<(std::ostream& ostr, const array2d<T, r, c>& rhs)
00099 {
00100 for (unsigned i = 0; i < r; ++i)
00101 {
00102 for (unsigned j = 0; j < c; ++j)
00103 ostr << rhs(i,j) << '\t';
00104 ostr << '\n';
00105 }
00106 ostr << std::endl;
00107
00108 return ostr;
00109 }
00110
00111 }
00112
00113 }
00114
00115 #endif // ! MLN_METAL_ARRAY_HH