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
00027
00028 #ifndef OLENA_CORE_ABSTRACT_IMAGE_WITH_TYPE_WITH_DIM_HH
00029 # define OLENA_CORE_ABSTRACT_IMAGE_WITH_TYPE_WITH_DIM_HH
00030
00031 # include <mlc/bool.hh>
00032 # include <ntg/basics.hh>
00033
00034 # include <oln/core/abstract/image_with_type.hh>
00035 # include <oln/core/abstract/image_with_dim.hh>
00036
00037
00038
00039
00040
00041
00042
00043
00044 # define oln_label_image_(Name, Super) \
00045 template <class Exact> \
00046 class Name \
00047 : virtual public Super<Exact> \
00048 { \
00049 public: \
00050 typedef Name<Exact> self_type; \
00051 typedef Exact exact_type; \
00052 \
00053 exact_type& \
00054 operator=(self_type rhs) \
00055 { \
00056 return this->exact().assign(rhs.exact()); \
00057 } \
00058 \
00059 static std::string \
00060 name() \
00061 { \
00062 return \
00063 std::string(#Name "<") \
00064 + Exact::name() + ">"; \
00065 } \
00066 }; \
00067 \
00068 template <unsigned Dim, class Exact> \
00069 class Name##_with_dim \
00070 : virtual public Name<Exact>, \
00071 virtual public Super##_with_dim<Dim, Exact> \
00072 { \
00073 public: \
00074 typedef Name##_with_dim<Dim, Exact> self_type; \
00075 typedef Exact exact_type; \
00076 \
00077 exact_type& \
00078 operator=(self_type rhs) \
00079 { \
00080 return this->exact().assign(rhs.exact()); \
00081 } \
00082 \
00083 static std::string \
00084 name() \
00085 { \
00086 std::ostringstream s; \
00087 s << #Name "_with_dim<" \
00088 << Dim << ", " \
00089 << Exact::name() << ">"; \
00090 return s.str(); \
00091 } \
00092 };
00093
00094 namespace oln {
00095
00096 namespace abstract {
00097
00098
00099
00100
00101
00102
00103
00104
00105
00106
00107
00114 template <class Exact>
00115 struct data_type_image
00116 : virtual public image_with_type<typename image_id<Exact>::value_type, Exact>
00117 {
00118 public:
00119
00120 typedef data_type_image<Exact> self_type;
00121 typedef Exact exact_type;
00122
00131 exact_type&
00132 operator=(self_type rhs)
00133 {
00134 return this->exact().assign(rhs.exact());
00135 }
00136
00137 static std::string
00138 name()
00139 {
00140 return
00141 std::string("abstract::data_type_image<")
00142 + Exact::name() + ">";
00143 }
00144 };
00145
00155 template <unsigned Dim, class Exact>
00156 struct data_type_image_with_dim :
00157 virtual public data_type_image<Exact>,
00158 virtual public image_with_dim<Dim, Exact>
00159 {
00160 public:
00161
00162 typedef data_type_image<Exact> self_type;
00163 typedef Exact exact_type;
00164
00172 exact_type&
00173 operator=(self_type rhs)
00174 {
00175 return this->exact().assign(rhs.exact());
00176 }
00177
00178 static std::string
00179 name()
00180 {
00181 return
00182 std::string("abstract::data_type_image<")
00183 + Exact::name() + ">";
00184 }
00185 };
00186
00191 oln_label_image_(vectorial_image, data_type_image)
00192
00193
00205 oln_label_image_(non_vectorial_image, data_type_image)
00206
00221 oln_label_image_(binary_image, non_vectorial_image)
00222
00237 oln_label_image_(integer_image, non_vectorial_image)
00238
00253 oln_label_image_(decimal_image, non_vectorial_image)
00254
00271 template<class Exact>
00272 struct image_with_type_with_dim_switch
00273 {
00274 enum { Dim = image_id<Exact>::dim };
00275
00276 typedef typename image_id<Exact>::value_type T;
00277
00278
00279
00280 typedef typename mlc::bool_switch_<
00281
00282 mlc::bool_case_<ntg_is_a(T, ntg::binary)::ret,
00283 binary_image_with_dim<Dim, Exact>,
00284
00285 mlc::bool_case_<ntg_is_a(T, ntg::integer)::ret,
00286 integer_image_with_dim<Dim, Exact>,
00287
00288 mlc::bool_case_<ntg_is_a(T, ntg::decimal)::ret,
00289 decimal_image_with_dim<Dim, Exact>,
00290
00291 mlc::bool_case_<ntg_is_a(T, ntg::vectorial)::ret,
00292 vectorial_image_with_dim<Dim, Exact>,
00293
00294 mlc::bool_case_<ntg_is_a(T, ntg::non_vectorial)::ret,
00295 non_vectorial_image_with_dim<Dim, Exact>,
00296
00297 mlc::bool_case_<true,
00298 data_type_image_with_dim<Dim, Exact> >
00299
00300 > > > > > >::ret ret;
00309 };
00310
00311 }
00312
00313 }
00314
00315 #endif // ! OLENA_CORE_ABSTRACT_IMAGE_WITH_TYPE_WITH_DIM_HH