]> Creatis software - bbtk.git/blob - kernel/src/bbtkItkBlackBoxMacros.h
*** empty log message ***
[bbtk.git] / kernel / src / bbtkItkBlackBoxMacros.h
1 /*=========================================================================
2                                                                                 
3   Program:   bbtk
4   Module:    $RCSfile: bbtkItkBlackBoxMacros.h,v $
5   Language:  C++
6   Date:      $Date: 2008/05/07 12:59:23 $
7   Version:   $Revision: 1.3 $
8                                                                                 
9   Copyright (c) CREATIS (Centre de Recherche et d'Applications en Traitement de
10   l'Image). All rights reserved. See Doc/License.txt or
11   http://www.creatis.insa-lyon.fr/Public/bbtk/License.html for details.
12                                                                                 
13      This software is distributed WITHOUT ANY WARRANTY; without even
14      the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
15      PURPOSE.  See the above copyright notices for more information.
16                                                                                 
17 =========================================================================*/
18
19
20 /**
21  *  \file 
22  *  \brief Defines macros for the creation of itk object inherited black boxes
23  */
24 #ifndef __bbtkItkBlackBoxMacros_h__
25 #define __bbtkItkBlackBoxMacros_h__
26 //===========================================================================
27 //============================================================================
28 // ITK Specific macros
29 //===========================================================================
30 //===========================================================================
31
32 //===========================================================================
33 #define BBTK_ITK_DELETE()                                               \
34   void bbDelete() {                                                     \
35     itkParent::UnRegister();                                            \
36   }
37 //===========================================================================
38
39 //===========================================================================
40 #define BBTK_ITK_BLACK_BOX_INTERFACE(CLASS,PARENTBLACKBOX,ITKPARENT)    \
41   BBTK_BLACK_BOX_INTERFACE(CLASS,PARENTBLACKBOX);                       \
42   typedef ITKPARENT itkParent;                                          \
43   BBTK_ITK_DELETE();
44 //===========================================================================
45
46 //===========================================================================
47 /// Declares an itk-inherited AtomicBlackBox input 
48 #define BBTK_DECLARE_ITK_INPUT(NAME,TYPE)                               \
49   public:                                                               \
50   TYPE bbGetInput##NAME ()                                              \
51   { return itkParent::GetInput(); }                                     \
52   void bbSetInput##NAME (TYPE d)                                        \
53   { itkParent::SetInput(d);                                             \
54     /*bbSetModifiedStatus();*/ }                                                       
55 //===========================================================================
56
57 //===========================================================================
58 #define BBTK_DECLARE_ITK_OUTPUT(NAME,TYPE)                      \
59   public:                                                               \
60   TYPE bbGetOutput##NAME ()                                             \
61   { return itkParent::GetOutput(); }                                    \
62   void bbSetOutput##NAME (TYPE d)                                       \
63   { /*PARENT::GetOutput() = d;*/ }                                      
64 //===========================================================================
65
66 //===========================================================================
67 /// Declares an AtomicBlackBox input corresponding to an inherited itk parameter
68 /// which was declared by itkSetMacro/itkGetMacro
69 /// The NAME **MUST** be the same than the itk parameter name
70 #define BBTK_DECLARE_ITK_PARAM(NAME,TYPE)                       \
71   public:                                                               \
72   TYPE bbGetInput##NAME ()                                              \
73   { return itkParent::Get##NAME(); }                                    \
74   void bbSetInput##NAME (TYPE d)                                        \
75   { itkParent::Set##NAME(d);                                            \
76     /*bbSetModifiedStatus();*/ }
77 //===========================================================================
78
79 //============================================================================
80 /// Defines the default bbUserProcess method for itk inherited black boxes
81 /// (calls itkParent::Update)
82 #define BBTK_ITK_PROCESS()                                              \
83   public:                                                               \
84   inline void bbUserProcess()                                           \
85   {                                                                     \
86     bbtkDebugMessage("process",1,"**> Processing ["<<bbGetFullName()    \
87                      <<"]"<<std::endl);                                 \
88     itkParent::Update();                                                \
89     bbtkDebugMessage("process",2,"<** Processing ["<<bbGetFullName()    \
90                      <<"]"<<std::endl);                                 \
91   }
92 //============================================================================
93
94 //===========================================================================
95 /// EOF
96 //===========================================================================
97 #endif