1 /*=========================================================================
4 Module: $RCSfile: bbtkAtomicBlackBoxMacros.h,v $
6 Date: $Date: 2008/04/09 11:16:56 $
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 __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 c->bbGetDescriptor()->Reference(); \
45 bbtkDebugDecTab("Kernel",9); \
48 inline bbtk::BlackBox* bbClone(const std::string& name) \
50 bbtkDebugMessageInc("Kernel",9,#CLASS<<"::bbClone(\""<<name<<"\")"<<std::endl); \
51 bbCreateDescriptorIfNeeded(); \
52 CLASS* c = new CLASS(*this,name); \
53 bbGetDescriptor()->Reference(); \
54 bbtkDebugDecTab("Kernel",9); \
57 bbtk::BlackBoxDescriptor* bbGetDescriptor() const \
59 return (bbtk::BlackBoxDescriptor*)bbDescriptor(); \
61 static bbtk::BlackBoxDescriptor* bbDescriptor() \
63 bbCreateDescriptorIfNeeded(); \
64 return bbDescriptorPointer(); \
67 CLASS() : PARENT("") {} \
68 static bbtk::BlackBoxDescriptor*& bbDescriptorPointer() \
70 static bbtk::BlackBoxDescriptor* d = 0; \
73 //============================================================================
76 //============================================================================
77 /// Defines the bbUserProcess method
78 #define BBTK_PROCESS(CALLBACK) \
80 inline void bbUserProcess() \
82 bbtkDebugMessageInc("Process",1,"=> "<<bbGetTypeName()<<"::bbUserProcess() [" \
83 <<bbGetFullName()<<"]"<<std::endl); \
85 bbtkDebugMessageDec("Process",1,"<= "<<bbGetTypeName()<<"::bbUserProcess() [" \
86 <<bbGetFullName()<<"]"<<std::endl); \
88 //============================================================================
91 //============================================================================
92 /// Declares a new AtomicBlackBox input (to be put in the class interface)
93 #define BBTK_DECLARE_INPUT(NAME,TYPE) \
95 TYPE bbmInput##NAME; \
97 TYPE bbGetInput##NAME () \
98 { return bbmInput##NAME; } \
99 void bbSetInput##NAME (TYPE d) \
100 { bbmInput##NAME = d; \
101 /*bbSetModifiedStatus();*/ }
102 //============================================================================
104 //============================================================================
105 /// Declares a new AtomicBlackBox output (to be put in the class interface)
106 #define BBTK_DECLARE_OUTPUT(NAME,TYPE) \
108 TYPE bbmOutput##NAME; \
110 TYPE bbGetOutput##NAME () \
111 { return bbmOutput##NAME; } \
112 void bbSetOutput##NAME (TYPE d) \
113 { bbmOutput##NAME = d; }
114 //============================================================================
116 //============================================================================
117 /// Declares an inherited AtomicBlackBox input (to be put in the class interface)
118 #define BBTK_DECLARE_INHERITED_INPUT(NAME,TYPE,GETMETHOD,SETMETHOD) \
120 TYPE bbGetInput##NAME () \
121 { return GETMETHOD(); } \
122 void bbSetInput##NAME (TYPE d) \
124 /*bbSetModifiedStatus();*/ }
125 //============================================================================
128 //============================================================================
129 /// Declares an inherited AtomicBlackBox output (to be put in the class interface)
130 #define BBTK_DECLARE_INHERITED_OUTPUT(NAME,TYPE,GETMETHOD,SETMETHOD) \
132 TYPE bbGetOutput##NAME () const \
133 { return GETMETHOD(); } \
134 void bbSetOutput##NAME (TYPE d) \
136 //============================================================================
140 //============================================================================
141 #define BBTK_BEGIN_BLACK_BOX_CONSTRUCTOR(CLASS,ALLOC) \
142 bbtkDebugMessageInc("Kernel",7,#CLASS<<"::"<<#CLASS \
143 <<"(\""<<bbGetName()<<"\")"<<std::endl); \
144 if (ALLOC) bbAllocateConnectors();
145 //============================================================================
147 //============================================================================
148 #define BBTK_BEGIN_BLACK_BOX_COPY_CONSTRUCTOR(CLASS,FROM,ALLOC) \
149 bbtkDebugMessageInc("Kernel",7,#CLASS<<"::"<<#CLASS \
150 <<"("<<FROM.bbGetFullName()<<",\"" \
151 <<bbGetName()<<"\")"<<std::endl); \
154 bbAllocateConnectors(); \
155 bbCopyIOValues(FROM); \
157 //============================================================================
160 //============================================================================
161 #define BBTK_END_BLACK_BOX_CONSTRUCTOR \
162 bbtkDebugDecTab("Kernel",7)
163 //============================================================================
165 //============================================================================
166 #define BBTK_BEGIN_BLACK_BOX_DESTRUCTOR(CLASS) \
167 bbtkDebugMessageInc("Kernel",7,#CLASS <<"::~"<< #CLASS \
168 <<"() ["<<this->bbGetFullName()<<"]"<<std::endl);
169 //============================================================================
174 //============================================================================
175 #define BBTK_END_BLACK_BOX_DESTRUCTOR \
176 bbtkDebugDecTab("Kernel",7)
177 //============================================================================
180 //============================================================================
181 /// AtomicBlackBox std implementation of ctor and dtor
182 #define BBTK_USER_BLACK_BOX_IMPLEMENTATION(CLASS,PARENT) \
183 CLASS::CLASS(const std::string& name, bool allocate_connectors) \
184 : PARENT(name,false) \
186 BBTK_BEGIN_BLACK_BOX_CONSTRUCTOR(CLASS,allocate_connectors); \
187 CLASS::bbUserConstructor(); \
188 BBTK_END_BLACK_BOX_CONSTRUCTOR; \
190 CLASS::CLASS(CLASS& from, \
191 const std::string& name, bool allocate_connectors) \
192 : PARENT(from,name,false) \
194 BBTK_BEGIN_BLACK_BOX_COPY_CONSTRUCTOR(CLASS,from,allocate_connectors); \
195 CLASS::bbUserCopyConstructor(); \
196 BBTK_END_BLACK_BOX_CONSTRUCTOR; \
200 BBTK_BEGIN_BLACK_BOX_DESTRUCTOR(CLASS); \
201 CLASS::bbUserDestructor(); \
202 BBTK_END_BLACK_BOX_DESTRUCTOR; \
204 //============================================================================
207 //============================================================================
208 /// Begins the AtomicBlackBox description block
209 #define BBTK_BEGIN_DESCRIBE_BLACK_BOX(CLASS,PARENT) \
210 class /*BBTK_EXPORT*/ CLASS ## Descriptor : public PARENT ## Descriptor \
213 bbtk::BlackBox::Pointer CreateInstance(const std::string& name) \
215 return CLASS::bbNew(name); \
217 CLASS ## Descriptor() \
219 bbtkDebugMessageInc("Kernel",9,#CLASS<<"Descriptor::"<<#CLASS \
220 <<"Descriptor()"<<std::endl)
221 //============================================================================
223 //============================================================================
224 /// Ends the AtomicBlackBox description block
225 #define BBTK_END_DESCRIBE_BLACK_BOX(CLASS) \
226 bbtkDecTab("Kernel",9); \
229 void CLASS::bbCreateDescriptorIfNeeded() \
231 if ( !bbDescriptorPointer() ) \
232 bbDescriptorPointer() = new CLASS ## Descriptor; \
234 //============================================================================
237 //============================================================================
238 /// Declares the name of a AtomicBlackBox (to be put inside the UBB description block)
239 #define BBTK_NAME(NAME) SetTypeName(NAME)
240 //============================================================================
242 //============================================================================
243 /// Declares the author of a AtomicBlackBox (to be put inside the UBB description block)
244 #define BBTK_AUTHOR(AUTHOR) AddToAuthor(AUTHOR)
245 //============================================================================
247 //============================================================================
248 /// Declares the categories of a AtomicBlackBox (to be put inside the UBB description block)
249 #define BBTK_CATEGORY(CATEGORY) AddToCategory(CATEGORY)
250 //============================================================================
252 //============================================================================
253 /// Declares the description of a AtomicBlackBox (to be put inside the UBB description block)
254 #define BBTK_DESCRIPTION(DESCR) AddToDescription(DESCR)
255 //============================================================================
257 //============================================================================
258 /// Declares the kind of a AtomicBlackBox (to be put inside the UBB description block)
259 //#define BBTK_KIND(KIND) SetKind(KIND)
260 //============================================================================
262 //============================================================================
263 /// Declares that the AtomicBlackBox is an adaptor (to be put inside the UBB description block)
264 #define BBTK_ADAPTOR() \
265 SetKind(bbtk::BlackBoxDescriptor::ADAPTOR); \
266 AddToCategory("adaptor")
267 //============================================================================
269 //============================================================================
270 /// Declares that the AtomicBlackBox is the default adaptor of the package (to be put inside the UBB description block)
271 #define BBTK_DEFAULT_ADAPTOR() \
272 SetKind(bbtk::BlackBoxDescriptor::DEFAULT_ADAPTOR); \
273 AddToCategory("adaptor")
274 //============================================================================
277 //============================================================================
278 /// Describes a AtomicBlackBox input (to be put inside the UBB description block)
279 #define BBTK_INPUT(CLASS,NAME,DESCR,TYPE,NATURE) \
280 AddInputDescriptor(new bbtk::AtomicBlackBoxInputDescriptor \
281 (typeid(CLASS ## Descriptor), \
282 #NAME,DESCR,NATURE, \
283 new bbtk::AtomicBlackBoxTGetFunctor<CLASS,TYPE,TYPE > \
284 (&CLASS::bbGetInput##NAME), \
285 new bbtk::AtomicBlackBoxTSetFunctor<CLASS,TYPE,TYPE > \
286 (&CLASS::bbSetInput##NAME) ) )
287 //============================================================================
289 //============================================================================
290 /// Describes a AtomicBlackBox output (to be put inside the UBB description block)
291 #define BBTK_OUTPUT(CLASS,NAME,DESCR,TYPE,NATURE) \
292 AddOutputDescriptor(new bbtk::AtomicBlackBoxOutputDescriptor \
293 (typeid(CLASS ## Descriptor),#NAME,DESCR,NATURE, \
294 new bbtk::AtomicBlackBoxTGetFunctor<CLASS,TYPE,TYPE > \
295 (&CLASS::bbGetOutput##NAME), \
296 new bbtk::AtomicBlackBoxTSetFunctor<CLASS,TYPE,TYPE > \
297 (&CLASS::bbSetOutput##NAME) ) )
298 //============================================================================
301 //============================================================================
302 /// Describes a AtomicBlackBox input (to be put inside the UBB description block)
303 #define BBTK_INPUT_NOCOPY(CLASS,NAME,DESCR,TYPE,NATURE) \
304 AddInputDescriptor(new bbtk::AtomicBlackBoxInputDescriptor \
305 (typeid(CLASS ## Descriptor),#NAME,DESCR,NATURE, \
306 new bbtk::AtomicBlackBoxTGetFunctor<CLASS,TYPE,TYPE > \
307 (&CLASS::bbGetInput##NAME), \
308 new bbtk::AtomicBlackBoxTSetFunctor<CLASS,TYPE,TYPE > \
309 (&CLASS::bbSetInput##NAME), \
311 //============================================================================
313 //============================================================================
314 /// Describes a AtomicBlackBox output (to be put inside the UBB description block)
315 #define BBTK_OUTPUT_NOCOPY(CLASS,NAME,DESCR,TYPE,NATURE) \
316 AddOutputDescriptor(new bbtk::AtomicBlackBoxOutputDescriptor \
317 (typeid(CLASS ## Descriptor),#NAME,DESCR,NATURE, \
318 new bbtk::AtomicBlackBoxTGetFunctor<CLASS,TYPE,TYPE > \
319 (&CLASS::bbGetOutput##NAME), \
320 new bbtk::AtomicBlackBoxTSetFunctor<CLASS,TYPE,TYPE > \
321 (&CLASS::bbSetOutput##NAME),\
323 //============================================================================
334 //============================================================================
335 //============================================================================
336 // Template user black boxes macros
337 //============================================================================
338 //============================================================================
340 //============================================================================
341 /// Begins a template AtomicBlackBox of template param T description block
342 #define BBTK_BEGIN_DESCRIBE_TEMPLATE_BLACK_BOX(CLASS) \
344 class /*BBTK_EXPORT*/ CLASS ## Descriptor : public bbtk::BlackBoxDescriptor \
347 bbtk::BlackBox::Pointer CreateInstance(const std::string& name) \
349 return CLASS<T>::bbNew(name); \
351 CLASS ## Descriptor() \
353 bbtkDebugMessageInc("Kernel",9,#CLASS<<"Descriptor::"<<#CLASS \
354 <<"Descriptor()"<<std::endl)
355 //============================================================================
357 //============================================================================
358 /// Ends a template AtomicBlackBox of template param T description block
359 #define BBTK_END_DESCRIBE_TEMPLATE_BLACK_BOX(CLASS) \
360 bbtkDecTab("Kernel",9); \
364 void CLASS<T>::bbCreateDescriptorIfNeeded() \
366 if ( !bbDescriptorPointer() ) \
367 bbDescriptorPointer() = new CLASS ## Descriptor<T>; \
369 //============================================================================
371 //============================================================================
372 /// Describes a template AtomicBlackBox input (to be put inside the template UBB description block)
373 #define BBTK_TEMPLATE_INPUT(CLASS,NAME,DESCR,TYPE) \
374 AddInputDescriptor(new bbtk::AtomicBlackBoxInputDescriptor \
375 (typeid(CLASS ## Descriptor),#NAME,DESCR,"", \
376 new bbtk::AtomicBlackBoxTGetFunctor<CLASS<T>,TYPE,TYPE > \
377 (&CLASS<T>::bbGetInput##NAME), \
378 new bbtk::AtomicBlackBoxTSetFunctor<CLASS<T>,TYPE,TYPE > \
379 (&CLASS<T>::bbSetInput##NAME) ) )
380 //============================================================================
382 //============================================================================
383 /// Describes a template AtomicBlackBox output (to be put inside the template UBB description block)
384 #define BBTK_TEMPLATE_OUTPUT(CLASS,NAME,DESCR,TYPE) \
385 AddOutputDescriptor(new bbtk::AtomicBlackBoxOutputDescriptor \
386 (typeid(CLASS ## Descriptor),#NAME,DESCR,"", \
387 new bbtk::AtomicBlackBoxTGetFunctor<CLASS<T>,TYPE,TYPE > \
388 (&CLASS<T>::bbGetOutput##NAME), \
389 new bbtk::AtomicBlackBoxTSetFunctor<CLASS<T>,TYPE,TYPE > \
390 (&CLASS<T>::bbSetOutput##NAME) ) )
391 //============================================================================
393 //============================================================================
394 /// Template AtomicBlackBox std implementation of ctor and dtor
395 #define BBTK_USER_BLACK_BOX_TEMPLATE_IMPLEMENTATION(CLASS,PARENT) \
397 CLASS<T>::CLASS(const std::string& name, bool alloc) \
398 : PARENT(name,false) \
400 BBTK_BEGIN_BLACK_BOX_CONSTRUCTOR(CLASS<T>,alloc); \
401 CLASS<T>::bbUserConstructor(); \
402 BBTK_END_BLACK_BOX_CONSTRUCTOR; \
405 CLASS<T>::CLASS(CLASS<T>& from, \
406 const std::string& name, bool allocate_connectors) \
407 : PARENT(from,name,false) \
409 BBTK_BEGIN_BLACK_BOX_COPY_CONSTRUCTOR(CLASS<T>,from,allocate_connectors); \
410 CLASS<T>::bbUserCopyConstructor(); \
411 BBTK_END_BLACK_BOX_CONSTRUCTOR; \
416 BBTK_BEGIN_BLACK_BOX_DESTRUCTOR(CLASS<T>); \
417 CLASS<T>::bbUserDestructor(); \
418 BBTK_END_BLACK_BOX_DESTRUCTOR; \
420 //============================================================================
422 //============================================================================
423 // Two template params user black boxes macros
425 /// Begins a template AtomicBlackBox description block of template param T1 and T2
426 #define BBTK_BEGIN_DESCRIBE_TEMPLATE2_BLACK_BOX(CLASS) \
427 template <class T1, class T2> \
428 class /*BBTK_EXPORT*/ CLASS ## Descriptor : public bbtk::BlackBoxDescriptor \
431 bbtk::BlackBox::Pointer CreateInstance(const std::string& name) \
433 return CLASS<T1,T2>::bbNew(name); \
435 CLASS ## Descriptor() \
437 bbtkDebugMessageInc("Kernel",9,#CLASS<<"Descriptor::"<<#CLASS \
438 <<"Descriptor()"<<std::endl)
439 //============================================================================
441 //============================================================================
442 /// Ends a template AtomicBlackBox description block of template param T1 and T2
443 #define BBTK_END_DESCRIBE_TEMPLATE2_BLACK_BOX(CLASS) \
444 bbtkDecTab("Kernel",9); \
447 template <class T1, class T2> \
448 void CLASS<T1,T2>::bbCreateDescriptorIfNeeded() \
450 if ( !bbDescriptorPointer() ) \
451 bbDescriptorPointer() = new CLASS ## Descriptor<T1,T2>; \
453 //============================================================================
455 //============================================================================
456 // Two template params user black boxes macros
458 /// Begins a template AtomicBlackBox description block of template param T1 and T2
459 #define BBTK_BEGIN_DESCRIBE_TEMPLATE2_WITH_TYPES_BLACK_BOX(CLASS,TYPE1,TYPE2) \
460 template <TYPE1 T1, TYPE2 T2> \
461 class /*BBTK_EXPORT*/ CLASS ## Descriptor : public bbtk::BlackBoxDescriptor \
464 bbtk::BlackBox::Pointer CreateInstance(const std::string& name) \
466 return new CLASS<T1,T2>(name); \
468 CLASS ## Descriptor() \
470 bbtkDebugMessageInc("Kernel",9,#CLASS<<"Descriptor::"<<#CLASS \
471 <<"Descriptor()"<<std::endl)
472 //============================================================================
474 //============================================================================
475 /// Ends a template AtomicBlackBox description block of template param T1 and T2
476 #define BBTK_END_DESCRIBE_TEMPLATE2_WITH_TYPES_BLACK_BOX(CLASS,TYPE1,TYPE2) \
477 bbtkDecTab("Kernel",9); \
480 template <TYPE1 T1, TYPE2 T2> \
481 void CLASS<T1,T2>::bbCreateDescriptorIfNeeded() \
483 if ( !bbDescriptorPointer() ) \
484 bbDescriptorPointer() = new CLASS ## Descriptor<T1,T2>; \
486 //============================================================================
490 //============================================================================
491 /// Describes a 2 template params AtomicBlackBox input (to be put inside the UBB description block)
492 #define BBTK_TEMPLATE2_INPUT(CLASS,NAME,DESCR,TYPE) \
493 AddInputDescriptor(new bbtk::AtomicBlackBoxInputDescriptor \
494 (typeid(CLASS ## Descriptor),#NAME,DESCR,"", \
495 new bbtk::AtomicBlackBoxTGetFunctor<CLASS<T1,T2>,TYPE,TYPE > \
496 (&CLASS<T1,T2>::bbGetInput##NAME), \
497 new bbtk::AtomicBlackBoxTSetFunctor<CLASS<T1,T2>,TYPE,TYPE > \
498 (&CLASS<T1,T2>::bbSetInput##NAME) ) )
499 //============================================================================
501 //============================================================================
502 /// Describes a 2 template params AtomicBlackBox output (to be put inside the UBB description block)
503 #define BBTK_TEMPLATE2_OUTPUT(CLASS,NAME,DESCR,TYPE) \
504 AddOutputDescriptor(new bbtk::AtomicBlackBoxOutputDescriptor \
505 (typeid(CLASS ## Descriptor),#NAME,DESCR,"", \
506 new bbtk::AtomicBlackBoxTGetFunctor<CLASS<T1,T2>,TYPE,TYPE > \
507 (&CLASS<T1,T2>::bbGetOutput##NAME), \
508 new bbtk::AtomicBlackBoxTSetFunctor<CLASS<T1,T2>,TYPE,TYPE > \
509 (&CLASS<T1,T2>::bbSetOutput##NAME) ) )
510 //============================================================================
512 //============================================================================
513 /// Template AtomicBlackBox std implementation of ctor and dtor
514 #define BBTK_USER_BLACK_BOX_TEMPLATE2_IMPLEMENTATION(CLASS,PARENT) \
515 template <class T1, class T2> \
516 CLASS<T1,T2>::CLASS(const std::string& name, bool alloc) \
517 : PARENT(name,false) \
519 BBTK_BEGIN_BLACK_BOX_CONSTRUCTOR(CLASS,alloc); \
520 CLASS<T1,T2>::bbUserConstructor(); \
521 BBTK_END_BLACK_BOX_CONSTRUCTOR; \
523 template <class T1, class T2> \
524 CLASS<T1,T2>::CLASS(CLASS<T1,T2>& from, \
525 const std::string& name, bool allocate_connectors) \
526 : PARENT(from,name,false) \
528 BBTK_BEGIN_BLACK_BOX_COPY_CONSTRUCTOR(CLASS,from,allocate_connectors); \
529 CLASS<T1,T2>::bbUserCopyConstructor(); \
530 BBTK_END_BLACK_BOX_CONSTRUCTOR; \
532 template <class T1, class T2> \
533 CLASS<T1,T2>::~CLASS() \
535 BBTK_BEGIN_BLACK_BOX_DESTRUCTOR(CLASS); \
536 CLASS<T1,T2>::bbUserDestructor(); \
537 BBTK_END_BLACK_BOX_DESTRUCTOR; \
539 //============================================================================
542 //============================================================================
543 /// Template AtomicBlackBox std implementation of ctor and dtor
544 #define BBTK_USER_BLACK_BOX_TEMPLATE2_WITH_TYPES_IMPLEMENTATION(CLASS,PARENT,TYPE1,TYPE2) \
545 template <TYPE1 T1, TYPE2 T2> \
546 CLASS<T1,T2>::CLASS(const std::string& name, bool alloc) \
547 : PARENT(name,false) \
549 BBTK_BEGIN_BLACK_BOX_CONSTRUCTOR(CLASS,alloc); \
550 this->bbUserConstructor(); \
551 BBTK_END_BLACK_BOX_CONSTRUCTOR; \
553 template <TYPE1 T1, TYPE2 T2> \
554 CLASS<T1,T2>::CLASS(CLASS<T1,T2>& from, \
555 const std::string& name, bool allocate_connectors) \
556 : PARENT(from,name,false) \
558 BBTK_BEGIN_BLACK_BOX_COPY_CONSTRUCTOR(CLASS,from,allocate_connectors); \
559 this->bbUserCopyConstructor(); \
560 BBTK_END_BLACK_BOX_CONSTRUCTOR; \
562 template <TYPE1 T1, TYPE2 T2> \
563 CLASS<T1,T2>::~CLASS() \
565 BBTK_BEGIN_BLACK_BOX_DESTRUCTOR(CLASS); \
566 this->bbUserDestructor(); \
567 BBTK_END_BLACK_BOX_DESTRUCTOR; \
569 //============================================================================
575 //===========================================================================
576 //============================================================================
577 // ITK Specific macros
578 //===========================================================================
579 //===========================================================================
582 //===========================================================================
583 /// Declares an itk-inherited AtomicBlackBox input
584 #define BBTK_DECLARE_ITK_INPUT(PARENT,NAME,TYPE) \
586 TYPE bbGetInput##NAME () \
587 { return PARENT::GetInput(); } \
588 void bbSetInput##NAME (TYPE d) \
589 { PARENT::SetInput(d); \
590 /*bbSetModifiedStatus();*/ }
591 //===========================================================================
593 //===========================================================================
594 #define BBTK_DECLARE_ITK_OUTPUT(PARENT,NAME,TYPE) \
596 TYPE bbGetOutput##NAME () \
597 { return PARENT::GetOutput(); } \
598 void bbSetOutput##NAME (TYPE d) \
599 { /*PARENT::GetOutput() = d;*/ }
600 //===========================================================================
602 //===========================================================================
603 /// Declares an AtomicBlackBox input corresponding to an inherited itk parameter
604 /// which was declared by itkSetMacro/itkGetMacro
605 /// The NAME **MUST** be the same than the itk parameter name
606 #define BBTK_DECLARE_ITK_PARAM(PARENT,NAME,TYPE) \
608 TYPE bbGetInput##NAME () \
609 { return PARENT::Get##NAME(); } \
610 void bbSetInput##NAME (TYPE d) \
611 { PARENT::Set##NAME(d); \
612 /*bbSetModifiedStatus();*/ }
613 //===========================================================================
618 //===========================================================================
619 //============================================================================
620 // VTK Specific macros
621 //===========================================================================
622 //===========================================================================
625 //===========================================================================
628 // { return GetInput(); /*PARENT::GetInput();*/ } \
629 // { PARENT::SetInput( /*(vtkDataObject*)*/ d); \
633 /// Declares a vtkImageAlgorithm-inherited AtomicBlackBox input
634 #define BBTK_DECLARE_VTK_IMAGE_ALGORITHM_INPUT(PARENT,NAME,TYPE) \
636 TYPE bbGetInput##NAME () \
637 { return GetImageDataInput(0); /*PARENT::GetInput();*/ } \
638 void bbSetInput##NAME (TYPE d) \
639 { PARENT::SetInput( (vtkDataObject*) d); \
640 /*bbSetModifiedStatus();*/ }
641 //===========================================================================
642 /// Declares a vtkPolyDataAlgorithm-inherited AtomicBlackBox input
643 #define BBTK_DECLARE_VTK_POLY_DATA_ALGORITHM_INPUT(PARENT,NAME,TYPE) \
645 TYPE bbGetInput##NAME () \
646 { return GetPolyDataInput(0); /*PARENT::GetInput();*/ } \
647 void bbSetInput##NAME (TYPE d) \
648 { PARENT::SetInput( (vtkDataObject*) d); \
649 /*bbSetModifiedStatus();*/ }
650 //===========================================================================
652 //===========================================================================
653 /// Declares a vtkImageAlgorithm-inherited AtomicBlackBox output
654 #define BBTK_DECLARE_VTK_OUTPUT(PARENT,NAME,TYPE) \
656 TYPE bbGetOutput##NAME () \
657 { return PARENT::GetOutput(); } \
658 void bbSetOutput##NAME (TYPE d) \
659 { /*PARENT::GetOutput() = d;*/ }
660 //===========================================================================
662 //===========================================================================
663 /// Declares a vtkAlgorithm-inherited AtomicBlackBox input
664 #define BBTK_DECLARE_VTK_INPUT(PARENT,NAME,TYPE) \
666 TYPE bbGetInput##NAME () \
667 { return dynamic_cast<TYPE>(PARENT::GetInput()); } \
668 void bbSetInput##NAME (TYPE d) \
669 { PARENT::SetInput( (vtkDataObject*) d); /*PARENT::GetOutput() = d;*/ }
671 //===========================================================================
673 //===========================================================================
674 /// Declares an AtomicBlackBox input corresponding to an inherited vtk parameter
675 /// which was declared by vtkSetMacro/vtkGetMacro
676 /// The NAME **MUST** be the same than the vtk parameter name
677 #define BBTK_DECLARE_VTK_PARAM(PARENT,NAME,TYPE) \
679 TYPE bbGetInput##NAME () \
680 { return PARENT::Get##NAME(); } \
681 void bbSetInput##NAME (TYPE d) \
682 { PARENT::Set##NAME(d); \
683 /*bbSetModifiedStatus();*/ }
684 //===========================================================================
688 //===========================================================================
690 //===========================================================================