25 #ifndef IMG_IMAGE_STATE_DISPATCH_HH
26 #define IMG_IMAGE_STATE_DISPATCH_HH
36 namespace ost {
namespace img {
namespace image_state {
45 template <
typename T,
class D>
66 template <
template <
typename T,
class D>
class FNC>
69 #define ISI_UNARY_DISPATCH_IP_CALL(TYPE,fnc,isb) \
70 else if(TYPE * is = dynamic_cast<TYPE *>(isb)) fnc(is)
83 #undef ISI_UNARY_DISPATCH_IP_CALL
85 template <
typename T,
class D>
106 template <
template <
typename T,
class D>
class FNC>
109 #define ISI_UNARY_DISPATCH_OP_CALL(TYPE,fnc,isb) \
110 else if(const TYPE * is = dynamic_cast<const TYPE *>(isb)) return fnc(is)
123 #undef ISI_UNARY_DISPATCH_OP_CALL
125 template <
typename T,
class D>
150 template <
template <
typename T1,
class D1,
typename T2,
class D2>
class FNC>
153 #define ISI_BINARY_DISPATCH_IP_CALL_LEFT(TYPE,fnc,lhs,rhs) \
154 else if(TYPE * is = dynamic_cast<TYPE *>(lhs)) fnc(is,rhs)
169 #undef ISI_BINARY_DISPATCH_IP_CALL_LEFT
171 #define ISI_BINARY_DISPATCH_IP_CALL_RIGHT(TYPE,fnc,lhs,rhs) \
172 else if(const TYPE * is = dynamic_cast<const TYPE *>(rhs)) fnc(lhs,is)
174 template <
typename T1,
class D1>
188 #undef ISI_BINARY_DISPATCH_IP_CALL_RIGHT
190 template <
typename T1,
class D1,
typename T2,
class D2>
192 static FNC<T1,D1,T2,D2> fnc;
213 template <
template <
typename T1,
class D1,
typename T2,
class D2>
class FNC>
216 #define ISI_BINARY_DISPATCH_OP_CALL_LEFT(TYPE,fnc,lhs,rhs) \
217 else if(const TYPE * is = dynamic_cast<const TYPE *>(lhs)) return fnc(is,rhs)
230 #undef ISI_BINARY_DISPATCH_OP_CALL_LEFT
232 #define ISI_BINARY_DISPATCH_OP_CALL_RIGHT(TYPE,fnc,lhs,rhs) \
233 else if(const TYPE * is = dynamic_cast<const TYPE *>(rhs)) return fnc(lhs,is)
235 template <
typename T1,
class D1>
247 #undef ISI_BINARY_DISPATCH_OP_CALL_RIGHT
249 template <
typename T1,
class D1,
typename T2,
class D2>
251 static FNC<T1,D1,T2,D2> fnc;
void right(ImageStateImpl< T1, D1 > *lhs, const ImageStateImpl< T2, D2 > *rhs)
#define ISI_UNARY_DISPATCH_IP_CALL(TYPE, fnc, isb)
#define ISI_BINARY_DISPATCH_OP_CALL_RIGHT(TYPE, fnc, lhs, rhs)
ImageStateBasePtr operator()(const ImageStateBase *isb)
#define ISI_BINARY_DISPATCH_OP_CALL_LEFT(TYPE, fnc, lhs, rhs)
void call(ImageStateImpl< T, D > *isi)
#define ISI_BINARY_DISPATCH_IP_CALL_RIGHT(TYPE, fnc, lhs, rhs)
ImageStateBasePtr left(const ImageStateImpl< T1, D1 > *lhs, const ImageStateBase *rhs)
void operator()(ImageStateBase *isb)
void operator()(ImageStateBase *lhs, const ImageStateBase *rhs)
ImageStateBasePtr right(const ImageStateImpl< T1, D1 > *lhs, const ImageStateImpl< T2, D2 > *rhs)
#define ISI_UNARY_DISPATCH_OP_CALL(TYPE, fnc, isb)
out-of-place binary dispatch
ImageStateBasePtr operator()(const ImageStateBase *lhs, const ImageStateBase *rhs)
ImageStateBasePtr call(const ImageStateImpl< T, D > *isi)
boost::shared_ptr< ImageStateBase > ImageStateBasePtr
Out-of-place unary dispatch.
void left(ImageStateImpl< T1, D1 > *lhs, const ImageStateBase *rhs)
#define ISI_BINARY_DISPATCH_IP_CALL_LEFT(TYPE, fnc, lhs, rhs)
DispatchException(const String &m)