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 #ifndef IMG_IMAGE_STATE_ALGORITHM_HH
00026 #define IMG_IMAGE_STATE_ALGORITHM_HH
00027
00028 #include <ost/img/image.hh>
00029 #include <ost/img/data_algorithm.hh>
00030
00031 #include "image_state_visitor.hh"
00032
00033 namespace ost { namespace img { namespace image_state {
00034
00035
00036
00037
00038
00039
00040
00041
00042
00043
00044 #define IMAGE_STATE_VISITOR_CTOR_ADAPTERS(CLASS, BASE ) \
00045 \
00046 CLASS (): FNC(), BASE (FNC::GetAlgorithmName()) {} \
00047 \
00048 template <class P0> \
00049 CLASS (const P0& p0): \
00050 FNC(p0), BASE (FNC::GetAlgorithmName()) {} \
00051 \
00052 template <class P0, \
00053 class P1> \
00054 CLASS (const P0& p0, \
00055 const P1& p1): \
00056 FNC(p0,p1), BASE (FNC::GetAlgorithmName()) {} \
00057 \
00058 template <class P0, \
00059 class P1, \
00060 class P2> \
00061 CLASS (const P0& p0, \
00062 const P1& p1, \
00063 const P2& p2): \
00064 FNC(p0,p1,p2), BASE (FNC::GetAlgorithmName()) {} \
00065 \
00066 template <class P0, \
00067 class P1, \
00068 class P2, \
00069 class P3> \
00070 CLASS (const P0& p0, \
00071 const P1& p1, \
00072 const P2& p2, \
00073 const P3& p3): \
00074 FNC(p0,p1,p2,p3), BASE (FNC::GetAlgorithmName()) {} \
00075 \
00076 template <class P0, \
00077 class P1, \
00078 class P2, \
00079 class P3, \
00080 class P4> \
00081 CLASS (const P0& p0, \
00082 const P1& p1, \
00083 const P2& p2, \
00084 const P3& p3, \
00085 const P4& p4): \
00086 FNC(p0,p1,p2,p3,p4), BASE (FNC::GetAlgorithmName()) {} \
00087 \
00088 template <class P0, \
00089 class P1, \
00090 class P2, \
00091 class P3, \
00092 class P4, \
00093 class P5> \
00094 CLASS (const P0& p0, \
00095 const P1& p1, \
00096 const P2& p2, \
00097 const P3& p3, \
00098 const P4& p4, \
00099 const P5& p5): \
00100 FNC(p0,p1,p2,p3,p4,p5), BASE (FNC::GetAlgorithmName()) {} \
00101 \
00102 template <class P0, \
00103 class P1, \
00104 class P2, \
00105 class P3, \
00106 class P4, \
00107 class P5, \
00108 class P6> \
00109 CLASS (const P0& p0, \
00110 const P1& p1, \
00111 const P2& p2, \
00112 const P3& p3, \
00113 const P4& p4, \
00114 const P5& p5, \
00115 const P6& p6): \
00116 FNC(p0,p1,p2,p3,p4,p5,p6), BASE (FNC::GetAlgorithmName()) {} \
00117 \
00118 template <class P0, \
00119 class P1, \
00120 class P2, \
00121 class P3, \
00122 class P4, \
00123 class P5, \
00124 class P6, \
00125 class P7> \
00126 CLASS (const P0& p0, \
00127 const P1& p1, \
00128 const P2& p2, \
00129 const P3& p3, \
00130 const P4& p4, \
00131 const P5& p5, \
00132 const P6& p6, \
00133 const P7& p7): \
00134 FNC(p0,p1,p2,p3,p4,p5,p6,p7), BASE (FNC::GetAlgorithmName()) {} \
00135 \
00136 template <class P0, \
00137 class P1, \
00138 class P2, \
00139 class P3, \
00140 class P4, \
00141 class P5, \
00142 class P6, \
00143 class P7, \
00144 class P8> \
00145 CLASS (const P0& p0, \
00146 const P1& p1, \
00147 const P2& p2, \
00148 const P3& p3, \
00149 const P4& p4, \
00150 const P5& p5, \
00151 const P6& p6, \
00152 const P7& p7, \
00153 const P8& p8): \
00154 FNC(p0,p1,p2,p3,p4,p5,p6,p7,p8), BASE (FNC::GetAlgorithmName()) {} \
00155 \
00156 template <class P0, \
00157 class P1, \
00158 class P2, \
00159 class P3, \
00160 class P4, \
00161 class P5, \
00162 class P6, \
00163 class P7, \
00164 class P8, \
00165 class P9> \
00166 CLASS (const P0& p0, \
00167 const P1& p1, \
00168 const P2& p2, \
00169 const P3& p3, \
00170 const P4& p4, \
00171 const P5& p5, \
00172 const P6& p6, \
00173 const P7& p7, \
00174 const P8& p8, \
00175 const P9& p9): \
00176 FNC(p0,p1,p2,p3,p4,p5,p6,p7,p8,p9), BASE (FNC::GetAlgorithmName()) {} \
00177 \
00178 template <class P0, \
00179 class P1, \
00180 class P2, \
00181 class P3, \
00182 class P4, \
00183 class P5, \
00184 class P6, \
00185 class P7, \
00186 class P8, \
00187 class P9, \
00188 class PA> \
00189 CLASS (const P0& p0, \
00190 const P1& p1, \
00191 const P2& p2, \
00192 const P3& p3, \
00193 const P4& p4, \
00194 const P5& p5, \
00195 const P6& p6, \
00196 const P7& p7, \
00197 const P8& p8, \
00198 const P9& p9, \
00199 const PA& pa): \
00200 FNC(p0,p1,p2,p3,p4,p5,p6,p7,p8,p9,pa), BASE (FNC::GetAlgorithmName()) {} \
00201 \
00202 template <class P0, \
00203 class P1, \
00204 class P2, \
00205 class P3, \
00206 class P4, \
00207 class P5, \
00208 class P6, \
00209 class P7, \
00210 class P8, \
00211 class P9, \
00212 class PA, \
00213 class PB> \
00214 CLASS (const P0& p0, \
00215 const P1& p1, \
00216 const P2& p2, \
00217 const P3& p3, \
00218 const P4& p4, \
00219 const P5& p5, \
00220 const P6& p6, \
00221 const P7& p7, \
00222 const P8& p8, \
00223 const P9& p9, \
00224 const PA& pa, \
00225 const PB& pb): \
00226 FNC(p0,p1,p2,p3,p4,p5,p6,p7,p8,p9,pa,pb), BASE (FNC::GetAlgorithmName()) {}
00227
00228
00230
00255 template <class FNC>
00256 class TEMPLATE_EXPORT ImageStateNonModAlgorithm: public FNC, public NonModAlgorithm, public ImageStateNonModVisitorBase {
00257 public:
00258
00259 IMAGE_STATE_VISITOR_CTOR_ADAPTERS(ImageStateNonModAlgorithm, NonModAlgorithm )
00260
00261
00262 virtual void Visit_(const RealSpatialImageState& is) {T_Visit_(is);}
00263 virtual void Visit_(const ComplexSpatialImageState& is) {T_Visit_(is);}
00264 virtual void Visit_(const RealFrequencyImageState& is) {T_Visit_(is);}
00265 virtual void Visit_(const ComplexFrequencyImageState& is) {T_Visit_(is);}
00266 virtual void Visit_(const ComplexHalfFrequencyImageState& is) {T_Visit_(is);}
00267 virtual void Visit_(const WordSpatialImageState& is) {T_Visit_(is);}
00268
00269
00270 virtual void Visit(const ConstImageHandle& h) {
00271 h.StateApply(*this);
00272 }
00273
00274 private:
00275
00276
00277
00278
00279 template <typename T, class D>
00280 void T_Visit_(const ImageStateImpl<T,D>& isi) {
00281 this->VisitState(isi);
00282 }
00283
00284 };
00285
00286
00288
00306 template <class FNC>
00307 class TEMPLATE_EXPORT ImageStateModIPAlgorithm: public FNC, public ModIPAlgorithm, public ImageStateModIPVisitorBase {
00308 public:
00309 IMAGE_STATE_VISITOR_CTOR_ADAPTERS(ImageStateModIPAlgorithm, ModIPAlgorithm)
00310
00311 virtual void Visit_(RealSpatialImageState& is) {T_Visit_(is);}
00312 virtual void Visit_(ComplexSpatialImageState& is) {T_Visit_(is);}
00313 virtual void Visit_(RealFrequencyImageState& is) {T_Visit_(is);}
00314 virtual void Visit_(ComplexFrequencyImageState& is) {T_Visit_(is);}
00315 virtual void Visit_(ComplexHalfFrequencyImageState& is) {T_Visit_(is);}
00316 virtual void Visit_(WordSpatialImageState& is) {T_Visit_(is);}
00317
00318
00319 virtual void Visit(ImageHandle& h) {
00320 h.StateApplyIP(*this);
00321 }
00322
00323 private:
00324 template <typename T, class D>
00325 void T_Visit_(ImageStateImpl<T,D>& isi) {
00326 this->VisitState(isi);
00327 }
00328 };
00329
00331
00349 template <class FNC>
00350 class TEMPLATE_EXPORT ImageStateConstModIPAlgorithm: public FNC,
00351 public ConstModIPAlgorithm,
00352 public ImageStateConstModIPVisitorBase {
00353 public:
00354 IMAGE_STATE_VISITOR_CTOR_ADAPTERS(ImageStateConstModIPAlgorithm, ConstModIPAlgorithm)
00355
00356 virtual void Visit_(RealSpatialImageState& is) const {T_Visit_(is);}
00357 virtual void Visit_(ComplexSpatialImageState& is) const {T_Visit_(is);}
00358 virtual void Visit_(RealFrequencyImageState& is) const {T_Visit_(is);}
00359 virtual void Visit_(ComplexFrequencyImageState& is) const {T_Visit_(is);}
00360 virtual void Visit_(ComplexHalfFrequencyImageState& is) const {T_Visit_(is);}
00361 virtual void Visit_(WordSpatialImageState& is) const {T_Visit_(is);}
00362
00363
00364 virtual void Visit(ImageHandle& h) const {
00365 h.StateApplyIP(*this);
00366 }
00367
00368 private:
00369 template <typename T, class D>
00370 void T_Visit_(ImageStateImpl<T,D>& isi) const {
00371 this->VisitState(isi);
00372 }
00373 };
00374
00376 template <class FNC>
00377 class TEMPLATE_EXPORT ImageStateModOPAlgorithm: public FNC, public ModOPAlgorithm, public ImageStateModOPVisitorBase {
00378 public:
00379
00380 IMAGE_STATE_VISITOR_CTOR_ADAPTERS(ImageStateModOPAlgorithm, ModOPAlgorithm)
00381
00382 virtual ImageStateBasePtr Visit_(const RealSpatialImageState& is) {return T_Visit_(is);}
00383 virtual ImageStateBasePtr Visit_(const ComplexSpatialImageState& is) {return T_Visit_(is);}
00384 virtual ImageStateBasePtr Visit_(const RealFrequencyImageState& is) {return T_Visit_(is);}
00385 virtual ImageStateBasePtr Visit_(const ComplexFrequencyImageState& is) {return T_Visit_(is);}
00386 virtual ImageStateBasePtr Visit_(const ComplexHalfFrequencyImageState& is) {return T_Visit_(is);}
00387 virtual ImageStateBasePtr Visit_(const WordSpatialImageState& is) {return T_Visit_(is);}
00388
00389
00390 virtual ImageHandle Visit(const ConstImageHandle& h) {
00391 return h.StateApply(*this);
00392 }
00393
00394 private:
00395 template <typename T, class D>
00396 ImageStateBasePtr T_Visit_(const ImageStateImpl<T,D>& isi) {
00397 return this->VisitState(isi);
00398 }
00399 };
00400
00402 template <class FNC>
00403 class TEMPLATE_EXPORT ImageStateConstModOPAlgorithm: public FNC,
00404 public ConstModOPAlgorithm,
00405 public ImageStateConstModOPVisitorBase {
00406 public:
00407
00408 IMAGE_STATE_VISITOR_CTOR_ADAPTERS(ImageStateConstModOPAlgorithm, ConstModOPAlgorithm)
00409
00410 virtual ImageStateBasePtr Visit_(const RealSpatialImageState& is) const {return T_Visit_(is);}
00411 virtual ImageStateBasePtr Visit_(const ComplexSpatialImageState& is) const {return T_Visit_(is);}
00412 virtual ImageStateBasePtr Visit_(const RealFrequencyImageState& is) const {return T_Visit_(is);}
00413 virtual ImageStateBasePtr Visit_(const ComplexFrequencyImageState& is) const {return T_Visit_(is);}
00414 virtual ImageStateBasePtr Visit_(const ComplexHalfFrequencyImageState& is) const {return T_Visit_(is);}
00415 virtual ImageStateBasePtr Visit_(const WordSpatialImageState& is) const {return T_Visit_(is);}
00416
00417
00418 virtual ImageHandle Visit(const ConstImageHandle& h) const {
00419 return h.StateApply(*this);
00420 }
00421
00422 private:
00423 template <typename T, class D>
00424 ImageStateBasePtr T_Visit_(const ImageStateImpl<T,D>& isi) const {
00425 return this->VisitState(isi);
00426 }
00427 };
00428
00429
00431 template <class FNC>
00432 class TEMPLATE_EXPORT ImageStateMorphAlgorithm: public FNC, public ModIPAlgorithm, public ImageStateMorphVisitorBase {
00433 public:
00434
00435 IMAGE_STATE_VISITOR_CTOR_ADAPTERS(ImageStateMorphAlgorithm, ModIPAlgorithm)
00436
00437 virtual ImageStateBasePtr Visit_(RealSpatialImageState& is) {return T_Visit_(is);}
00438 virtual ImageStateBasePtr Visit_(ComplexSpatialImageState& is) {return T_Visit_(is);}
00439 virtual ImageStateBasePtr Visit_(RealFrequencyImageState& is) {return T_Visit_(is);}
00440 virtual ImageStateBasePtr Visit_(ComplexFrequencyImageState& is) {return T_Visit_(is);}
00441 virtual ImageStateBasePtr Visit_(ComplexHalfFrequencyImageState& is) {return T_Visit_(is);}
00442 virtual ImageStateBasePtr Visit_(WordSpatialImageState& is) {return T_Visit_(is);}
00443
00444
00445 virtual void Visit(ImageHandle& h) {
00446 h.StateApply(*this);
00447 }
00448
00449 private:
00450 template <typename T, class D>
00451 ImageStateBasePtr T_Visit_(ImageStateImpl<T,D>& isi) {
00452 return this->VisitState(isi);
00453 }
00454 };
00455
00456 #undef IMAGE_STATE_VISITOR_CTOR_ADAPTERS
00457
00458 }}}
00459
00460 #endif