1 /*=========================================================================
4 Module: $RCSfile: bbtkAtomicBlackBoxMacros.h,v $
6 Date: $Date: 2008/02/07 11:06:37 $
7 Version: $Revision: 1.1 $
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() SetKInd(bbtk::BlackBoxDescriptor::ADAPTOR)
263 //============================================================================
265 //============================================================================
266 /// Declares that the AtomicBlackBox 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 AtomicBlackBox input (to be put inside the UBB description block)
272 #define BBTK_INPUT(CLASS,NAME,DESCR,TYPE) \
273 AddInputDescriptor(new bbtk::AtomicBlackBoxInputDescriptor \
274 (typeid(CLASS ## Descriptor), \
276 new bbtk::AtomicBlackBoxTGetFunctor<CLASS,TYPE,TYPE > \
277 (&CLASS::bbGetInput##NAME), \
278 new bbtk::AtomicBlackBoxTSetFunctor<CLASS,TYPE,TYPE > \
279 (&CLASS::bbSetInput##NAME) ) )
280 //============================================================================
282 //============================================================================
283 /// Describes a AtomicBlackBox output (to be put inside the UBB description block)
284 #define BBTK_OUTPUT(CLASS,NAME,DESCR,TYPE) \
285 AddOutputDescriptor(new bbtk::AtomicBlackBoxOutputDescriptor \
286 (typeid(CLASS ## Descriptor),#NAME,DESCR, \
287 new bbtk::AtomicBlackBoxTGetFunctor<CLASS,TYPE,TYPE > \
288 (&CLASS::bbGetOutput##NAME), \
289 new bbtk::AtomicBlackBoxTSetFunctor<CLASS,TYPE,TYPE > \
290 (&CLASS::bbSetOutput##NAME) ) )
291 //============================================================================
293 //============================================================================
294 /// Describes a AtomicBlackBox input (to be put inside the UBB description block)
295 #define BBTK_INPUT_NOCOPY(CLASS,NAME,DESCR,TYPE) \
296 AddInputDescriptor(new bbtk::AtomicBlackBoxInputDescriptor \
297 (typeid(CLASS ## Descriptor),#NAME,DESCR, \
298 new bbtk::AtomicBlackBoxTGetFunctor<CLASS,TYPE,TYPE > \
299 (&CLASS::bbGetInput##NAME), \
300 new bbtk::AtomicBlackBoxTSetFunctor<CLASS,TYPE,TYPE > \
301 (&CLASS::bbSetInput##NAME), \
303 //============================================================================
305 //============================================================================
306 /// Describes a AtomicBlackBox output (to be put inside the UBB description block)
307 #define BBTK_OUTPUT_NOCOPY(CLASS,NAME,DESCR,TYPE) \
308 AddOutputDescriptor(new bbtk::AtomicBlackBoxOutputDescriptor \
309 (typeid(CLASS ## Descriptor),#NAME,DESCR, \
310 new bbtk::AtomicBlackBoxTGetFunctor<CLASS,TYPE,TYPE > \
311 (&CLASS::bbGetOutput##NAME), \
312 new bbtk::AtomicBlackBoxTSetFunctor<CLASS,TYPE,TYPE > \
313 (&CLASS::bbSetOutput##NAME),\
315 //============================================================================
326 //============================================================================
327 //============================================================================
328 // Template user black boxes macros
329 //============================================================================
330 //============================================================================
332 //============================================================================
333 /// Begins a template AtomicBlackBox of template param T description block
334 #define BBTK_BEGIN_DESCRIBE_TEMPLATE_BLACK_BOX(CLASS) \
336 class /*BBTK_EXPORT*/ CLASS ## Descriptor : public bbtk::BlackBoxDescriptor \
339 bbtk::BlackBox::Pointer CreateInstance(const std::string& name) \
341 return CLASS<T>::bbNew(name); \
343 CLASS ## Descriptor() \
345 bbtkDebugMessageInc("Kernel",9,#CLASS<<"Descriptor::"<<#CLASS \
346 <<"Descriptor()"<<std::endl)
347 //============================================================================
349 //============================================================================
350 /// Ends a template AtomicBlackBox of template param T description block
351 #define BBTK_END_DESCRIBE_TEMPLATE_BLACK_BOX(CLASS) \
352 bbtkDecTab("Kernel",9); \
356 void CLASS<T>::bbCreateDescriptorIfNeeded() \
358 if ( !bbDescriptorPointer() ) \
359 bbDescriptorPointer() = new CLASS ## Descriptor<T>; \
361 //============================================================================
363 //============================================================================
364 /// Describes a template AtomicBlackBox input (to be put inside the template UBB description block)
365 #define BBTK_TEMPLATE_INPUT(CLASS,NAME,DESCR,TYPE) \
366 AddInputDescriptor(new bbtk::AtomicBlackBoxInputDescriptor \
367 (typeid(CLASS ## Descriptor),#NAME,DESCR, \
368 new bbtk::AtomicBlackBoxTGetFunctor<CLASS<T>,TYPE,TYPE > \
369 (&CLASS<T>::bbGetInput##NAME), \
370 new bbtk::AtomicBlackBoxTSetFunctor<CLASS<T>,TYPE,TYPE > \
371 (&CLASS<T>::bbSetInput##NAME) ) )
372 //============================================================================
374 //============================================================================
375 /// Describes a template AtomicBlackBox output (to be put inside the template UBB description block)
376 #define BBTK_TEMPLATE_OUTPUT(CLASS,NAME,DESCR,TYPE) \
377 AddOutputDescriptor(new bbtk::AtomicBlackBoxOutputDescriptor \
378 (typeid(CLASS ## Descriptor),#NAME,DESCR, \
379 new bbtk::AtomicBlackBoxTGetFunctor<CLASS<T>,TYPE,TYPE > \
380 (&CLASS<T>::bbGetOutput##NAME), \
381 new bbtk::AtomicBlackBoxTSetFunctor<CLASS<T>,TYPE,TYPE > \
382 (&CLASS<T>::bbSetOutput##NAME) ) )
383 //============================================================================
385 //============================================================================
386 /// Template AtomicBlackBox std implementation of ctor and dtor
387 #define BBTK_USER_BLACK_BOX_TEMPLATE_IMPLEMENTATION(CLASS,PARENT) \
389 CLASS<T>::CLASS(const std::string& name, bool alloc) \
390 : PARENT(name,false) \
392 BBTK_BEGIN_BLACK_BOX_CONSTRUCTOR(CLASS<T>,alloc); \
393 CLASS<T>::bbUserConstructor(); \
394 BBTK_END_BLACK_BOX_CONSTRUCTOR; \
397 CLASS<T>::CLASS(CLASS<T>& from, \
398 const std::string& name, bool allocate_connectors) \
399 : PARENT(from,name,false) \
401 BBTK_BEGIN_BLACK_BOX_COPY_CONSTRUCTOR(CLASS<T>,from,allocate_connectors); \
402 CLASS<T>::bbUserCopyConstructor(); \
403 BBTK_END_BLACK_BOX_CONSTRUCTOR; \
408 BBTK_BEGIN_BLACK_BOX_DESTRUCTOR(CLASS<T>); \
409 CLASS<T>::bbUserDestructor(); \
410 BBTK_END_BLACK_BOX_DESTRUCTOR; \
412 //============================================================================
414 //============================================================================
415 // Two template params user black boxes macros
417 /// Begins a template AtomicBlackBox description block of template param T1 and T2
418 #define BBTK_BEGIN_DESCRIBE_TEMPLATE2_BLACK_BOX(CLASS) \
419 template <class T1, class T2> \
420 class /*BBTK_EXPORT*/ CLASS ## Descriptor : public bbtk::BlackBoxDescriptor \
423 bbtk::BlackBox::Pointer CreateInstance(const std::string& name) \
425 return CLASS<T1,T2>::bbNew(name); \
427 CLASS ## Descriptor() \
429 bbtkDebugMessageInc("Kernel",9,#CLASS<<"Descriptor::"<<#CLASS \
430 <<"Descriptor()"<<std::endl)
431 //============================================================================
433 //============================================================================
434 /// Ends a template AtomicBlackBox description block of template param T1 and T2
435 #define BBTK_END_DESCRIBE_TEMPLATE2_BLACK_BOX(CLASS) \
436 bbtkDecTab("Kernel",9); \
439 template <class T1, class T2> \
440 void CLASS<T1,T2>::bbCreateDescriptorIfNeeded() \
442 if ( !bbDescriptorPointer() ) \
443 bbDescriptorPointer() = new CLASS ## Descriptor<T1,T2>; \
445 //============================================================================
447 //============================================================================
448 // Two template params user black boxes macros
450 /// Begins a template AtomicBlackBox description block of template param T1 and T2
451 #define BBTK_BEGIN_DESCRIBE_TEMPLATE2_WITH_TYPES_BLACK_BOX(CLASS,TYPE1,TYPE2) \
452 template <TYPE1 T1, TYPE2 T2> \
453 class /*BBTK_EXPORT*/ CLASS ## Descriptor : public bbtk::BlackBoxDescriptor \
456 bbtk::BlackBox::Pointer CreateInstance(const std::string& name) \
458 return new CLASS<T1,T2>(name); \
460 CLASS ## Descriptor() \
462 bbtkDebugMessageInc("Kernel",9,#CLASS<<"Descriptor::"<<#CLASS \
463 <<"Descriptor()"<<std::endl)
464 //============================================================================
466 //============================================================================
467 /// Ends a template AtomicBlackBox description block of template param T1 and T2
468 #define BBTK_END_DESCRIBE_TEMPLATE2_WITH_TYPES_BLACK_BOX(CLASS,TYPE1,TYPE2) \
469 bbtkDecTab("Kernel",9); \
472 template <TYPE1 T1, TYPE2 T2> \
473 void CLASS<T1,T2>::bbCreateDescriptorIfNeeded() \
475 if ( !bbDescriptorPointer() ) \
476 bbDescriptorPointer() = new CLASS ## Descriptor<T1,T2>; \
478 //============================================================================
482 //============================================================================
483 /// Describes a 2 template params AtomicBlackBox input (to be put inside the UBB description block)
484 #define BBTK_TEMPLATE2_INPUT(CLASS,NAME,DESCR,TYPE) \
485 AddInputDescriptor(new bbtk::AtomicBlackBoxInputDescriptor \
486 (typeid(CLASS ## Descriptor),#NAME,DESCR, \
487 new bbtk::AtomicBlackBoxTGetFunctor<CLASS<T1,T2>,TYPE,TYPE > \
488 (&CLASS<T1,T2>::bbGetInput##NAME), \
489 new bbtk::AtomicBlackBoxTSetFunctor<CLASS<T1,T2>,TYPE,TYPE > \
490 (&CLASS<T1,T2>::bbSetInput##NAME) ) )
491 //============================================================================
493 //============================================================================
494 /// Describes a 2 template params AtomicBlackBox output (to be put inside the UBB description block)
495 #define BBTK_TEMPLATE2_OUTPUT(CLASS,NAME,DESCR,TYPE) \
496 AddOutputDescriptor(new bbtk::AtomicBlackBoxOutputDescriptor \
497 (typeid(CLASS ## Descriptor),#NAME,DESCR, \
498 new bbtk::AtomicBlackBoxTGetFunctor<CLASS<T1,T2>,TYPE,TYPE > \
499 (&CLASS<T1,T2>::bbGetOutput##NAME), \
500 new bbtk::AtomicBlackBoxTSetFunctor<CLASS<T1,T2>,TYPE,TYPE > \
501 (&CLASS<T1,T2>::bbSetOutput##NAME) ) )
502 //============================================================================
504 //============================================================================
505 /// Template AtomicBlackBox std implementation of ctor and dtor
506 #define BBTK_USER_BLACK_BOX_TEMPLATE2_IMPLEMENTATION(CLASS,PARENT) \
507 template <class T1, class T2> \
508 CLASS<T1,T2>::CLASS(const std::string& name, bool alloc) \
509 : PARENT(name,false) \
511 BBTK_BEGIN_BLACK_BOX_CONSTRUCTOR(CLASS,alloc); \
512 CLASS<T1,T2>::bbUserConstructor(); \
513 BBTK_END_BLACK_BOX_CONSTRUCTOR; \
515 template <class T1, class T2> \
516 CLASS<T1,T2>::CLASS(CLASS<T1,T2>& from, \
517 const std::string& name, bool allocate_connectors) \
518 : PARENT(from,name,false) \
520 BBTK_BEGIN_BLACK_BOX_COPY_CONSTRUCTOR(CLASS,from,allocate_connectors); \
521 CLASS<T1,T2>::bbUserCopyConstructor(); \
522 BBTK_END_BLACK_BOX_CONSTRUCTOR; \
524 template <class T1, class T2> \
525 CLASS<T1,T2>::~CLASS() \
527 BBTK_BEGIN_BLACK_BOX_DESTRUCTOR(CLASS); \
528 CLASS<T1,T2>::bbUserDestructor(); \
529 BBTK_END_BLACK_BOX_DESTRUCTOR; \
531 //============================================================================
534 //============================================================================
535 /// Template AtomicBlackBox std implementation of ctor and dtor
536 #define BBTK_USER_BLACK_BOX_TEMPLATE2_WITH_TYPES_IMPLEMENTATION(CLASS,PARENT,TYPE1,TYPE2) \
537 template <TYPE1 T1, TYPE2 T2> \
538 CLASS<T1,T2>::CLASS(const std::string& name, bool alloc) \
539 : PARENT(name,false) \
541 BBTK_BEGIN_BLACK_BOX_CONSTRUCTOR(CLASS,alloc); \
542 this->bbUserConstructor(); \
543 BBTK_END_BLACK_BOX_CONSTRUCTOR; \
545 template <TYPE1 T1, TYPE2 T2> \
546 CLASS<T1,T2>::CLASS(CLASS<T1,T2>& from, \
547 const std::string& name, bool allocate_connectors) \
548 : PARENT(from,name,false) \
550 BBTK_BEGIN_BLACK_BOX_COPY_CONSTRUCTOR(CLASS,from,allocate_connectors); \
551 this->bbUserCopyConstructor(); \
552 BBTK_END_BLACK_BOX_CONSTRUCTOR; \
554 template <TYPE1 T1, TYPE2 T2> \
555 CLASS<T1,T2>::~CLASS() \
557 BBTK_BEGIN_BLACK_BOX_DESTRUCTOR(CLASS); \
558 this->bbUserDestructor(); \
559 BBTK_END_BLACK_BOX_DESTRUCTOR; \
561 //============================================================================
567 //===========================================================================
568 //============================================================================
569 // ITK Specific macros
570 //===========================================================================
571 //===========================================================================
574 //===========================================================================
575 /// Declares an itk-inherited AtomicBlackBox input
576 #define BBTK_DECLARE_ITK_INPUT(PARENT,NAME,TYPE) \
578 TYPE bbGetInput##NAME () \
579 { return PARENT::GetInput(); } \
580 void bbSetInput##NAME (TYPE d) \
581 { PARENT::SetInput(d); \
582 /*bbSetModifiedStatus();*/ }
583 //===========================================================================
585 //===========================================================================
586 #define BBTK_DECLARE_ITK_OUTPUT(PARENT,NAME,TYPE) \
588 TYPE bbGetOutput##NAME () \
589 { return PARENT::GetOutput(); } \
590 void bbSetOutput##NAME (TYPE d) \
591 { /*PARENT::GetOutput() = d;*/ }
592 //===========================================================================
594 //===========================================================================
595 /// Declares an AtomicBlackBox input corresponding to an inherited itk parameter
596 /// which was declared by itkSetMacro/itkGetMacro
597 /// The NAME **MUST** be the same than the itk parameter name
598 #define BBTK_DECLARE_ITK_PARAM(PARENT,NAME,TYPE) \
600 TYPE bbGetInput##NAME () \
601 { return PARENT::Get##NAME(); } \
602 void bbSetInput##NAME (TYPE d) \
603 { PARENT::Set##NAME(d); \
604 /*bbSetModifiedStatus();*/ }
605 //===========================================================================
610 //===========================================================================
611 //============================================================================
612 // VTK Specific macros
613 //===========================================================================
614 //===========================================================================
617 //===========================================================================
620 // { return GetInput(); /*PARENT::GetInput();*/ } \
621 // { PARENT::SetInput( /*(vtkDataObject*)*/ d); \
625 /// Declares a vtkImageAlgorithm-inherited AtomicBlackBox input
626 #define BBTK_DECLARE_VTK_IMAGE_ALGORITHM_INPUT(PARENT,NAME,TYPE) \
628 TYPE bbGetInput##NAME () \
629 { return GetImageDataInput(0); /*PARENT::GetInput();*/ } \
630 void bbSetInput##NAME (TYPE d) \
631 { PARENT::SetInput( (vtkDataObject*) d); \
632 /*bbSetModifiedStatus();*/ }
633 //===========================================================================
634 /// Declares a vtkPolyDataAlgorithm-inherited AtomicBlackBox input
635 #define BBTK_DECLARE_VTK_POLY_DATA_ALGORITHM_INPUT(PARENT,NAME,TYPE) \
637 TYPE bbGetInput##NAME () \
638 { return GetPolyDataInput(0); /*PARENT::GetInput();*/ } \
639 void bbSetInput##NAME (TYPE d) \
640 { PARENT::SetInput( (vtkDataObject*) d); \
641 /*bbSetModifiedStatus();*/ }
642 //===========================================================================
644 //===========================================================================
645 /// Declares a vtkImageAlgorithm-inherited AtomicBlackBox output
646 #define BBTK_DECLARE_VTK_OUTPUT(PARENT,NAME,TYPE) \
648 TYPE bbGetOutput##NAME () \
649 { return PARENT::GetOutput(); } \
650 void bbSetOutput##NAME (TYPE d) \
651 { /*PARENT::GetOutput() = d;*/ }
652 //===========================================================================
654 //===========================================================================
655 /// Declares a vtkAlgorithm-inherited AtomicBlackBox input
656 #define BBTK_DECLARE_VTK_INPUT(PARENT,NAME,TYPE) \
658 TYPE bbGetInput##NAME () \
659 { return dynamic_cast<TYPE>(PARENT::GetInput()); } \
660 void bbSetInput##NAME (TYPE d) \
661 { PARENT::SetInput( (vtkDataObject*) d); /*PARENT::GetOutput() = d;*/ }
663 //===========================================================================
665 //===========================================================================
666 /// Declares an AtomicBlackBox input corresponding to an inherited vtk parameter
667 /// which was declared by vtkSetMacro/vtkGetMacro
668 /// The NAME **MUST** be the same than the vtk parameter name
669 #define BBTK_DECLARE_VTK_PARAM(PARENT,NAME,TYPE) \
671 TYPE bbGetInput##NAME () \
672 { return PARENT::Get##NAME(); } \
673 void bbSetInput##NAME (TYPE d) \
674 { PARENT::Set##NAME(d); \
675 /*bbSetModifiedStatus();*/ }
676 //===========================================================================
680 //===========================================================================
682 //===========================================================================