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__HH
00027 # define MLN_TRAIT_VALUE__HH
00028 
00032 
00033 # include <iostream>
00034 # include <string>
00035 
00036 # include <mln/metal/int.hh>
00037 # include <mln/metal/math/pow.hh>
00038 # include <mln/metal/if.hh>
00039 
00040 # include <mln/trait/value/all.hh>
00041 # include <mln/metal/math/pow.hh>
00042 # include <mln/core/def/low_quant_nbits.hh>
00043 
00044 
00045 # define mln_trait_value_nature(V) typename mln::trait::value_< V >::nature
00046 # define mln_trait_value_nature_(V)         mln::trait::value_< V >::nature
00047 # define mln_trait_value_kind(V)   typename mln::trait::value_< V >::kind
00048 # define mln_trait_value_kind_(V)           mln::trait::value_< V >::kind
00049 # define mln_trait_value_quant(V)  typename mln::trait::value_< V >::quant
00050 # define mln_trait_value_quant_(V)          mln::trait::value_< V >::quant
00051 
00052 
00053 # define mln_card(V)     mln::trait::value_< V >::card
00054 # define mln_dim(V)      mln::trait::value_< V >::dim
00055 # define mln_epsilon(V)  mln::trait::value_< V >::epsilon()
00056 # define mln_max(V)      mln::trait::value_< V >::max()
00057 # define mln_min(V)      mln::trait::value_< V >::min()
00058 # define mln_nbits(V)    mln::trait::value_< V >::nbits
00059 
00060 
00062 # define mln_trait_value_sum(V)   typename mln::trait::value_< V >::sum
00063 # define mln_trait_value_sum_(V)           mln::trait::value_< V >::sum
00064 # define mln_sum(V)  mln_trait_value_sum(V)
00065 # define mln_sum_(V) mln_trait_value_sum_(V)
00066 
00068 # define mln_trait_value_name(V)         mln::trait::value_< V >::name()
00069 
00071 # define mln_value_quant_from_(C)                                       \
00072   mlc_if(mln::metal::bool_<( int(C) > int(mlc_pow_int(2, mln::def::low_quant_nbits)) \
00073                              || int(C) == 0                             \
00074                              || int(C) == -1)>,                         \
00075          mln::trait::value::quant::high,                                \
00076          mln::trait::value::quant::low)
00077 
00078 
00080 
00081 
00082 
00083 
00084 
00085 # define mln_value_card_from_(N)                \
00086   (int(N) <= int(mln::def::low_quant_nbits)     \
00087    ? mlc_pow_int((N <= 16 ? 2 : 1),             \
00088                  (N <= 16 ? N : 1))             \
00089    : 0)
00090 
00091 
00092 
00093 namespace mln
00094 {
00095 
00096   namespace trait
00097   {
00098 
00099 
00100     struct undefined_value_
00101     {
00102       typedef undef nature;
00103       typedef undef kind;
00104       typedef undef quant;
00105 
00106       
00107 
00108 
00109 
00110 
00111 
00112 
00113 
00114 
00115 
00116 
00117 
00118       typedef undef sum;
00119       
00120     };
00121 
00122 
00123     struct default_value_ : undefined_value_
00124     {
00125       enum {
00126         dim = 0,
00127         nbits = 0,
00128         card = 0
00129       };
00130 
00131       typedef trait::value::nature::unknown nature;
00132       typedef trait::value::kind::data      kind;
00133       typedef trait::value::quant::high     quant;
00134 
00135       
00136 
00137 
00138 
00139 
00140     };
00141 
00142 
00143     template <typename V>
00144     struct value_ : default_value_
00145     {
00146     };
00147 
00148 
00149   } 
00150 
00151 } 
00152 
00153 
00154 # include <mln/trait/value/print.hh>
00155 
00156 
00157 #endif // ! MLN_TRAIT_VALUE__HH