20 #ifndef __itkConceptChecking_h
21 #define __itkConceptChecking_h
23 #include "itkPixelTraits.h"
24 #include "itkNumericTraits.h"
28 #ifndef ITK_CONCEPT_NO_CHECKING
29 # if defined(_MSC_VER) && !defined(__ICL)
30 # define ITK_CONCEPT_IMPLEMENTATION_VTABLE
31 # elif defined(__BORLANDC__) && (__BORLANDC__ <= 0x551)
32 # define ITK_CONCEPT_IMPLEMENTATION_VTABLE
33 # elif defined(__MWERKS__) && (__MWERKS__ <= 0x3002)
34 # define ITK_CONCEPT_IMPLEMENTATION_VTABLE
35 # elif defined(__SUNPRO_CC)
36 # define ITK_CONCEPT_IMPLEMENTATION_VTABLE
38 # define ITK_CONCEPT_IMPLEMENTATION_STANDARD
43 #if defined(ITK_CONCEPT_IMPLEMENTATION_STANDARD)
55 # define itkConceptConstraintsMacro() \
56 template <void (Constraints::*)()> struct Enforcer {}; \
57 typedef Enforcer<&Constraints::constraints> EnforcerInstantiation
58 # define itkConceptMacro(name, concept) enum { name = sizeof concept }
60 #elif defined(ITK_CONCEPT_IMPLEMENTATION_VTABLE)
67 # define itkConceptConstraintsMacro() \
68 virtual void Enforcer() { &Constraints::constraints; }
69 # define itkConceptMacro(name, concept) enum { name = sizeof concept }
71 #elif defined(ITK_CONCEPT_IMPLEMENTATION_CALL)
74 # define itkConceptConstraintsMacro()
75 # define itkConceptMacro(name, concept) enum { name = 0 }
80 # define itkConceptConstraintsMacro()
81 # define itkConceptMacro(name, concept) enum { name = 0 }
132 template <
typename T>
148 template <
typename T>
174 template <
typename T1,
typename T2>
181 T2 b =
static_cast<T2
>(
a);
190 template <
typename T>
212 template <
typename T1,
typename T2=T1>
231 template <
typename T1,
typename T2=T1>
250 template <
typename T1,
typename T2=T1>
269 template <
typename T1,
typename T2=T1>
292 template <
typename T1,
typename T2=T1,
typename T3=T1>
299 a =
static_cast<T3
>(
b +
c);
300 a =
static_cast<T3
>(
b -
c);
301 a +=
static_cast<T3
>(
c);
302 a -=
static_cast<T3
>(
c);
307 a =
static_cast<T3
>(d + e);
308 a =
static_cast<T3
>(d - e);
309 a +=
static_cast<T3
>(e);
310 a -=
static_cast<T3
>(e);
321 template <
typename T1,
typename T2=T1,
typename T3=T1>
328 a =
static_cast<T3
>(
b *
c);
333 a =
static_cast<T3
>(d * e);
343 template <
typename T1,
typename T2=T1>
350 a *=
static_cast<T2
>(
b);
355 a *=
static_cast<T2
>(d);
365 template <
typename T1,
typename T2=T1,
typename T3=T1>
372 a =
static_cast<T3
>(
b /
c);
378 a =
static_cast<T3
>(d / e);
391 template <
typename T1,
typename T2=T1,
typename T3=T1>
398 a =
static_cast<T3
>(
b &
c);
399 a =
static_cast<T3
>(
b |
c);
400 a =
static_cast<T3
>(
b ^
c);
401 a &=
static_cast<T3
>(
c);
402 a |=
static_cast<T3
>(
c);
403 a ^=
static_cast<T3
>(
c);
408 a =
static_cast<T3
>(d & e);
409 a =
static_cast<T3
>(d | e);
410 a =
static_cast<T3
>(d ^ e);
411 a &=
static_cast<T3
>(e);
412 a |=
static_cast<T3
>(e);
413 a ^=
static_cast<T3
>(e);
424 template <
typename T1,
typename T2=T1,
typename T3=T1>
431 a =
static_cast<T3
>(
b [
c ]);
436 a =
static_cast<T3
>(d [ e ]);
448 template <
typename T>
464 template <
typename T>
483 template <
typename T>
499 template <
typename T>
503 itkStaticConstMacro(
IsSigned,
bool, NumericTraits<T>::is_signed);
519 template <
typename T1,
typename T2>
534 template <
unsigned int D1,
unsigned int D2>
551 template <
typename T>
558 typedef typename NumericTraits<T>::ValueType ValueType;
559 typedef typename NumericTraits<T>::PrintType PrintType;
560 typedef typename NumericTraits<T>::AbsType AbsType;
561 typedef typename NumericTraits<T>::AccumulateType AccumulateType;
562 typedef typename NumericTraits<T>::RealType RealType;
563 typedef typename NumericTraits<T>::ScalarRealType ScalarRealType;
564 typedef typename NumericTraits<T>::FloatType FloatType;
567 a = NumericTraits<T>::Zero;
568 a = NumericTraits<T>::One;
569 a = NumericTraits<T>::NonpositiveMin();
570 a = NumericTraits<T>::ZeroValue();
571 b = NumericTraits<T>::IsPositive(a);
572 b = NumericTraits<T>::IsNonpositive(a);
573 b = NumericTraits<T>::IsNegative(a);
574 b = NumericTraits<T>::IsNonnegative(a);
584 template <
typename T>
591 typedef typename PixelTraits<T>::ValueType ValueType;
592 unsigned int a = PixelTraits<T>::Dimension;
601 template <
typename T>
608 typedef typename T::ValueType ValueType;
617 template <
typename T>
625 a = NumericTraits<T>::Zero;
634 template <
typename T1,
typename T2>
641 typedef typename JoinTraits<T1, T2>::ValueType ValueType;
649 template <
unsigned int D1,
unsigned int D2>
670 template <
typename T>
674 itkStaticConstMacro(
Integral,
bool, NumericTraits<T>::is_integer);
690 template <
typename T>
694 itkStaticConstMacro(
NonIntegral,
bool, NumericTraits<T>::is_integer);
710 template <
typename T>
714 itkStaticConstMacro(
Integral,
bool, NumericTraits<T>::is_integer);
715 itkStaticConstMacro(
IsExact,
bool, NumericTraits<T>::is_exact);
734 template <
typename T>
738 itkStaticConstMacro(
Integral,
bool, NumericTraits<T>::is_integer);
739 itkStaticConstMacro(
IsExact,
bool, NumericTraits<T>::is_exact);