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_VALUE_PRINT_HH
00027 # define MLN_TRAIT_VALUE_PRINT_HH
00028
00034 # include <iostream>
00035 # include <mln/trait/value_.hh>
00036 # include <mln/metal/is_a.hh>
00037
00038
00039
00040 namespace mln
00041 {
00042
00043
00044 template <typename E> struct Value;
00045
00046
00047 namespace trait
00048 {
00049
00050 namespace value
00051 {
00052
00053 template <typename V>
00054 void print(std::ostream& ostr);
00055
00056 template <typename V>
00057 void print(const Value<V>& v, std::ostream& ostr);
00058
00059
00060 # ifndef MLN_INCLUDE_ONLY
00061
00062 template <typename V>
00063 inline
00064 void print(std::ostream& ostr)
00065 {
00066 mlc_is_a(V, Value)::check();
00067 typedef mln::trait::value_<V> the;
00068 ostr << "{ "
00069 << typename the::nature().name() << ", "
00070 << typename the::kind() .name() << ", "
00071 << typename the::quant() .name() << ", "
00072 << "nbits=" << the::nbits << ", "
00073 << "card=" << the::card << ", "
00074 << " }" << std::endl;
00075 }
00076
00077 template <typename V>
00078 inline
00079 void print(const Value<V>&, std::ostream& ostr)
00080 {
00081 print<V>(ostr);
00082 }
00083
00084 # endif // ! MLN_INCLUDE_ONLY
00085
00086 }
00087
00088 }
00089
00090 }
00091
00092
00093 #endif // ! MLN_TRAIT_VALUE_PRINT_HH