1 /*=========================================================================
4 Module: $RCSfile: bbtkAtomicBlackBoxMacros.h,v $
6 Date: $Date: 2008/04/08 06:59:29 $
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 new user black boxes
24 #ifndef __bbtkAtomicBlackBoxMacros_h__
25 #define __bbtkAtomicBlackBoxMacros_h__
27 //============================================================================
28 /// Declares the standard interface of a AtomicBlackBox
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("Kernel",9,#CLASS<<"::bbNew(\""<<name<<"\")"<<std::endl); \
42 bbCreateDescriptorIfNeeded(); \
43 CLASS* c = new CLASS(name); \
44 bbtkDebugDecTab("Kernel",9); \
47 inline bbtk::BlackBox* bbClone(const std::string& name) \
49 bbtkDebugMessageInc("Kernel",9,#CLASS<<"::bbClone(\""<<name<<"\")"<<std::endl); \
50 bbCreateDescriptorIfNeeded(); \
51 CLASS* c = new CLASS(*this,name); \
52 bbtkDebugDecTab("Kernel",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 AtomicBlackBox 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 AtomicBlackBox 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 AtomicBlackBox 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 AtomicBlackBox 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("Kernel",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("Kernel",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("Kernel",7)
161 //============================================================================
163 //============================================================================
164 #define BBTK_BEGIN_BLACK_BOX_DESTRUCTOR(CLASS) \
165 bbtkDebugMessageInc("Kernel",7,#CLASS <<"::~"<< #CLASS \
166 <<"() ["<<this->bbGetFullName()<<"]"<<std::endl);
167 //============================================================================
172 //============================================================================
173 #define BBTK_END_BLACK_BOX_DESTRUCTOR \
174 bbtkDebugDecTab("Kernel",7)
175 //============================================================================
178 //============================================================================
179 /// AtomicBlackBox 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 AtomicBlackBox 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("Kernel",9,#CLASS<<"Descriptor::"<<#CLASS \
218 <<"Descriptor()"<<std::endl)
219 //============================================================================
221 //============================================================================
222 /// Ends the AtomicBlackBox description block
223 #define BBTK_END_DESCRIBE_BLACK_BOX(CLASS) \
224 bbtkDecTab("Kernel",9); \
227 void CLASS::bbCreateDescriptorIfNeeded() \
229 if ( !bbDescriptorPointer() ) \
230 bbDescriptorPointer() = new CLASS ## Descriptor; \
232 //============================================================================
235 //============================================================================
236 /// Declares the name of a AtomicBlackBox (to be put inside the UBB description block)
237 #define BBTK_NAME(NAME) SetTypeName(NAME)
238 //============================================================================
240 //============================================================================
241 /// Declares the author of a AtomicBlackBox (to be put inside the UBB description block)
242 #define BBTK_AUTHOR(AUTHOR) AddToAuthor(AUTHOR)
243 //============================================================================
245 //============================================================================
246 /// Declares the categories of a AtomicBlackBox (to be put inside the UBB description block)
247 #define BBTK_CATEGORY(CATEGORY) AddToCategory(CATEGORY)
248 //============================================================================
250 //============================================================================
251 /// Declares the description of a AtomicBlackBox (to be put inside the UBB description block)
252 #define BBTK_DESCRIPTION(DESCR) AddToDescription(DESCR)
253 //============================================================================
255 //============================================================================
256 /// Declares the kind of a AtomicBlackBox (to be put inside the UBB description block)
257 //#define BBTK_KIND(KIND) SetKind(KIND)
258 //============================================================================
260 //============================================================================
261 /// Declares that the AtomicBlackBox is an adaptor (to be put inside the UBB description block)
262 #define BBTK_ADAPTOR() \
263 SetKind(bbtk::BlackBoxDescriptor::ADAPTOR); \
264 AddToCategory("adaptor")
265 //============================================================================
267 //============================================================================
268 /// Declares that the AtomicBlackBox is the default adaptor of the package (to be put inside the UBB description block)
269 #define BBTK_DEFAULT_ADAPTOR() \
270 SetKind(bbtk::BlackBoxDescriptor::DEFAULT_ADAPTOR); \
271 AddToCategory("adaptor")
272 //============================================================================
275 //============================================================================
276 /// Describes a AtomicBlackBox input (to be put inside the UBB description block)
277 #define BBTK_INPUT(CLASS,NAME,DESCR,TYPE,NATURE) \
278 AddInputDescriptor(new bbtk::AtomicBlackBoxInputDescriptor \
279 (typeid(CLASS ## Descriptor), \
280 #NAME,DESCR,NATURE, \
281 new bbtk::AtomicBlackBoxTGetFunctor<CLASS,TYPE,TYPE > \
282 (&CLASS::bbGetInput##NAME), \
283 new bbtk::AtomicBlackBoxTSetFunctor<CLASS,TYPE,TYPE > \
284 (&CLASS::bbSetInput##NAME) ) )
285 //============================================================================
287 //============================================================================
288 /// Describes a AtomicBlackBox output (to be put inside the UBB description block)
289 #define BBTK_OUTPUT(CLASS,NAME,DESCR,TYPE,NATURE) \
290 AddOutputDescriptor(new bbtk::AtomicBlackBoxOutputDescriptor \
291 (typeid(CLASS ## Descriptor),#NAME,DESCR,NATURE, \
292 new bbtk::AtomicBlackBoxTGetFunctor<CLASS,TYPE,TYPE > \
293 (&CLASS::bbGetOutput##NAME), \
294 new bbtk::AtomicBlackBoxTSetFunctor<CLASS,TYPE,TYPE > \
295 (&CLASS::bbSetOutput##NAME) ) )
296 //============================================================================
299 //============================================================================
300 /// Describes a AtomicBlackBox input (to be put inside the UBB description block)
301 #define BBTK_INPUT_NOCOPY(CLASS,NAME,DESCR,TYPE,NATURE) \
302 AddInputDescriptor(new bbtk::AtomicBlackBoxInputDescriptor \
303 (typeid(CLASS ## Descriptor),#NAME,DESCR,NATURE, \
304 new bbtk::AtomicBlackBoxTGetFunctor<CLASS,TYPE,TYPE > \
305 (&CLASS::bbGetInput##NAME), \
306 new bbtk::AtomicBlackBoxTSetFunctor<CLASS,TYPE,TYPE > \
307 (&CLASS::bbSetInput##NAME), \
309 //============================================================================
311 //============================================================================
312 /// Describes a AtomicBlackBox output (to be put inside the UBB description block)
313 #define BBTK_OUTPUT_NOCOPY(CLASS,NAME,DESCR,TYPE,NATURE) \
314 AddOutputDescriptor(new bbtk::AtomicBlackBoxOutputDescriptor \
315 (typeid(CLASS ## Descriptor),#NAME,DESCR,NATURE, \
316 new bbtk::AtomicBlackBoxTGetFunctor<CLASS,TYPE,TYPE > \
317 (&CLASS::bbGetOutput##NAME), \
318 new bbtk::AtomicBlackBoxTSetFunctor<CLASS,TYPE,TYPE > \
319 (&CLASS::bbSetOutput##NAME),\
321 //============================================================================
332 //============================================================================
333 //============================================================================
334 // Template user black boxes macros
335 //============================================================================
336 //============================================================================
338 //============================================================================
339 /// Begins a template AtomicBlackBox of template param T description block
340 #define BBTK_BEGIN_DESCRIBE_TEMPLATE_BLACK_BOX(CLASS) \
342 class /*BBTK_EXPORT*/ CLASS ## Descriptor : public bbtk::BlackBoxDescriptor \
345 bbtk::BlackBox::Pointer CreateInstance(const std::string& name) \
347 return CLASS<T>::bbNew(name); \
349 CLASS ## Descriptor() \
351 bbtkDebugMessageInc("Kernel",9,#CLASS<<"Descriptor::"<<#CLASS \
352 <<"Descriptor()"<<std::endl)
353 //============================================================================
355 //============================================================================
356 /// Ends a template AtomicBlackBox of template param T description block
357 #define BBTK_END_DESCRIBE_TEMPLATE_BLACK_BOX(CLASS) \
358 bbtkDecTab("Kernel",9); \
362 void CLASS<T>::bbCreateDescriptorIfNeeded() \
364 if ( !bbDescriptorPointer() ) \
365 bbDescriptorPointer() = new CLASS ## Descriptor<T>; \
367 //============================================================================
369 //============================================================================
370 /// Describes a template AtomicBlackBox input (to be put inside the template UBB description block)
371 #define BBTK_TEMPLATE_INPUT(CLASS,NAME,DESCR,TYPE) \
372 AddInputDescriptor(new bbtk::AtomicBlackBoxInputDescriptor \
373 (typeid(CLASS ## Descriptor),#NAME,DESCR,"", \
374 new bbtk::AtomicBlackBoxTGetFunctor<CLASS<T>,TYPE,TYPE > \
375 (&CLASS<T>::bbGetInput##NAME), \
376 new bbtk::AtomicBlackBoxTSetFunctor<CLASS<T>,TYPE,TYPE > \
377 (&CLASS<T>::bbSetInput##NAME) ) )
378 //============================================================================
380 //============================================================================
381 /// Describes a template AtomicBlackBox output (to be put inside the template UBB description block)
382 #define BBTK_TEMPLATE_OUTPUT(CLASS,NAME,DESCR,TYPE) \
383 AddOutputDescriptor(new bbtk::AtomicBlackBoxOutputDescriptor \
384 (typeid(CLASS ## Descriptor),#NAME,DESCR,"", \
385 new bbtk::AtomicBlackBoxTGetFunctor<CLASS<T>,TYPE,TYPE > \
386 (&CLASS<T>::bbGetOutput##NAME), \
387 new bbtk::AtomicBlackBoxTSetFunctor<CLASS<T>,TYPE,TYPE > \
388 (&CLASS<T>::bbSetOutput##NAME) ) )
389 //============================================================================
391 //============================================================================
392 /// Template AtomicBlackBox std implementation of ctor and dtor
393 #define BBTK_USER_BLACK_BOX_TEMPLATE_IMPLEMENTATION(CLASS,PARENT) \
395 CLASS<T>::CLASS(const std::string& name, bool alloc) \
396 : PARENT(name,false) \
398 BBTK_BEGIN_BLACK_BOX_CONSTRUCTOR(CLASS<T>,alloc); \
399 CLASS<T>::bbUserConstructor(); \
400 BBTK_END_BLACK_BOX_CONSTRUCTOR; \
403 CLASS<T>::CLASS(CLASS<T>& from, \
404 const std::string& name, bool allocate_connectors) \
405 : PARENT(from,name,false) \
407 BBTK_BEGIN_BLACK_BOX_COPY_CONSTRUCTOR(CLASS<T>,from,allocate_connectors); \
408 CLASS<T>::bbUserCopyConstructor(); \
409 BBTK_END_BLACK_BOX_CONSTRUCTOR; \
414 BBTK_BEGIN_BLACK_BOX_DESTRUCTOR(CLASS<T>); \
415 CLASS<T>::bbUserDestructor(); \
416 BBTK_END_BLACK_BOX_DESTRUCTOR; \
418 //============================================================================
420 //============================================================================
421 // Two template params user black boxes macros
423 /// Begins a template AtomicBlackBox description block of template param T1 and T2
424 #define BBTK_BEGIN_DESCRIBE_TEMPLATE2_BLACK_BOX(CLASS) \
425 template <class T1, class T2> \
426 class /*BBTK_EXPORT*/ CLASS ## Descriptor : public bbtk::BlackBoxDescriptor \
429 bbtk::BlackBox::Pointer CreateInstance(const std::string& name) \
431 return CLASS<T1,T2>::bbNew(name); \
433 CLASS ## Descriptor() \
435 bbtkDebugMessageInc("Kernel",9,#CLASS<<"Descriptor::"<<#CLASS \
436 <<"Descriptor()"<<std::endl)
437 //============================================================================
439 //============================================================================
440 /// Ends a template AtomicBlackBox description block of template param T1 and T2
441 #define BBTK_END_DESCRIBE_TEMPLATE2_BLACK_BOX(CLASS) \
442 bbtkDecTab("Kernel",9); \
445 template <class T1, class T2> \
446 void CLASS<T1,T2>::bbCreateDescriptorIfNeeded() \
448 if ( !bbDescriptorPointer() ) \
449 bbDescriptorPointer() = new CLASS ## Descriptor<T1,T2>; \
451 //============================================================================
453 //============================================================================
454 // Two template params user black boxes macros
456 /// Begins a template AtomicBlackBox description block of template param T1 and T2
457 #define BBTK_BEGIN_DESCRIBE_TEMPLATE2_WITH_TYPES_BLACK_BOX(CLASS,TYPE1,TYPE2) \
458 template <TYPE1 T1, TYPE2 T2> \
459 class /*BBTK_EXPORT*/ CLASS ## Descriptor : public bbtk::BlackBoxDescriptor \
462 bbtk::BlackBox::Pointer CreateInstance(const std::string& name) \
464 return new CLASS<T1,T2>(name); \
466 CLASS ## Descriptor() \
468 bbtkDebugMessageInc("Kernel",9,#CLASS<<"Descriptor::"<<#CLASS \
469 <<"Descriptor()"<<std::endl)
470 //============================================================================
472 //============================================================================
473 /// Ends a template AtomicBlackBox description block of template param T1 and T2
474 #define BBTK_END_DESCRIBE_TEMPLATE2_WITH_TYPES_BLACK_BOX(CLASS,TYPE1,TYPE2) \
475 bbtkDecTab("Kernel",9); \
478 template <TYPE1 T1, TYPE2 T2> \
479 void CLASS<T1,T2>::bbCreateDescriptorIfNeeded() \
481 if ( !bbDescriptorPointer() ) \
482 bbDescriptorPointer() = new CLASS ## Descriptor<T1,T2>; \
484 //============================================================================
488 //============================================================================
489 /// Describes a 2 template params AtomicBlackBox input (to be put inside the UBB description block)
490 #define BBTK_TEMPLATE2_INPUT(CLASS,NAME,DESCR,TYPE) \
491 AddInputDescriptor(new bbtk::AtomicBlackBoxInputDescriptor \
492 (typeid(CLASS ## Descriptor),#NAME,DESCR,"", \
493 new bbtk::AtomicBlackBoxTGetFunctor<CLASS<T1,T2>,TYPE,TYPE > \
494 (&CLASS<T1,T2>::bbGetInput##NAME), \
495 new bbtk::AtomicBlackBoxTSetFunctor<CLASS<T1,T2>,TYPE,TYPE > \
496 (&CLASS<T1,T2>::bbSetInput##NAME) ) )
497 //============================================================================
499 //============================================================================
500 /// Describes a 2 template params AtomicBlackBox output (to be put inside the UBB description block)
501 #define BBTK_TEMPLATE2_OUTPUT(CLASS,NAME,DESCR,TYPE) \
502 AddOutputDescriptor(new bbtk::AtomicBlackBoxOutputDescriptor \
503 (typeid(CLASS ## Descriptor),#NAME,DESCR,"", \
504 new bbtk::AtomicBlackBoxTGetFunctor<CLASS<T1,T2>,TYPE,TYPE > \
505 (&CLASS<T1,T2>::bbGetOutput##NAME), \
506 new bbtk::AtomicBlackBoxTSetFunctor<CLASS<T1,T2>,TYPE,TYPE > \
507 (&CLASS<T1,T2>::bbSetOutput##NAME) ) )
508 //============================================================================
510 //============================================================================
511 /// Template AtomicBlackBox std implementation of ctor and dtor
512 #define BBTK_USER_BLACK_BOX_TEMPLATE2_IMPLEMENTATION(CLASS,PARENT) \
513 template <class T1, class T2> \
514 CLASS<T1,T2>::CLASS(const std::string& name, bool alloc) \
515 : PARENT(name,false) \
517 BBTK_BEGIN_BLACK_BOX_CONSTRUCTOR(CLASS,alloc); \
518 CLASS<T1,T2>::bbUserConstructor(); \
519 BBTK_END_BLACK_BOX_CONSTRUCTOR; \
521 template <class T1, class T2> \
522 CLASS<T1,T2>::CLASS(CLASS<T1,T2>& from, \
523 const std::string& name, bool allocate_connectors) \
524 : PARENT(from,name,false) \
526 BBTK_BEGIN_BLACK_BOX_COPY_CONSTRUCTOR(CLASS,from,allocate_connectors); \
527 CLASS<T1,T2>::bbUserCopyConstructor(); \
528 BBTK_END_BLACK_BOX_CONSTRUCTOR; \
530 template <class T1, class T2> \
531 CLASS<T1,T2>::~CLASS() \
533 BBTK_BEGIN_BLACK_BOX_DESTRUCTOR(CLASS); \
534 CLASS<T1,T2>::bbUserDestructor(); \
535 BBTK_END_BLACK_BOX_DESTRUCTOR; \
537 //============================================================================
540 //============================================================================
541 /// Template AtomicBlackBox std implementation of ctor and dtor
542 #define BBTK_USER_BLACK_BOX_TEMPLATE2_WITH_TYPES_IMPLEMENTATION(CLASS,PARENT,TYPE1,TYPE2) \
543 template <TYPE1 T1, TYPE2 T2> \
544 CLASS<T1,T2>::CLASS(const std::string& name, bool alloc) \
545 : PARENT(name,false) \
547 BBTK_BEGIN_BLACK_BOX_CONSTRUCTOR(CLASS,alloc); \
548 this->bbUserConstructor(); \
549 BBTK_END_BLACK_BOX_CONSTRUCTOR; \
551 template <TYPE1 T1, TYPE2 T2> \
552 CLASS<T1,T2>::CLASS(CLASS<T1,T2>& from, \
553 const std::string& name, bool allocate_connectors) \
554 : PARENT(from,name,false) \
556 BBTK_BEGIN_BLACK_BOX_COPY_CONSTRUCTOR(CLASS,from,allocate_connectors); \
557 this->bbUserCopyConstructor(); \
558 BBTK_END_BLACK_BOX_CONSTRUCTOR; \
560 template <TYPE1 T1, TYPE2 T2> \
561 CLASS<T1,T2>::~CLASS() \
563 BBTK_BEGIN_BLACK_BOX_DESTRUCTOR(CLASS); \
564 this->bbUserDestructor(); \
565 BBTK_END_BLACK_BOX_DESTRUCTOR; \
567 //============================================================================
573 //===========================================================================
574 //============================================================================
575 // ITK Specific macros
576 //===========================================================================
577 //===========================================================================
580 //===========================================================================
581 /// Declares an itk-inherited AtomicBlackBox input
582 #define BBTK_DECLARE_ITK_INPUT(PARENT,NAME,TYPE) \
584 TYPE bbGetInput##NAME () \
585 { return PARENT::GetInput(); } \
586 void bbSetInput##NAME (TYPE d) \
587 { PARENT::SetInput(d); \
588 /*bbSetModifiedStatus();*/ }
589 //===========================================================================
591 //===========================================================================
592 #define BBTK_DECLARE_ITK_OUTPUT(PARENT,NAME,TYPE) \
594 TYPE bbGetOutput##NAME () \
595 { return PARENT::GetOutput(); } \
596 void bbSetOutput##NAME (TYPE d) \
597 { /*PARENT::GetOutput() = d;*/ }
598 //===========================================================================
600 //===========================================================================
601 /// Declares an AtomicBlackBox input corresponding to an inherited itk parameter
602 /// which was declared by itkSetMacro/itkGetMacro
603 /// The NAME **MUST** be the same than the itk parameter name
604 #define BBTK_DECLARE_ITK_PARAM(PARENT,NAME,TYPE) \
606 TYPE bbGetInput##NAME () \
607 { return PARENT::Get##NAME(); } \
608 void bbSetInput##NAME (TYPE d) \
609 { PARENT::Set##NAME(d); \
610 /*bbSetModifiedStatus();*/ }
611 //===========================================================================
616 //===========================================================================
617 //============================================================================
618 // VTK Specific macros
619 //===========================================================================
620 //===========================================================================
623 //===========================================================================
626 // { return GetInput(); /*PARENT::GetInput();*/ } \
627 // { PARENT::SetInput( /*(vtkDataObject*)*/ d); \
631 /// Declares a vtkImageAlgorithm-inherited AtomicBlackBox input
632 #define BBTK_DECLARE_VTK_IMAGE_ALGORITHM_INPUT(PARENT,NAME,TYPE) \
634 TYPE bbGetInput##NAME () \
635 { return GetImageDataInput(0); /*PARENT::GetInput();*/ } \
636 void bbSetInput##NAME (TYPE d) \
637 { PARENT::SetInput( (vtkDataObject*) d); \
638 /*bbSetModifiedStatus();*/ }
639 //===========================================================================
640 /// Declares a vtkPolyDataAlgorithm-inherited AtomicBlackBox input
641 #define BBTK_DECLARE_VTK_POLY_DATA_ALGORITHM_INPUT(PARENT,NAME,TYPE) \
643 TYPE bbGetInput##NAME () \
644 { return GetPolyDataInput(0); /*PARENT::GetInput();*/ } \
645 void bbSetInput##NAME (TYPE d) \
646 { PARENT::SetInput( (vtkDataObject*) d); \
647 /*bbSetModifiedStatus();*/ }
648 //===========================================================================
650 //===========================================================================
651 /// Declares a vtkImageAlgorithm-inherited AtomicBlackBox output
652 #define BBTK_DECLARE_VTK_OUTPUT(PARENT,NAME,TYPE) \
654 TYPE bbGetOutput##NAME () \
655 { return PARENT::GetOutput(); } \
656 void bbSetOutput##NAME (TYPE d) \
657 { /*PARENT::GetOutput() = d;*/ }
658 //===========================================================================
660 //===========================================================================
661 /// Declares a vtkAlgorithm-inherited AtomicBlackBox input
662 #define BBTK_DECLARE_VTK_INPUT(PARENT,NAME,TYPE) \
664 TYPE bbGetInput##NAME () \
665 { return dynamic_cast<TYPE>(PARENT::GetInput()); } \
666 void bbSetInput##NAME (TYPE d) \
667 { PARENT::SetInput( (vtkDataObject*) d); /*PARENT::GetOutput() = d;*/ }
669 //===========================================================================
671 //===========================================================================
672 /// Declares an AtomicBlackBox input corresponding to an inherited vtk parameter
673 /// which was declared by vtkSetMacro/vtkGetMacro
674 /// The NAME **MUST** be the same than the vtk parameter name
675 #define BBTK_DECLARE_VTK_PARAM(PARENT,NAME,TYPE) \
677 TYPE bbGetInput##NAME () \
678 { return PARENT::Get##NAME(); } \
679 void bbSetInput##NAME (TYPE d) \
680 { PARENT::Set##NAME(d); \
681 /*bbSetModifiedStatus();*/ }
682 //===========================================================================
686 //===========================================================================
688 //===========================================================================