]> Creatis software - bbtk.git/blob - kernel/src/bbtkItkBlackBoxMacros.h
28944657cb20ebb75bfa3b4d3f2cf3fa0c313467
[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 07:26:50 $
7   Version:   $Revision: 1.2 $
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 #define BBTK_ITK_BLACK_BOX_INTERFACE(CLASS,PARENTBLACKBOX,ITKPARENT)    \
40   BBTK_BLACK_BOX_INTERFACE(CLASS,PARENTBLACKBOX);                       \
41   typedef ITKPARENT itkParent;                                          \
42   BBTK_ITK_DELETE();
43 //===========================================================================
44
45 //===========================================================================
46 /// Declares an itk-inherited AtomicBlackBox input 
47 #define BBTK_DECLARE_ITK_INPUT(NAME,TYPE)                               \
48   public:                                                               \
49   TYPE bbGetInput##NAME ()                                              \
50   { return itkParent::GetInput(); }                                     \
51   void bbSetInput##NAME (TYPE d)                                        \
52   { itkParent::SetInput(d);                                             \
53     /*bbSetModifiedStatus();*/ }                                                       
54 //===========================================================================
55
56 //===========================================================================
57 #define BBTK_DECLARE_ITK_OUTPUT(NAME,TYPE)                      \
58   public:                                                               \
59   TYPE bbGetOutput##NAME ()                                             \
60   { return itkParent::GetOutput(); }                                    \
61   void bbSetOutput##NAME (TYPE d)                                       \
62   { /*PARENT::GetOutput() = d;*/ }                                      
63 //===========================================================================
64
65 //===========================================================================
66 /// Declares an AtomicBlackBox input corresponding to an inherited itk parameter
67 /// which was declared by itkSetMacro/itkGetMacro
68 /// The NAME **MUST** be the same than the itk parameter name
69 #define BBTK_DECLARE_ITK_PARAM(NAME,TYPE)                       \
70   public:                                                               \
71   TYPE bbGetInput##NAME ()                                              \
72   { return itkParent::Get##NAME(); }                                    \
73   void bbSetInput##NAME (TYPE d)                                        \
74   { itkParent::Set##NAME(d);                                            \
75     /*bbSetModifiedStatus();*/ }
76 //===========================================================================
77
78 //============================================================================
79 /// Defines the default bbUserProcess method for itk inherited black boxes
80 /// (calls itkParent::Update)
81 #define BBTK_ITK_PROCESS()                                              \
82   public:                                                               \
83   inline void bbUserProcess()                                           \
84   {                                                                     \
85     bbtkDebugMessage("process",1,"**> Processing ["<<bbGetFullName()    \
86                      <<"]"<<std::endl);                                 \
87     itkParent::Update();                                                \
88     bbtkDebugMessage("process",2,"<** Processing ["<<bbGetFullName()    \
89                      <<"]"<<std::endl);                                 \
90   }
91 //============================================================================
92
93 //===========================================================================
94 /// EOF
95 //===========================================================================
96 #endif