]> Creatis software - bbtk.git/blob - kernel/src/bbtkVtkBlackBoxMacros.h
4fce6738d3826d3717dc7d2c5ab4a41a06d0184d
[bbtk.git] / kernel / src / bbtkVtkBlackBoxMacros.h
1 /*=========================================================================
2                                                                                 
3   Program:   bbtk
4   Module:    $RCSfile: bbtkVtkBlackBoxMacros.h,v $
5   Language:  C++
6   Date:      $Date: 2008/05/07 06:31:37 $
7   Version:   $Revision: 1.1 $
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 vtk object inherited black boxes
23  */
24 #ifndef __bbtkVtkBlackBoxMacros_h__
25 #define __bbtkVtkBlackBoxMacros_h__
26
27 //===========================================================================
28 //============================================================================
29 // VTK Specific macros
30 //===========================================================================
31 //===========================================================================
32
33
34 //===========================================================================
35
36 // EED sept 04                                                  \
37 //  { return GetInput(); /*PARENT::GetInput();*/ }              \
38 //  { PARENT::SetInput( /*(vtkDataObject*)*/ d);                                \
39
40
41
42 /// Declares a vtkImageAlgorithm-inherited AtomicBlackBox input 
43 #define BBTK_DECLARE_VTK_IMAGE_ALGORITHM_INPUT(PARENT,NAME,TYPE)                        \
44   public:                                                               \
45   TYPE bbGetInput##NAME ()                                              \
46   { return GetImageDataInput(0); /*PARENT::GetInput();*/ }              \
47   void bbSetInput##NAME (TYPE d)                                        \
48   { PARENT::SetInput( (vtkDataObject*) d);                              \
49     /*bbSetModifiedStatus();*/ }                                                       
50 //===========================================================================
51 /// Declares a vtkPolyDataAlgorithm-inherited AtomicBlackBox input 
52 #define BBTK_DECLARE_VTK_POLY_DATA_ALGORITHM_INPUT(PARENT,NAME,TYPE)    \
53   public:                                                               \
54   TYPE bbGetInput##NAME ()                                              \
55   { return GetPolyDataInput(0); /*PARENT::GetInput();*/ }               \
56   void bbSetInput##NAME (TYPE d)                                        \
57   { PARENT::SetInput( (vtkDataObject*) d);                              \
58     /*bbSetModifiedStatus();*/ }                                                       
59 //===========================================================================
60
61 //===========================================================================
62 /// Declares a vtkImageAlgorithm-inherited AtomicBlackBox output 
63 #define BBTK_DECLARE_VTK_OUTPUT(PARENT,NAME,TYPE)                       \
64   public:                                                               \
65   TYPE bbGetOutput##NAME ()                                             \
66   { return PARENT::GetOutput(); }                                       \
67   void bbSetOutput##NAME (TYPE d)                                       \
68   { /*PARENT::GetOutput() = d;*/ }                                      
69 //===========================================================================
70
71 //===========================================================================
72 /// Declares a vtkAlgorithm-inherited AtomicBlackBox input 
73 #define BBTK_DECLARE_VTK_INPUT(PARENT,NAME,TYPE)                        \
74   public:                                                               \
75   TYPE bbGetInput##NAME ()                                              \
76   { return dynamic_cast<TYPE>(PARENT::GetInput()); }                    \
77   void bbSetInput##NAME (TYPE d)                                        \
78   { PARENT::SetInput( (vtkDataObject*) d); /*PARENT::GetOutput() = d;*/ }
79
80 //===========================================================================
81
82 //===========================================================================
83 /// Declares an AtomicBlackBox input corresponding to an 
84 /// inherited vtk parameter
85 /// which was declared by vtkSetMacro/vtkGetMacro
86 /// The NAME **MUST** be the same than the vtk parameter name
87 #define BBTK_DECLARE_VTK_PARAM(PARENT,NAME,TYPE)                        \
88   public:                                                               \
89   TYPE bbGetInput##NAME ()                                              \
90   { return PARENT::Get##NAME(); }                                       \
91   void bbSetInput##NAME (TYPE d)                                        \
92   { PARENT::Set##NAME(d);                                               \
93     /*bbSetModifiedStatus();*/ }
94 //===========================================================================
95
96
97 //===========================================================================
98 #define BBTK_VTK_DELETE(VTKPARENT)                              \
99   void bbDelete() {                                             \
100     bbGetOutputOut()->SetSource(NULL);                          \
101     VTKPARENT::Delete(); }
102 //===========================================================================
103
104
105 //===========================================================================
106 /// EOF
107 //===========================================================================
108 #endif