1 /*=========================================================================
4 Module: $RCSfile: bbtkUserBlackBoxMacros.h,v $
6 Date: $Date: 2008/02/05 11:07:43 $
7 Version: $Revision: 1.4 $
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 new user black boxes
24 #ifndef __bbtkUserBlackBoxMacros_h__
25 #define __bbtkUserBlackBoxMacros_h__
27 //============================================================================
28 /// Declares the standard interface of a UserBlackBox
29 /// (ctor, New, descriptor related methods)
30 #define BBTK_USER_BLACK_BOX_INTERFACE(CLASS,PARENT) \
32 inline static void bbCreateDescriptorIfNeeded(); \
34 CLASS(const std::string& name, bool allocate_connectors = true); \
35 CLASS(CLASS& from, const std::string& name, \
36 bool allocate_connectors = true); \
39 inline static CLASS* bbNew(const std::string& name) \
41 bbtkDebugMessageInc("Core",9,#CLASS<<"::bbNew(\""<<name<<"\")"<<std::endl); \
42 bbCreateDescriptorIfNeeded(); \
43 CLASS* c = new CLASS(name); \
44 bbtkDebugDecTab("Core",9); \
47 inline bbtk::BlackBox* bbClone(const std::string& name) \
49 bbtkDebugMessageInc("Core",9,#CLASS<<"::bbClone(\""<<name<<"\")"<<std::endl); \
50 bbCreateDescriptorIfNeeded(); \
51 CLASS* c = new CLASS(*this,name); \
52 bbtkDebugDecTab("Core",9); \
55 bbtk::BlackBoxDescriptor* bbGetDescriptor() const \
57 return (bbtk::BlackBoxDescriptor*)bbDescriptor(); \
59 static bbtk::BlackBoxDescriptor* bbDescriptor() \
61 bbCreateDescriptorIfNeeded(); \
62 return bbDescriptorPointer(); \
65 CLASS() : PARENT("") {} \
66 static bbtk::BlackBoxDescriptor*& bbDescriptorPointer() \
68 static bbtk::BlackBoxDescriptor* d = 0; \
71 //============================================================================
74 //============================================================================
75 /// Defines the bbUserProcess method
76 #define BBTK_PROCESS(CALLBACK) \
78 inline void bbUserProcess() \
80 bbtkDebugMessageInc("Process",1,"=> "<<bbGetTypeName()<<"::bbUserProcess() [" \
81 <<bbGetFullName()<<"]"<<std::endl); \
83 bbtkDebugMessageDec("Process",1,"<= "<<bbGetTypeName()<<"::bbUserProcess() [" \
84 <<bbGetFullName()<<"]"<<std::endl); \
86 //============================================================================
89 //============================================================================
90 /// Declares a new UserBlackBox input (to be put in the class interface)
91 #define BBTK_DECLARE_INPUT(NAME,TYPE) \
93 TYPE bbmInput##NAME; \
95 TYPE bbGetInput##NAME () \
96 { return bbmInput##NAME; } \
97 void bbSetInput##NAME (TYPE d) \
98 { bbmInput##NAME = d; \
99 /*bbSetModifiedStatus();*/ }
100 //============================================================================
102 //============================================================================
103 /// Declares a new UserBlackBox output (to be put in the class interface)
104 #define BBTK_DECLARE_OUTPUT(NAME,TYPE) \
106 TYPE bbmOutput##NAME; \
108 TYPE bbGetOutput##NAME () \
109 { return bbmOutput##NAME; } \
110 void bbSetOutput##NAME (TYPE d) \
111 { bbmOutput##NAME = d; }
112 //============================================================================
114 //============================================================================
115 /// Declares an inherited UserBlackBox input (to be put in the class interface)
116 #define BBTK_DECLARE_INHERITED_INPUT(NAME,TYPE,GETMETHOD,SETMETHOD) \
118 TYPE bbGetInput##NAME () \
119 { return GETMETHOD(); } \
120 void bbSetInput##NAME (TYPE d) \
122 /*bbSetModifiedStatus();*/ }
123 //============================================================================
126 //============================================================================
127 /// Declares an inherited UserBlackBox output (to be put in the class interface)
128 #define BBTK_DECLARE_INHERITED_OUTPUT(NAME,TYPE,GETMETHOD,SETMETHOD) \
130 TYPE bbGetOutput##NAME () const \
131 { return GETMETHOD(); } \
132 void bbSetOutput##NAME (TYPE d) \
134 //============================================================================
138 //============================================================================
139 #define BBTK_BEGIN_BLACK_BOX_CONSTRUCTOR(CLASS,ALLOC) \
140 bbtkDebugMessageInc("Core",7,#CLASS<<"::"<<#CLASS \
141 <<"(\""<<bbGetName()<<"\")"<<std::endl); \
142 if (ALLOC) bbAllocateConnectors();
143 //============================================================================
145 //============================================================================
146 #define BBTK_BEGIN_BLACK_BOX_COPY_CONSTRUCTOR(CLASS,FROM,ALLOC) \
147 bbtkDebugMessageInc("Core",7,#CLASS<<"::"<<#CLASS \
148 <<"("<<FROM.bbGetFullName()<<",\"" \
149 <<bbGetName()<<"\")"<<std::endl); \
152 bbAllocateConnectors(); \
153 bbCopyIOValues(FROM); \
155 //============================================================================
158 //============================================================================
159 #define BBTK_END_BLACK_BOX_CONSTRUCTOR \
160 bbtkDebugDecTab("Core",7)
161 //============================================================================
163 //============================================================================
164 #define BBTK_BEGIN_BLACK_BOX_DESTRUCTOR(CLASS) \
165 bbtkDebugMessageInc("Core",7,#CLASS <<"::~"<< #CLASS \
166 <<"() ["<<this->bbGetFullName()<<"]"<<std::endl);
167 //============================================================================
172 //============================================================================
173 #define BBTK_END_BLACK_BOX_DESTRUCTOR \
174 bbtkDebugDecTab("Core",7)
175 //============================================================================
178 //============================================================================
179 /// UserBlackBox std implementation of ctor and dtor
180 #define BBTK_USER_BLACK_BOX_IMPLEMENTATION(CLASS,PARENT) \
181 CLASS::CLASS(const std::string& name, bool allocate_connectors) \
182 : PARENT(name,false) \
184 BBTK_BEGIN_BLACK_BOX_CONSTRUCTOR(CLASS,allocate_connectors); \
185 CLASS::bbUserConstructor(); \
186 BBTK_END_BLACK_BOX_CONSTRUCTOR; \
188 CLASS::CLASS(CLASS& from, \
189 const std::string& name, bool allocate_connectors) \
190 : PARENT(from,name,false) \
192 BBTK_BEGIN_BLACK_BOX_COPY_CONSTRUCTOR(CLASS,from,allocate_connectors); \
193 CLASS::bbUserCopyConstructor(); \
194 BBTK_END_BLACK_BOX_CONSTRUCTOR; \
198 BBTK_BEGIN_BLACK_BOX_DESTRUCTOR(CLASS); \
199 CLASS::bbUserDestructor(); \
200 BBTK_END_BLACK_BOX_DESTRUCTOR; \
202 //============================================================================
205 //============================================================================
206 /// Begins the UserBlackBox description block
207 #define BBTK_BEGIN_DESCRIBE_BLACK_BOX(CLASS,PARENT) \
208 class /*BBTK_EXPORT*/ CLASS ## Descriptor : public PARENT ## Descriptor \
211 bbtk::BlackBox::Pointer CreateInstance(const std::string& name) \
213 return CLASS::bbNew(name); \
215 CLASS ## Descriptor() \
217 bbtkDebugMessageInc("Core",9,#CLASS<<"Descriptor::"<<#CLASS \
218 <<"Descriptor()"<<std::endl)
219 //============================================================================
221 //============================================================================
222 /// Ends the UserBlackBox description block
223 #define BBTK_END_DESCRIBE_BLACK_BOX(CLASS) \
224 bbtkDecTab("Core",9); \
227 void CLASS::bbCreateDescriptorIfNeeded() \
229 if ( !bbDescriptorPointer() ) \
230 bbDescriptorPointer() = new CLASS ## Descriptor; \
232 //============================================================================
235 //============================================================================
236 /// Declares the name of a UserBlackBox (to be put inside the UBB description block)
237 #define BBTK_NAME(NAME) SetTypeName(NAME)
238 //============================================================================
240 //============================================================================
241 /// Declares the author of a UserBlackBox (to be put inside the UBB description block)
242 #define BBTK_AUTHOR(AUTHOR) AddToAuthor(AUTHOR)
243 //============================================================================
245 //============================================================================
246 /// Declares the keywords of a UserBlackBox (to be put inside the UBB description block)
247 #define BBTK_KEYWORD(KEYWORD) AddToKeyword(KEYWORD)
248 //============================================================================
250 //============================================================================
251 /// Declares the description of a UserBlackBox (to be put inside the UBB description block)
252 #define BBTK_DESCRIPTION(DESCR) AddToDescription(DESCR)
253 //============================================================================
255 //============================================================================
256 /// Declares the kind of a UserBlackBox (to be put inside the UBB description block)
257 //#define BBTK_KIND(KIND) SetKind(KIND)
258 //============================================================================
260 //============================================================================
261 /// Declares that the UserBlackBox is an adaptor (to be put inside the UBB description block)
262 #define BBTK_ADAPTOR() SetKInd(bbtk::BlackBoxDescriptor::ADAPTOR)
263 //============================================================================
265 //============================================================================
266 /// Declares that the UserBlackBox is the default adaptor of the package (to be put inside the UBB description block)
267 #define BBTK_DEFAULT_ADAPTOR() SetKind(bbtk::BlackBoxDescriptor::DEFAULT_ADAPTOR)
268 //============================================================================
270 //============================================================================
271 /// Describes a UserBlackBox input (to be put inside the UBB description block)
272 #define BBTK_INPUT(CLASS,NAME,DESCR,TYPE) \
273 AddInputDescriptor(new bbtk::UserBlackBoxInputDescriptor \
275 new bbtk::UserBlackBoxTGetFunctor<CLASS,TYPE,TYPE > \
276 (&CLASS::bbGetInput##NAME), \
277 new bbtk::UserBlackBoxTSetFunctor<CLASS,TYPE,TYPE > \
278 (&CLASS::bbSetInput##NAME) ) )
279 //============================================================================
281 //============================================================================
282 /// Describes a UserBlackBox output (to be put inside the UBB description block)
283 #define BBTK_OUTPUT(CLASS,NAME,DESCR,TYPE) \
284 AddOutputDescriptor(new bbtk::UserBlackBoxOutputDescriptor \
286 new bbtk::UserBlackBoxTGetFunctor<CLASS,TYPE,TYPE > \
287 (&CLASS::bbGetOutput##NAME), \
288 new bbtk::UserBlackBoxTSetFunctor<CLASS,TYPE,TYPE > \
289 (&CLASS::bbSetOutput##NAME) ) )
290 //============================================================================
292 //============================================================================
293 /// Describes a UserBlackBox input (to be put inside the UBB description block)
294 #define BBTK_INPUT_NOCOPY(CLASS,NAME,DESCR,TYPE) \
295 AddInputDescriptor(new bbtk::UserBlackBoxInputDescriptor \
297 new bbtk::UserBlackBoxTGetFunctor<CLASS,TYPE,TYPE > \
298 (&CLASS::bbGetInput##NAME), \
299 new bbtk::UserBlackBoxTSetFunctor<CLASS,TYPE,TYPE > \
300 (&CLASS::bbSetInput##NAME), \
302 //============================================================================
304 //============================================================================
305 /// Describes a UserBlackBox output (to be put inside the UBB description block)
306 #define BBTK_OUTPUT_NOCOPY(CLASS,NAME,DESCR,TYPE) \
307 AddOutputDescriptor(new bbtk::UserBlackBoxOutputDescriptor \
309 new bbtk::UserBlackBoxTGetFunctor<CLASS,TYPE,TYPE > \
310 (&CLASS::bbGetOutput##NAME), \
311 new bbtk::UserBlackBoxTSetFunctor<CLASS,TYPE,TYPE > \
312 (&CLASS::bbSetOutput##NAME),\
314 //============================================================================
325 //============================================================================
326 //============================================================================
327 // Template user black boxes macros
328 //============================================================================
329 //============================================================================
331 //============================================================================
332 /// Begins a template UserBlackBox of template param T description block
333 #define BBTK_BEGIN_DESCRIBE_TEMPLATE_BLACK_BOX(CLASS) \
335 class /*BBTK_EXPORT*/ CLASS ## Descriptor : public bbtk::BlackBoxDescriptor \
338 bbtk::BlackBox::Pointer CreateInstance(const std::string& name) \
340 return CLASS<T>::bbNew(name); \
342 CLASS ## Descriptor() \
344 bbtkDebugMessageInc("Core",9,#CLASS<<"Descriptor::"<<#CLASS \
345 <<"Descriptor()"<<std::endl)
346 //============================================================================
348 //============================================================================
349 /// Ends a template UserBlackBox of template param T description block
350 #define BBTK_END_DESCRIBE_TEMPLATE_BLACK_BOX(CLASS) \
351 bbtkDecTab("Core",9); \
355 void CLASS<T>::bbCreateDescriptorIfNeeded() \
357 if ( !bbDescriptorPointer() ) \
358 bbDescriptorPointer() = new CLASS ## Descriptor<T>; \
360 //============================================================================
362 //============================================================================
363 /// Describes a template UserBlackBox input (to be put inside the template UBB description block)
364 #define BBTK_TEMPLATE_INPUT(CLASS,NAME,DESCR,TYPE) \
365 AddInputDescriptor(new bbtk::UserBlackBoxInputDescriptor \
367 new bbtk::UserBlackBoxTGetFunctor<CLASS<T>,TYPE,TYPE > \
368 (&CLASS<T>::bbGetInput##NAME), \
369 new bbtk::UserBlackBoxTSetFunctor<CLASS<T>,TYPE,TYPE > \
370 (&CLASS<T>::bbSetInput##NAME) ) )
371 //============================================================================
373 //============================================================================
374 /// Describes a template UserBlackBox output (to be put inside the template UBB description block)
375 #define BBTK_TEMPLATE_OUTPUT(CLASS,NAME,DESCR,TYPE) \
376 AddOutputDescriptor(new bbtk::UserBlackBoxOutputDescriptor \
378 new bbtk::UserBlackBoxTGetFunctor<CLASS<T>,TYPE,TYPE > \
379 (&CLASS<T>::bbGetOutput##NAME), \
380 new bbtk::UserBlackBoxTSetFunctor<CLASS<T>,TYPE,TYPE > \
381 (&CLASS<T>::bbSetOutput##NAME) ) )
382 //============================================================================
384 //============================================================================
385 /// Template UserBlackBox std implementation of ctor and dtor
386 #define BBTK_USER_BLACK_BOX_TEMPLATE_IMPLEMENTATION(CLASS,PARENT) \
388 CLASS<T>::CLASS(const std::string& name, bool alloc) \
389 : PARENT(name,false) \
391 BBTK_BEGIN_BLACK_BOX_CONSTRUCTOR(CLASS<T>,alloc); \
392 CLASS<T>::bbUserConstructor(); \
393 BBTK_END_BLACK_BOX_CONSTRUCTOR; \
396 CLASS<T>::CLASS(CLASS<T>& from, \
397 const std::string& name, bool allocate_connectors) \
398 : PARENT(from,name,false) \
400 BBTK_BEGIN_BLACK_BOX_COPY_CONSTRUCTOR(CLASS<T>,from,allocate_connectors); \
401 CLASS<T>::bbUserCopyConstructor(); \
402 BBTK_END_BLACK_BOX_CONSTRUCTOR; \
407 BBTK_BEGIN_BLACK_BOX_DESTRUCTOR(CLASS<T>); \
408 CLASS<T>::bbUserDestructor(); \
409 BBTK_END_BLACK_BOX_DESTRUCTOR; \
411 //============================================================================
413 //============================================================================
414 // Two template params user black boxes macros
416 /// Begins a template UserBlackBox description block of template param T1 and T2
417 #define BBTK_BEGIN_DESCRIBE_TEMPLATE2_BLACK_BOX(CLASS) \
418 template <class T1, class T2> \
419 class /*BBTK_EXPORT*/ CLASS ## Descriptor : public bbtk::BlackBoxDescriptor \
422 bbtk::BlackBox::Pointer CreateInstance(const std::string& name) \
424 return CLASS<T1,T2>::bbNew(name); \
426 CLASS ## Descriptor() \
428 bbtkDebugMessageInc("Core",9,#CLASS<<"Descriptor::"<<#CLASS \
429 <<"Descriptor()"<<std::endl)
430 //============================================================================
432 //============================================================================
433 /// Ends a template UserBlackBox description block of template param T1 and T2
434 #define BBTK_END_DESCRIBE_TEMPLATE2_BLACK_BOX(CLASS) \
435 bbtkDecTab("Core",9); \
438 template <class T1, class T2> \
439 void CLASS<T1,T2>::bbCreateDescriptorIfNeeded() \
441 if ( !bbDescriptorPointer() ) \
442 bbDescriptorPointer() = new CLASS ## Descriptor<T1,T2>; \
444 //============================================================================
446 //============================================================================
447 // Two template params user black boxes macros
449 /// Begins a template UserBlackBox description block of template param T1 and T2
450 #define BBTK_BEGIN_DESCRIBE_TEMPLATE2_WITH_TYPES_BLACK_BOX(CLASS,TYPE1,TYPE2) \
451 template <TYPE1 T1, TYPE2 T2> \
452 class /*BBTK_EXPORT*/ CLASS ## Descriptor : public bbtk::BlackBoxDescriptor \
455 bbtk::BlackBox::Pointer CreateInstance(const std::string& name) \
457 return new CLASS<T1,T2>(name); \
459 CLASS ## Descriptor() \
461 bbtkDebugMessageInc("Core",9,#CLASS<<"Descriptor::"<<#CLASS \
462 <<"Descriptor()"<<std::endl)
463 //============================================================================
465 //============================================================================
466 /// Ends a template UserBlackBox description block of template param T1 and T2
467 #define BBTK_END_DESCRIBE_TEMPLATE2_WITH_TYPES_BLACK_BOX(CLASS,TYPE1,TYPE2) \
468 bbtkDecTab("Core",9); \
471 template <TYPE1 T1, TYPE2 T2> \
472 void CLASS<T1,T2>::bbCreateDescriptorIfNeeded() \
474 if ( !bbDescriptorPointer() ) \
475 bbDescriptorPointer() = new CLASS ## Descriptor<T1,T2>; \
477 //============================================================================
481 //============================================================================
482 /// Describes a 2 template params UserBlackBox input (to be put inside the UBB description block)
483 #define BBTK_TEMPLATE2_INPUT(CLASS,NAME,DESCR,TYPE) \
484 AddInputDescriptor(new bbtk::UserBlackBoxInputDescriptor \
486 new bbtk::UserBlackBoxTGetFunctor<CLASS<T1,T2>,TYPE,TYPE > \
487 (&CLASS<T1,T2>::bbGetInput##NAME), \
488 new bbtk::UserBlackBoxTSetFunctor<CLASS<T1,T2>,TYPE,TYPE > \
489 (&CLASS<T1,T2>::bbSetInput##NAME) ) )
490 //============================================================================
492 //============================================================================
493 /// Describes a 2 template params UserBlackBox output (to be put inside the UBB description block)
494 #define BBTK_TEMPLATE2_OUTPUT(CLASS,NAME,DESCR,TYPE) \
495 AddOutputDescriptor(new bbtk::UserBlackBoxOutputDescriptor \
497 new bbtk::UserBlackBoxTGetFunctor<CLASS<T1,T2>,TYPE,TYPE > \
498 (&CLASS<T1,T2>::bbGetOutput##NAME), \
499 new bbtk::UserBlackBoxTSetFunctor<CLASS<T1,T2>,TYPE,TYPE > \
500 (&CLASS<T1,T2>::bbSetOutput##NAME) ) )
501 //============================================================================
503 //============================================================================
504 /// Template UserBlackBox std implementation of ctor and dtor
505 #define BBTK_USER_BLACK_BOX_TEMPLATE2_IMPLEMENTATION(CLASS,PARENT) \
506 template <class T1, class T2> \
507 CLASS<T1,T2>::CLASS(const std::string& name, bool alloc) \
508 : PARENT(name,false) \
510 BBTK_BEGIN_BLACK_BOX_CONSTRUCTOR(CLASS,alloc); \
511 CLASS<T1,T2>::bbUserConstructor(); \
512 BBTK_END_BLACK_BOX_CONSTRUCTOR; \
514 template <class T1, class T2> \
515 CLASS<T1,T2>::CLASS(CLASS<T1,T2>& from, \
516 const std::string& name, bool allocate_connectors) \
517 : PARENT(from,name,false) \
519 BBTK_BEGIN_BLACK_BOX_COPY_CONSTRUCTOR(CLASS,from,allocate_connectors); \
520 CLASS<T1,T2>::bbUserCopyConstructor(); \
521 BBTK_END_BLACK_BOX_CONSTRUCTOR; \
523 template <class T1, class T2> \
524 CLASS<T1,T2>::~CLASS() \
526 BBTK_BEGIN_BLACK_BOX_DESTRUCTOR(CLASS); \
527 CLASS<T1,T2>::bbUserDestructor(); \
528 BBTK_END_BLACK_BOX_DESTRUCTOR; \
530 //============================================================================
533 //============================================================================
534 /// Template UserBlackBox std implementation of ctor and dtor
535 #define BBTK_USER_BLACK_BOX_TEMPLATE2_WITH_TYPES_IMPLEMENTATION(CLASS,PARENT,TYPE1,TYPE2) \
536 template <TYPE1 T1, TYPE2 T2> \
537 CLASS<T1,T2>::CLASS(const std::string& name, bool alloc) \
538 : PARENT(name,false) \
540 BBTK_BEGIN_BLACK_BOX_CONSTRUCTOR(CLASS,alloc); \
541 this->bbUserConstructor(); \
542 BBTK_END_BLACK_BOX_CONSTRUCTOR; \
544 template <TYPE1 T1, TYPE2 T2> \
545 CLASS<T1,T2>::CLASS(CLASS<T1,T2>& from, \
546 const std::string& name, bool allocate_connectors) \
547 : PARENT(from,name,false) \
549 BBTK_BEGIN_BLACK_BOX_COPY_CONSTRUCTOR(CLASS,from,allocate_connectors); \
550 this->bbUserCopyConstructor(); \
551 BBTK_END_BLACK_BOX_CONSTRUCTOR; \
553 template <TYPE1 T1, TYPE2 T2> \
554 CLASS<T1,T2>::~CLASS() \
556 BBTK_BEGIN_BLACK_BOX_DESTRUCTOR(CLASS); \
557 this->bbUserDestructor(); \
558 BBTK_END_BLACK_BOX_DESTRUCTOR; \
560 //============================================================================
566 //===========================================================================
567 //============================================================================
568 // ITK Specific macros
569 //===========================================================================
570 //===========================================================================
573 //===========================================================================
574 /// Declares an itk-inherited UserBlackBox input
575 #define BBTK_DECLARE_ITK_INPUT(PARENT,NAME,TYPE) \
577 TYPE bbGetInput##NAME () \
578 { return PARENT::GetInput(); } \
579 void bbSetInput##NAME (TYPE d) \
580 { PARENT::SetInput(d); \
581 /*bbSetModifiedStatus();*/ }
582 //===========================================================================
584 //===========================================================================
585 #define BBTK_DECLARE_ITK_OUTPUT(PARENT,NAME,TYPE) \
587 TYPE bbGetOutput##NAME () \
588 { return PARENT::GetOutput(); } \
589 void bbSetOutput##NAME (TYPE d) \
590 { /*PARENT::GetOutput() = d;*/ }
591 //===========================================================================
593 //===========================================================================
594 /// Declares an UserBlackBox input corresponding to an inherited itk parameter
595 /// which was declared by itkSetMacro/itkGetMacro
596 /// The NAME **MUST** be the same than the itk parameter name
597 #define BBTK_DECLARE_ITK_PARAM(PARENT,NAME,TYPE) \
599 TYPE bbGetInput##NAME () \
600 { return PARENT::Get##NAME(); } \
601 void bbSetInput##NAME (TYPE d) \
602 { PARENT::Set##NAME(d); \
603 /*bbSetModifiedStatus();*/ }
604 //===========================================================================
609 //===========================================================================
610 //============================================================================
611 // VTK Specific macros
612 //===========================================================================
613 //===========================================================================
616 //===========================================================================
619 // { return GetInput(); /*PARENT::GetInput();*/ } \
620 // { PARENT::SetInput( /*(vtkDataObject*)*/ d); \
624 /// Declares a vtkImageAlgorithm-inherited UserBlackBox input
625 #define BBTK_DECLARE_VTK_IMAGE_ALGORITHM_INPUT(PARENT,NAME,TYPE) \
627 TYPE bbGetInput##NAME () \
628 { return GetImageDataInput(0); /*PARENT::GetInput();*/ } \
629 void bbSetInput##NAME (TYPE d) \
630 { PARENT::SetInput( (vtkDataObject*) d); \
631 /*bbSetModifiedStatus();*/ }
632 //===========================================================================
633 /// Declares a vtkPolyDataAlgorithm-inherited UserBlackBox input
634 #define BBTK_DECLARE_VTK_POLY_DATA_ALGORITHM_INPUT(PARENT,NAME,TYPE) \
636 TYPE bbGetInput##NAME () \
637 { return GetPolyDataInput(0); /*PARENT::GetInput();*/ } \
638 void bbSetInput##NAME (TYPE d) \
639 { PARENT::SetInput( (vtkDataObject*) d); \
640 /*bbSetModifiedStatus();*/ }
641 //===========================================================================
643 //===========================================================================
644 /// Declares a vtkImageAlgorithm-inherited UserBlackBox output
645 #define BBTK_DECLARE_VTK_OUTPUT(PARENT,NAME,TYPE) \
647 TYPE bbGetOutput##NAME () \
648 { return PARENT::GetOutput(); } \
649 void bbSetOutput##NAME (TYPE d) \
650 { /*PARENT::GetOutput() = d;*/ }
651 //===========================================================================
653 //===========================================================================
654 /// Declares a vtkAlgorithm-inherited UserBlackBox input
655 #define BBTK_DECLARE_VTK_INPUT(PARENT,NAME,TYPE) \
657 TYPE bbGetInput##NAME () \
658 { return dynamic_cast<TYPE>(PARENT::GetInput()); } \
659 void bbSetInput##NAME (TYPE d) \
660 { PARENT::SetInput( (vtkDataObject*) d); /*PARENT::GetOutput() = d;*/ }
662 //===========================================================================
664 //===========================================================================
665 /// Declares an UserBlackBox input corresponding to an inherited vtk parameter
666 /// which was declared by vtkSetMacro/vtkGetMacro
667 /// The NAME **MUST** be the same than the vtk parameter name
668 #define BBTK_DECLARE_VTK_PARAM(PARENT,NAME,TYPE) \
670 TYPE bbGetInput##NAME () \
671 { return PARENT::Get##NAME(); } \
672 void bbSetInput##NAME (TYPE d) \
673 { PARENT::Set##NAME(d); \
674 /*bbSetModifiedStatus();*/ }
675 //===========================================================================
679 //===========================================================================
681 //===========================================================================