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;
DispatchException(const String &m)
#define ISI_BINARY_DISPATCH_IP_CALL_RIGHT(TYPE, fnc, lhs, rhs)
#define ISI_BINARY_DISPATCH_OP_CALL_RIGHT(TYPE, fnc, lhs, rhs)
#define ISI_BINARY_DISPATCH_OP_CALL_LEFT(TYPE, fnc, lhs, rhs)
#define ISI_UNARY_DISPATCH_OP_CALL(TYPE, fnc, isb)
#define ISI_UNARY_DISPATCH_IP_CALL(TYPE, fnc, isb)
#define ISI_BINARY_DISPATCH_IP_CALL_LEFT(TYPE, fnc, lhs, rhs)
boost::shared_ptr< ImageStateBase > ImageStateBasePtr
void right(ImageStateImpl< T1, D1 > *lhs, const ImageStateImpl< T2, D2 > *rhs)
void operator()(ImageStateBase *lhs, const ImageStateBase *rhs)
void left(ImageStateImpl< T1, D1 > *lhs, const ImageStateBase *rhs)
out-of-place binary dispatch
ImageStateBasePtr right(const ImageStateImpl< T1, D1 > *lhs, const ImageStateImpl< T2, D2 > *rhs)
ImageStateBasePtr left(const ImageStateImpl< T1, D1 > *lhs, const ImageStateBase *rhs)
ImageStateBasePtr operator()(const ImageStateBase *lhs, const ImageStateBase *rhs)
void operator()(ImageStateBase *isb)
void call(ImageStateImpl< T, D > *isi)
Out-of-place unary dispatch.
ImageStateBasePtr call(const ImageStateImpl< T, D > *isi)
ImageStateBasePtr operator()(const ImageStateBase *isb)