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_VISITOR_HH
00026 #define IMG_IMAGE_STATE_VISITOR_HH
00027
00028 #include <ost/img/data_algorithm.hh>
00029 #include "image_state_impl.hh"
00030 #include "image_state_def.hh"
00031
00032 namespace ost { namespace img { namespace image_state {
00033
00035 class DLLEXPORT InvalidImageStateVisitor: public Error {
00036 public:
00037 InvalidImageStateVisitor(const String& m): Error(m) {}
00038 };
00039
00040
00041
00042
00043
00044
00045
00046 #define IMAGE_STATE_VISITOR_CTOR_ADAPTERS(CLASS) \
00047 \
00048 CLASS (): FNC() {} \
00049 \
00050 template <class P0> \
00051 CLASS (const P0& p0): \
00052 FNC(p0) {} \
00053 \
00054 template <class P0, \
00055 class P1> \
00056 CLASS (const P0& p0, \
00057 const P1& p1): \
00058 FNC(p0,p1) {} \
00059 \
00060 template <class P0, \
00061 class P1, \
00062 class P2> \
00063 CLASS (const P0& p0, \
00064 const P1& p1, \
00065 const P2& p2): \
00066 FNC(p0,p1,p2) {} \
00067 \
00068 template <class P0, \
00069 class P1, \
00070 class P2, \
00071 class P3> \
00072 CLASS (const P0& p0, \
00073 const P1& p1, \
00074 const P2& p2, \
00075 const P3& p3): \
00076 FNC(p0,p1,p2,p3) {} \
00077 \
00078 template <class P0, \
00079 class P1, \
00080 class P2, \
00081 class P3, \
00082 class P4> \
00083 CLASS (const P0& p0, \
00084 const P1& p1, \
00085 const P2& p2, \
00086 const P3& p3, \
00087 const P4& p4): \
00088 FNC(p0,p1,p2,p3,p4) {} \
00089 \
00090 template <class P0, \
00091 class P1, \
00092 class P2, \
00093 class P3, \
00094 class P4, \
00095 class P5> \
00096 CLASS (const P0& p0, \
00097 const P1& p1, \
00098 const P2& p2, \
00099 const P3& p3, \
00100 const P4& p4, \
00101 const P5& p5): \
00102 FNC(p0,p1,p2,p3,p4,p5) {} \
00103 \
00104 template <class P0, \
00105 class P1, \
00106 class P2, \
00107 class P3, \
00108 class P4, \
00109 class P5, \
00110 class P6> \
00111 CLASS (const P0& p0, \
00112 const P1& p1, \
00113 const P2& p2, \
00114 const P3& p3, \
00115 const P4& p4, \
00116 const P5& p5, \
00117 const P6& p6): \
00118 FNC(p0,p1,p2,p3,p4,p5,p6) {} \
00119 \
00120 template <class P0, \
00121 class P1, \
00122 class P2, \
00123 class P3, \
00124 class P4, \
00125 class P5, \
00126 class P6, \
00127 class P7> \
00128 CLASS (const P0& p0, \
00129 const P1& p1, \
00130 const P2& p2, \
00131 const P3& p3, \
00132 const P4& p4, \
00133 const P5& p5, \
00134 const P6& p6, \
00135 const P7& p7): \
00136 FNC(p0,p1,p2,p3,p4,p5,p6,p7) {} \
00137 \
00138 template <class P0, \
00139 class P1, \
00140 class P2, \
00141 class P3, \
00142 class P4, \
00143 class P5, \
00144 class P6, \
00145 class P7, \
00146 class P8> \
00147 CLASS (const P0& p0, \
00148 const P1& p1, \
00149 const P2& p2, \
00150 const P3& p3, \
00151 const P4& p4, \
00152 const P5& p5, \
00153 const P6& p6, \
00154 const P7& p7, \
00155 const P8& p8): \
00156 FNC(p0,p1,p2,p3,p4,p5,p6,p7,p8) {} \
00157 \
00158 template <class P0, \
00159 class P1, \
00160 class P2, \
00161 class P3, \
00162 class P4, \
00163 class P5, \
00164 class P6, \
00165 class P7, \
00166 class P8, \
00167 class P9> \
00168 CLASS (const P0& p0, \
00169 const P1& p1, \
00170 const P2& p2, \
00171 const P3& p3, \
00172 const P4& p4, \
00173 const P5& p5, \
00174 const P6& p6, \
00175 const P7& p7, \
00176 const P8& p8, \
00177 const P9& p9): \
00178 FNC(p0,p1,p2,p3,p4,p5,p6,p7,p8,p9) {} \
00179 \
00180 template <class P0, \
00181 class P1, \
00182 class P2, \
00183 class P3, \
00184 class P4, \
00185 class P5, \
00186 class P6, \
00187 class P7, \
00188 class P8, \
00189 class P9, \
00190 class PA> \
00191 CLASS (const P0& p0, \
00192 const P1& p1, \
00193 const P2& p2, \
00194 const P3& p3, \
00195 const P4& p4, \
00196 const P5& p5, \
00197 const P6& p6, \
00198 const P7& p7, \
00199 const P8& p8, \
00200 const P9& p9, \
00201 const PA& pa): \
00202 FNC(p0,p1,p2,p3,p4,p5,p6,p7,p8,p9,pa) {} \
00203 \
00204 template <class P0, \
00205 class P1, \
00206 class P2, \
00207 class P3, \
00208 class P4, \
00209 class P5, \
00210 class P6, \
00211 class P7, \
00212 class P8, \
00213 class P9, \
00214 class PA, \
00215 class PB> \
00216 CLASS (const P0& p0, \
00217 const P1& p1, \
00218 const P2& p2, \
00219 const P3& p3, \
00220 const P4& p4, \
00221 const P5& p5, \
00222 const P6& p6, \
00223 const P7& p7, \
00224 const P8& p8, \
00225 const P9& p9, \
00226 const PA& pa, \
00227 const PB& pb): \
00228 FNC(p0,p1,p2,p3,p4,p5,p6,p7,p8,p9,pa,pb) {}
00229
00230
00232 class DLLEXPORT_OST_IMG_BASE ImageStateNonModVisitorBase {
00233 public:
00234 virtual ~ImageStateNonModVisitorBase() {}
00235 virtual void Visit_(const RealSpatialImageState& is) = 0;
00236 virtual void Visit_(const ComplexSpatialImageState& is) = 0;
00237 virtual void Visit_(const RealFrequencyImageState& is) = 0;
00238 virtual void Visit_(const ComplexFrequencyImageState& is) = 0;
00239 virtual void Visit_(const ComplexHalfFrequencyImageState& is) = 0;
00240 virtual void Visit_(const WordSpatialImageState& is) = 0;
00241 };
00242
00243
00245
00301 template <class FNC>
00302 class DLLEXPORT ImageStateNonModVisitor: public FNC, public ImageStateNonModVisitorBase {
00303 public:
00304
00305 IMAGE_STATE_VISITOR_CTOR_ADAPTERS(ImageStateNonModVisitor)
00306
00307
00308 virtual void Visit_(const RealSpatialImageState& is) {T_Visit_(is);}
00309 virtual void Visit_(const ComplexSpatialImageState& is) {T_Visit_(is);}
00310 virtual void Visit_(const RealFrequencyImageState& is) {T_Visit_(is);}
00311 virtual void Visit_(const ComplexFrequencyImageState& is) {T_Visit_(is);}
00312 virtual void Visit_(const ComplexHalfFrequencyImageState& is) {T_Visit_(is);}
00313 virtual void Visit_(const WordSpatialImageState& is) {T_Visit_(is);}
00314
00315 private:
00316 template <typename T, class D>
00317 void T_Visit_(const ImageStateImpl<T,D>& isi) {
00318 this->VisitState(isi);
00319 }
00320 };
00321
00322
00324 class DLLEXPORT_OST_IMG_BASE ImageStateModIPVisitorBase {
00325 public:
00326 ImageStateModIPVisitorBase(const String& name="") {}
00327 virtual ~ImageStateModIPVisitorBase() {}
00328 virtual void Visit_(RealSpatialImageState& is) = 0;
00329 virtual void Visit_(ComplexSpatialImageState& is) = 0;
00330 virtual void Visit_(RealFrequencyImageState& is) = 0;
00331 virtual void Visit_(ComplexFrequencyImageState& is) = 0;
00332 virtual void Visit_(ComplexHalfFrequencyImageState& is) = 0;
00333 virtual void Visit_(WordSpatialImageState& is) = 0;
00334 };
00335
00336
00338
00356 template <class FNC>
00357 class DLLEXPORT ImageStateModIPVisitor: public FNC, public ImageStateModIPVisitorBase {
00358 public:
00359 IMAGE_STATE_VISITOR_CTOR_ADAPTERS(ImageStateModIPVisitor)
00360
00361 virtual void Visit_(RealSpatialImageState& is) {T_Visit_(is);}
00362 virtual void Visit_(ComplexSpatialImageState& is) {T_Visit_(is);}
00363 virtual void Visit_(RealFrequencyImageState& is) {T_Visit_(is);}
00364 virtual void Visit_(ComplexFrequencyImageState& is) {T_Visit_(is);}
00365 virtual void Visit_(ComplexHalfFrequencyImageState& is) {T_Visit_(is);}
00366 virtual void Visit_(WordSpatialImageState& is) {T_Visit_(is);}
00367
00368 private:
00369 template <typename T, class D>
00370 void T_Visit_(ImageStateImpl<T,D>& isi) {
00371 this->VisitState(isi);
00372 }
00373 };
00374
00375
00377 class DLLEXPORT_OST_IMG_BASE ImageStateConstModIPVisitorBase {
00378 public:
00379 ImageStateConstModIPVisitorBase(const String& name="") {}
00380 virtual ~ImageStateConstModIPVisitorBase() {}
00381 virtual void Visit_(RealSpatialImageState& is) const = 0;
00382 virtual void Visit_(ComplexSpatialImageState& is) const = 0;
00383 virtual void Visit_(RealFrequencyImageState& is) const = 0;
00384 virtual void Visit_(ComplexFrequencyImageState& is) const = 0;
00385 virtual void Visit_(ComplexHalfFrequencyImageState& is) const = 0;
00386 virtual void Visit_(WordSpatialImageState& is) const = 0;
00387 };
00388
00389
00391
00411 template <class FNC>
00412 class DLLEXPORT_OST_IMG_BASE ImageStateConstModIPVisitor: public FNC, public ImageStateConstModIPVisitorBase {
00413 public:
00414 IMAGE_STATE_VISITOR_CTOR_ADAPTERS(ImageStateConstModIPVisitor)
00415
00416 virtual void Visit_(RealSpatialImageState& is) const {T_Visit_(is);}
00417 virtual void Visit_(ComplexSpatialImageState& is) const {T_Visit_(is);}
00418 virtual void Visit_(RealFrequencyImageState& is) const {T_Visit_(is);}
00419 virtual void Visit_(ComplexFrequencyImageState& is) const {T_Visit_(is);}
00420 virtual void Visit_(ComplexHalfFrequencyImageState& is) const {T_Visit_(is);}
00421 virtual void Visit_(WordSpatialImageState& is) const {T_Visit_(is);}
00422
00423 private:
00424 template <typename T, class D>
00425 void T_Visit_(ImageStateImpl<T,D>& isi) const {
00426 this->VisitState(isi);
00427 }
00428 };
00429
00430
00432 class DLLEXPORT_OST_IMG_BASE ImageStateModOPVisitorBase {
00433 public:
00434 ImageStateModOPVisitorBase(const String& name="") {}
00435 virtual ~ImageStateModOPVisitorBase() {}
00436 virtual ImageStateBasePtr Visit_(const RealSpatialImageState& is) = 0;
00437 virtual ImageStateBasePtr Visit_(const ComplexSpatialImageState& is) = 0;
00438 virtual ImageStateBasePtr Visit_(const RealFrequencyImageState& is) = 0;
00439 virtual ImageStateBasePtr Visit_(const ComplexFrequencyImageState& is) = 0;
00440 virtual ImageStateBasePtr Visit_(const ComplexHalfFrequencyImageState& is) = 0;
00441 virtual ImageStateBasePtr Visit_(const WordSpatialImageState& is) = 0;
00442 };
00443
00445
00463 template <class FNC>
00464 class DLLEXPORT ImageStateModOPVisitor: public FNC, public ImageStateModOPVisitorBase {
00465 public:
00466
00467 IMAGE_STATE_VISITOR_CTOR_ADAPTERS(ImageStateModOPVisitor)
00468
00469 virtual ImageStateBasePtr Visit_(const RealSpatialImageState& is) {return T_Visit_(is);}
00470 virtual ImageStateBasePtr Visit_(const ComplexSpatialImageState& is) {return T_Visit_(is);}
00471 virtual ImageStateBasePtr Visit_(const RealFrequencyImageState& is) {return T_Visit_(is);}
00472 virtual ImageStateBasePtr Visit_(const ComplexFrequencyImageState& is) {return T_Visit_(is);}
00473 virtual ImageStateBasePtr Visit_(const ComplexHalfFrequencyImageState& is) {return T_Visit_(is);}
00474 virtual ImageStateBasePtr Visit_(const WordSpatialImageState& is) {return T_Visit_(is);}
00475
00476 private:
00477 template <typename T, class D>
00478 ImageStateBasePtr T_Visit_(const ImageStateImpl<T,D>& isi) {
00479 return this->VisitState(isi);
00480 }
00481 };
00482
00483
00485 class DLLEXPORT_OST_IMG_BASE ImageStateConstModOPVisitorBase {
00486 public:
00487 ImageStateConstModOPVisitorBase(const String& name="") {}
00488 virtual ~ImageStateConstModOPVisitorBase() {}
00489 virtual ImageStateBasePtr Visit_(const RealSpatialImageState& is) const = 0;
00490 virtual ImageStateBasePtr Visit_(const ComplexSpatialImageState& is) const = 0;
00491 virtual ImageStateBasePtr Visit_(const RealFrequencyImageState& is) const = 0;
00492 virtual ImageStateBasePtr Visit_(const ComplexFrequencyImageState& is) const = 0;
00493 virtual ImageStateBasePtr Visit_(const ComplexHalfFrequencyImageState& is) const = 0;
00494 virtual ImageStateBasePtr Visit_(const WordSpatialImageState& is) const = 0;
00495 };
00496
00498
00518 template <class FNC>
00519 class DLLEXPORT_OST_IMG_BASE ImageStateConstModOPVisitor: public FNC, public ImageStateConstModOPVisitorBase {
00520 public:
00521
00522 IMAGE_STATE_VISITOR_CTOR_ADAPTERS(ImageStateConstModOPVisitor)
00523
00524 virtual ImageStateBasePtr Visit_(const RealSpatialImageState& is) const {return T_Visit_(is);}
00525 virtual ImageStateBasePtr Visit_(const ComplexSpatialImageState& is) const {return T_Visit_(is);}
00526 virtual ImageStateBasePtr Visit_(const RealFrequencyImageState& is) const {return T_Visit_(is);}
00527 virtual ImageStateBasePtr Visit_(const ComplexFrequencyImageState& is) const {return T_Visit_(is);}
00528 virtual ImageStateBasePtr Visit_(const ComplexHalfFrequencyImageState& is) const {return T_Visit_(is);}
00529 virtual ImageStateBasePtr Visit_(const WordSpatialImageState& is) const {return T_Visit_(is);}
00530
00531 private:
00532 template <typename T, class D>
00533 ImageStateBasePtr T_Visit_(const ImageStateImpl<T,D>& isi) const {
00534 return this->VisitState(isi);
00535 }
00536 };
00537
00539 class DLLEXPORT_OST_IMG_BASE ImageStateMorphVisitorBase {
00540 public:
00541 ImageStateMorphVisitorBase(const String& name="") {}
00542 virtual ~ImageStateMorphVisitorBase() {}
00543 virtual ImageStateBasePtr Visit_(RealSpatialImageState& is) = 0;
00544 virtual ImageStateBasePtr Visit_(ComplexSpatialImageState& is) = 0;
00545 virtual ImageStateBasePtr Visit_(RealFrequencyImageState& is) = 0;
00546 virtual ImageStateBasePtr Visit_(ComplexFrequencyImageState& is) = 0;
00547 virtual ImageStateBasePtr Visit_(ComplexHalfFrequencyImageState& is) = 0;
00548 virtual ImageStateBasePtr Visit_(WordSpatialImageState& is) = 0;
00549 };
00550
00552
00571 template <class FNC>
00572 class DLLEXPORT_OST_IMG_BASE ImageStateMorphVisitor: public FNC, public ImageStateMorphVisitorBase {
00573 public:
00574
00575 IMAGE_STATE_VISITOR_CTOR_ADAPTERS(ImageStateMorphVisitor)
00576
00577 virtual ImageStateBasePtr Visit_(RealSpatialImageState& is) {return T_Visit_(is);}
00578 virtual ImageStateBasePtr Visit_(ComplexSpatialImageState& is) {return T_Visit_(is);}
00579 virtual ImageStateBasePtr Visit_(RealFrequencyImageState& is) {return T_Visit_(is);}
00580 virtual ImageStateBasePtr Visit_(ComplexFrequencyImageState& is) {return T_Visit_(is);}
00581 virtual ImageStateBasePtr Visit_(ComplexHalfFrequencyImageState& is) {return T_Visit_(is);}
00582 virtual ImageStateBasePtr Visit_(WordSpatialImageState& is) {return T_Visit_(is);}
00583
00584 private:
00585 template <typename T, class D>
00586 ImageStateBasePtr T_Visit_(ImageStateImpl<T,D>& isi) {
00587 return this->VisitState(isi);
00588 }
00589 };
00590
00591 #undef IMAGE_STATE_VISITOR_CTOR_ADAPTERS
00592
00593 }}}
00594
00595 #endif