1 /*=========================================================================
4 Module: $RCSfile: bbtkVtkBlackBoxMacros.h,v $
6 Date: $Date: 2008/05/07 12:59:23 $
7 Version: $Revision: 1.3 $
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.
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.
17 =========================================================================*/
22 * \brief Defines macros for the creation of vtk object inherited black boxes
24 #ifndef __bbtkVtkBlackBoxMacros_h__
25 #define __bbtkVtkBlackBoxMacros_h__
26 #include <vtkGarbageCollector.h>
29 //===========================================================================
30 //============================================================================
31 // VTK Specific macros
32 //===========================================================================
33 //===========================================================================
36 //===========================================================================
37 #define BBTK_VTK_DELETE() \
39 bbGetOutputOut()->SetSource(NULL); \
40 /* vtkParent::SetReferenceCount(0);*/ \
41 bbmDescriptorPointer.reset(); \
42 vtkParent::Delete(); \
45 #define BBTK_VTK_BLACK_BOX_INTERFACE(CLASS,PARENTBLACKBOX,VTKPARENT) \
46 BBTK_BLACK_BOX_INTERFACE(CLASS,PARENTBLACKBOX); \
47 typedef VTKPARENT vtkParent; \
50 /// Declares a vtkImageAlgorithm-inherited AtomicBlackBox input
51 #define BBTK_DECLARE_VTK_IMAGE_ALGORITHM_INPUT(NAME,TYPE) \
53 TYPE bbGetInput##NAME () \
54 { return GetImageDataInput(0); /*vtkParent::GetInput();*/ } \
55 void bbSetInput##NAME (TYPE d) \
56 { vtkParent::SetInput( (vtkDataObject*) d); \
57 /*bbSetModifiedStatus();*/ }
58 //===========================================================================
59 /// Declares a vtkPolyDataAlgorithm-inherited AtomicBlackBox input
60 #define BBTK_DECLARE_VTK_POLY_DATA_ALGORITHM_INPUT(NAME,TYPE) \
62 TYPE bbGetInput##NAME () \
63 { return GetPolyDataInput(0); /*vtkParent::GetInput();*/ } \
64 void bbSetInput##NAME (TYPE d) \
65 { vtkParent::SetInput( (vtkDataObject*) d); \
66 /*bbSetModifiedStatus();*/ }
67 //===========================================================================
69 //===========================================================================
70 /// Declares a vtkImageAlgorithm-inherited AtomicBlackBox output
71 #define BBTK_DECLARE_VTK_OUTPUT(NAME,TYPE) \
73 TYPE bbGetOutput##NAME () \
74 { return vtkParent::GetOutput(); } \
75 void bbSetOutput##NAME (TYPE d) \
76 { /*vtkParent::GetOutput() = d;*/ }
77 //===========================================================================
79 //===========================================================================
80 /// Declares a vtkAlgorithm-inherited AtomicBlackBox input
81 #define BBTK_DECLARE_VTK_INPUT(NAME,TYPE) \
83 TYPE bbGetInput##NAME () \
84 { return dynamic_cast<TYPE>(vtkParent::GetInput()); } \
85 void bbSetInput##NAME (TYPE d) \
86 { vtkParent::SetInput( (vtkDataObject*) d); /*vtkParent::GetOutput() = d;*/ }
88 //===========================================================================
90 //===========================================================================
91 /// Declares an AtomicBlackBox input corresponding to an
92 /// inherited vtk parameter
93 /// which was declared by vtkSetMacro/vtkGetMacro
94 /// The NAME **MUST** be the same than the vtk parameter name
95 #define BBTK_DECLARE_VTK_PARAM(NAME,TYPE) \
97 TYPE bbGetInput##NAME () \
98 { return vtkParent::Get##NAME(); } \
99 void bbSetInput##NAME (TYPE d) \
100 { vtkParent::Set##NAME(d); \
101 /*bbSetModifiedStatus();*/ }
102 //===========================================================================
106 //============================================================================
107 /// Defines the default bbUserProcess method for vtk inherited black boxes
108 /// (calls vtkParent::Update)
109 #define BBTK_VTK_PROCESS() \
111 inline void bbUserProcess() \
113 bbtkDebugMessage("process",1,"**> Processing ["<<bbGetFullName() \
115 vtkParent::Update(); \
116 bbtkDebugMessage("process",2,"<** Processing ["<<bbGetFullName() \
119 //============================================================================
122 //===========================================================================
124 //===========================================================================