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_TRAIT_WINDOW_PRINT_HH
00027 # define MLN_TRAIT_WINDOW_PRINT_HH
00028
00034 # include <iostream>
00035
00036 # include <mln/trait/windows.hh>
00037 # include <mln/metal/is_a.hh>
00038 # include <mln/metal/bexpr.hh>
00039
00040
00041
00042 namespace mln
00043 {
00044
00045
00046 template <typename E> struct Window;
00047 template <typename E> struct Weighted_Window;
00048 template <typename E> struct Neighborhood;
00049
00050
00051 namespace trait
00052 {
00053
00054 namespace window
00055 {
00056
00057 template <typename T>
00058 void print(std::ostream& ostr = std::cout);
00059
00060 template <typename T>
00061 void print(const Neighborhood<T>& nbh, std::ostream& ostr = std::cout);
00062
00063 template <typename T>
00064 void print(const Window<T>& win, std::ostream& ostr = std::cout);
00065
00066 template <typename T>
00067 void print(const Weighted_Window<T>& w_win, std::ostream& ostr = std::cout);
00068
00069
00070 # ifndef MLN_INCLUDE_ONLY
00071
00072 template <typename T>
00073 inline
00074 void print(std::ostream& ostr)
00075 {
00076 metal::or_< mlc_is_a(T, Neighborhood),
00077 metal::or_< mlc_is_a(T, Window),
00078 mlc_is_a(T, Weighted_Window) >
00079 >::check();
00080 typedef mln::trait::window_<T> the;
00081 ostr << "{ "
00082 << typename the::size() .name() << ", "
00083 << typename the::support() .name() << ", "
00084 << typename the::definition() .name() << " }" << std::endl;
00085 }
00086
00087 template <typename T>
00088 inline
00089 void print(const Neighborhood<T>&, std::ostream& ostr)
00090 {
00091 print<T>(ostr);
00092 }
00093
00094 template <typename T>
00095 inline
00096 void print(const Window<T>&, std::ostream& ostr)
00097 {
00098 print<T>(ostr);
00099 }
00100
00101 template <typename T>
00102 inline
00103 void print(const Weighted_Window<T>&, std::ostream& ostr)
00104 {
00105 print<T>(ostr);
00106 }
00107
00108 # endif // ! MLN_INCLUDE_ONLY
00109
00110 }
00111
00112 }
00113
00114 }
00115
00116
00117 #endif // ! MLN_TRAIT_WINDOW_PRINT_HH