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_IO_FLD_MAX_COMPONENTS_HH
00027 # define MLN_IO_FLD_MAX_COMPONENTS_HH
00028
00029 # include <mln/algebra/vec.hh>
00030 # include <mln/value/rgb.hh>
00031 # include <mln/io/fld/header.hh>
00032
00033 namespace mln
00034 {
00035
00036 namespace io
00037 {
00038
00039 namespace fld
00040 {
00041
00042 template <typename V>
00043 inline
00044 unsigned int max_component(const V&);
00045
00046 template <unsigned n, typename V>
00047 inline
00048 unsigned int max_component(const algebra::vec<n, V>& v);
00049
00050 template <unsigned n>
00051 inline
00052 unsigned int max_component(const value::rgb<n>&);
00053
00054 inline
00055 unsigned int max_component(const fld::data_type::E& t);
00056
00057 # ifndef MLN_INCLUDE_ONLY
00058
00059 template <typename V>
00060 inline
00061 unsigned int max_component(const V&)
00062 {
00063 return mln_max(V);
00064 }
00065
00066
00067 template <unsigned n, typename V>
00068 inline
00069 unsigned int max_component(const algebra::vec<n, V>& v)
00070 {
00071 return mln_max(V);
00072 }
00073
00074 template <unsigned n>
00075 inline
00076 unsigned int max_component(const value::rgb<n>&)
00077 {
00078 return mln_max(mln::value::int_u<n>);
00079 }
00080
00081 inline
00082 unsigned int max_component(const fld::data_type::E& t)
00083 {
00084 switch (t)
00085 {
00086 case data_type::BYTE: return mln_max(unsigned char);
00087 case data_type::SHORT: return mln_max(unsigned short);
00088 case data_type::INTEGER: return mln_max(unsigned);
00089 case data_type::FLOAT: return mln_max(float);
00090 case data_type::DOUBLE: return mln_max(double);
00091 default: return 0;
00092 }
00093 }
00094
00095 # endif // ! MLN_INCLUDE_ONLY
00096 }
00097
00098 }
00099
00100 }
00101
00102 #endif // !MLN_IO_FLD_MAX_COMPONENTS_HH