1 /*=========================================================================
4 Module: $RCSfile: bbtkAtomicBlackBoxMacros.h,v $
6 Date: $Date: 2008/03/03 14:15:52 $
7 Version: $Revision: 1.2 $
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 //============================================================================
274 //============================================================================
275 /// Describes a AtomicBlackBox input (to be put inside the UBB description block)
276 #define BBTK_INPUT(CLASS,NAME,DESCR,TYPE) \
277 AddInputDescriptor(new bbtk::AtomicBlackBoxInputDescriptor \
278 (typeid(CLASS ## Descriptor), \
280 new bbtk::AtomicBlackBoxTGetFunctor<CLASS,TYPE,TYPE > \
281 (&CLASS::bbGetInput##NAME), \
282 new bbtk::AtomicBlackBoxTSetFunctor<CLASS,TYPE,TYPE > \
283 (&CLASS::bbSetInput##NAME) ) )
284 //============================================================================
286 //============================================================================
287 /// Describes a AtomicBlackBox output (to be put inside the UBB description block)
288 #define BBTK_OUTPUT(CLASS,NAME,DESCR,TYPE) \
289 AddOutputDescriptor(new bbtk::AtomicBlackBoxOutputDescriptor \
290 (typeid(CLASS ## Descriptor),#NAME,DESCR, \
291 new bbtk::AtomicBlackBoxTGetFunctor<CLASS,TYPE,TYPE > \
292 (&CLASS::bbGetOutput##NAME), \
293 new bbtk::AtomicBlackBoxTSetFunctor<CLASS,TYPE,TYPE > \
294 (&CLASS::bbSetOutput##NAME) ) )
295 //============================================================================
297 //============================================================================
298 /// Describes a AtomicBlackBox input (to be put inside the UBB description block)
299 #define BBTK_INPUT_NOCOPY(CLASS,NAME,DESCR,TYPE) \
300 AddInputDescriptor(new bbtk::AtomicBlackBoxInputDescriptor \
301 (typeid(CLASS ## Descriptor),#NAME,DESCR, \
302 new bbtk::AtomicBlackBoxTGetFunctor<CLASS,TYPE,TYPE > \
303 (&CLASS::bbGetInput##NAME), \
304 new bbtk::AtomicBlackBoxTSetFunctor<CLASS,TYPE,TYPE > \
305 (&CLASS::bbSetInput##NAME), \
307 //============================================================================
309 //============================================================================
310 /// Describes a AtomicBlackBox output (to be put inside the UBB description block)
311 #define BBTK_OUTPUT_NOCOPY(CLASS,NAME,DESCR,TYPE) \
312 AddOutputDescriptor(new bbtk::AtomicBlackBoxOutputDescriptor \
313 (typeid(CLASS ## Descriptor),#NAME,DESCR, \
314 new bbtk::AtomicBlackBoxTGetFunctor<CLASS,TYPE,TYPE > \
315 (&CLASS::bbGetOutput##NAME), \
316 new bbtk::AtomicBlackBoxTSetFunctor<CLASS,TYPE,TYPE > \
317 (&CLASS::bbSetOutput##NAME),\
319 //============================================================================
330 //============================================================================
331 //============================================================================
332 // Template user black boxes macros
333 //============================================================================
334 //============================================================================
336 //============================================================================
337 /// Begins a template AtomicBlackBox of template param T description block
338 #define BBTK_BEGIN_DESCRIBE_TEMPLATE_BLACK_BOX(CLASS) \
340 class /*BBTK_EXPORT*/ CLASS ## Descriptor : public bbtk::BlackBoxDescriptor \
343 bbtk::BlackBox::Pointer CreateInstance(const std::string& name) \
345 return CLASS<T>::bbNew(name); \
347 CLASS ## Descriptor() \
349 bbtkDebugMessageInc("Kernel",9,#CLASS<<"Descriptor::"<<#CLASS \
350 <<"Descriptor()"<<std::endl)
351 //============================================================================
353 //============================================================================
354 /// Ends a template AtomicBlackBox of template param T description block
355 #define BBTK_END_DESCRIBE_TEMPLATE_BLACK_BOX(CLASS) \
356 bbtkDecTab("Kernel",9); \
360 void CLASS<T>::bbCreateDescriptorIfNeeded() \
362 if ( !bbDescriptorPointer() ) \
363 bbDescriptorPointer() = new CLASS ## Descriptor<T>; \
365 //============================================================================
367 //============================================================================
368 /// Describes a template AtomicBlackBox input (to be put inside the template UBB description block)
369 #define BBTK_TEMPLATE_INPUT(CLASS,NAME,DESCR,TYPE) \
370 AddInputDescriptor(new bbtk::AtomicBlackBoxInputDescriptor \
371 (typeid(CLASS ## Descriptor),#NAME,DESCR, \
372 new bbtk::AtomicBlackBoxTGetFunctor<CLASS<T>,TYPE,TYPE > \
373 (&CLASS<T>::bbGetInput##NAME), \
374 new bbtk::AtomicBlackBoxTSetFunctor<CLASS<T>,TYPE,TYPE > \
375 (&CLASS<T>::bbSetInput##NAME) ) )
376 //============================================================================
378 //============================================================================
379 /// Describes a template AtomicBlackBox output (to be put inside the template UBB description block)
380 #define BBTK_TEMPLATE_OUTPUT(CLASS,NAME,DESCR,TYPE) \
381 AddOutputDescriptor(new bbtk::AtomicBlackBoxOutputDescriptor \
382 (typeid(CLASS ## Descriptor),#NAME,DESCR, \
383 new bbtk::AtomicBlackBoxTGetFunctor<CLASS<T>,TYPE,TYPE > \
384 (&CLASS<T>::bbGetOutput##NAME), \
385 new bbtk::AtomicBlackBoxTSetFunctor<CLASS<T>,TYPE,TYPE > \
386 (&CLASS<T>::bbSetOutput##NAME) ) )
387 //============================================================================
389 //============================================================================
390 /// Template AtomicBlackBox std implementation of ctor and dtor
391 #define BBTK_USER_BLACK_BOX_TEMPLATE_IMPLEMENTATION(CLASS,PARENT) \
393 CLASS<T>::CLASS(const std::string& name, bool alloc) \
394 : PARENT(name,false) \
396 BBTK_BEGIN_BLACK_BOX_CONSTRUCTOR(CLASS<T>,alloc); \
397 CLASS<T>::bbUserConstructor(); \
398 BBTK_END_BLACK_BOX_CONSTRUCTOR; \
401 CLASS<T>::CLASS(CLASS<T>& from, \
402 const std::string& name, bool allocate_connectors) \
403 : PARENT(from,name,false) \
405 BBTK_BEGIN_BLACK_BOX_COPY_CONSTRUCTOR(CLASS<T>,from,allocate_connectors); \
406 CLASS<T>::bbUserCopyConstructor(); \
407 BBTK_END_BLACK_BOX_CONSTRUCTOR; \
412 BBTK_BEGIN_BLACK_BOX_DESTRUCTOR(CLASS<T>); \
413 CLASS<T>::bbUserDestructor(); \
414 BBTK_END_BLACK_BOX_DESTRUCTOR; \
416 //============================================================================
418 //============================================================================
419 // Two template params user black boxes macros
421 /// Begins a template AtomicBlackBox description block of template param T1 and T2
422 #define BBTK_BEGIN_DESCRIBE_TEMPLATE2_BLACK_BOX(CLASS) \
423 template <class T1, class T2> \
424 class /*BBTK_EXPORT*/ CLASS ## Descriptor : public bbtk::BlackBoxDescriptor \
427 bbtk::BlackBox::Pointer CreateInstance(const std::string& name) \
429 return CLASS<T1,T2>::bbNew(name); \
431 CLASS ## Descriptor() \
433 bbtkDebugMessageInc("Kernel",9,#CLASS<<"Descriptor::"<<#CLASS \
434 <<"Descriptor()"<<std::endl)
435 //============================================================================
437 //============================================================================
438 /// Ends a template AtomicBlackBox description block of template param T1 and T2
439 #define BBTK_END_DESCRIBE_TEMPLATE2_BLACK_BOX(CLASS) \
440 bbtkDecTab("Kernel",9); \
443 template <class T1, class T2> \
444 void CLASS<T1,T2>::bbCreateDescriptorIfNeeded() \
446 if ( !bbDescriptorPointer() ) \
447 bbDescriptorPointer() = new CLASS ## Descriptor<T1,T2>; \
449 //============================================================================
451 //============================================================================
452 // Two template params user black boxes macros
454 /// Begins a template AtomicBlackBox description block of template param T1 and T2
455 #define BBTK_BEGIN_DESCRIBE_TEMPLATE2_WITH_TYPES_BLACK_BOX(CLASS,TYPE1,TYPE2) \
456 template <TYPE1 T1, TYPE2 T2> \
457 class /*BBTK_EXPORT*/ CLASS ## Descriptor : public bbtk::BlackBoxDescriptor \
460 bbtk::BlackBox::Pointer CreateInstance(const std::string& name) \
462 return new CLASS<T1,T2>(name); \
464 CLASS ## Descriptor() \
466 bbtkDebugMessageInc("Kernel",9,#CLASS<<"Descriptor::"<<#CLASS \
467 <<"Descriptor()"<<std::endl)
468 //============================================================================
470 //============================================================================
471 /// Ends a template AtomicBlackBox description block of template param T1 and T2
472 #define BBTK_END_DESCRIBE_TEMPLATE2_WITH_TYPES_BLACK_BOX(CLASS,TYPE1,TYPE2) \
473 bbtkDecTab("Kernel",9); \
476 template <TYPE1 T1, TYPE2 T2> \
477 void CLASS<T1,T2>::bbCreateDescriptorIfNeeded() \
479 if ( !bbDescriptorPointer() ) \
480 bbDescriptorPointer() = new CLASS ## Descriptor<T1,T2>; \
482 //============================================================================
486 //============================================================================
487 /// Describes a 2 template params AtomicBlackBox input (to be put inside the UBB description block)
488 #define BBTK_TEMPLATE2_INPUT(CLASS,NAME,DESCR,TYPE) \
489 AddInputDescriptor(new bbtk::AtomicBlackBoxInputDescriptor \
490 (typeid(CLASS ## Descriptor),#NAME,DESCR, \
491 new bbtk::AtomicBlackBoxTGetFunctor<CLASS<T1,T2>,TYPE,TYPE > \
492 (&CLASS<T1,T2>::bbGetInput##NAME), \
493 new bbtk::AtomicBlackBoxTSetFunctor<CLASS<T1,T2>,TYPE,TYPE > \
494 (&CLASS<T1,T2>::bbSetInput##NAME) ) )
495 //============================================================================
497 //============================================================================
498 /// Describes a 2 template params AtomicBlackBox output (to be put inside the UBB description block)
499 #define BBTK_TEMPLATE2_OUTPUT(CLASS,NAME,DESCR,TYPE) \
500 AddOutputDescriptor(new bbtk::AtomicBlackBoxOutputDescriptor \
501 (typeid(CLASS ## Descriptor),#NAME,DESCR, \
502 new bbtk::AtomicBlackBoxTGetFunctor<CLASS<T1,T2>,TYPE,TYPE > \
503 (&CLASS<T1,T2>::bbGetOutput##NAME), \
504 new bbtk::AtomicBlackBoxTSetFunctor<CLASS<T1,T2>,TYPE,TYPE > \
505 (&CLASS<T1,T2>::bbSetOutput##NAME) ) )
506 //============================================================================
508 //============================================================================
509 /// Template AtomicBlackBox std implementation of ctor and dtor
510 #define BBTK_USER_BLACK_BOX_TEMPLATE2_IMPLEMENTATION(CLASS,PARENT) \
511 template <class T1, class T2> \
512 CLASS<T1,T2>::CLASS(const std::string& name, bool alloc) \
513 : PARENT(name,false) \
515 BBTK_BEGIN_BLACK_BOX_CONSTRUCTOR(CLASS,alloc); \
516 CLASS<T1,T2>::bbUserConstructor(); \
517 BBTK_END_BLACK_BOX_CONSTRUCTOR; \
519 template <class T1, class T2> \
520 CLASS<T1,T2>::CLASS(CLASS<T1,T2>& from, \
521 const std::string& name, bool allocate_connectors) \
522 : PARENT(from,name,false) \
524 BBTK_BEGIN_BLACK_BOX_COPY_CONSTRUCTOR(CLASS,from,allocate_connectors); \
525 CLASS<T1,T2>::bbUserCopyConstructor(); \
526 BBTK_END_BLACK_BOX_CONSTRUCTOR; \
528 template <class T1, class T2> \
529 CLASS<T1,T2>::~CLASS() \
531 BBTK_BEGIN_BLACK_BOX_DESTRUCTOR(CLASS); \
532 CLASS<T1,T2>::bbUserDestructor(); \
533 BBTK_END_BLACK_BOX_DESTRUCTOR; \
535 //============================================================================
538 //============================================================================
539 /// Template AtomicBlackBox std implementation of ctor and dtor
540 #define BBTK_USER_BLACK_BOX_TEMPLATE2_WITH_TYPES_IMPLEMENTATION(CLASS,PARENT,TYPE1,TYPE2) \
541 template <TYPE1 T1, TYPE2 T2> \
542 CLASS<T1,T2>::CLASS(const std::string& name, bool alloc) \
543 : PARENT(name,false) \
545 BBTK_BEGIN_BLACK_BOX_CONSTRUCTOR(CLASS,alloc); \
546 this->bbUserConstructor(); \
547 BBTK_END_BLACK_BOX_CONSTRUCTOR; \
549 template <TYPE1 T1, TYPE2 T2> \
550 CLASS<T1,T2>::CLASS(CLASS<T1,T2>& from, \
551 const std::string& name, bool allocate_connectors) \
552 : PARENT(from,name,false) \
554 BBTK_BEGIN_BLACK_BOX_COPY_CONSTRUCTOR(CLASS,from,allocate_connectors); \
555 this->bbUserCopyConstructor(); \
556 BBTK_END_BLACK_BOX_CONSTRUCTOR; \
558 template <TYPE1 T1, TYPE2 T2> \
559 CLASS<T1,T2>::~CLASS() \
561 BBTK_BEGIN_BLACK_BOX_DESTRUCTOR(CLASS); \
562 this->bbUserDestructor(); \
563 BBTK_END_BLACK_BOX_DESTRUCTOR; \
565 //============================================================================
571 //===========================================================================
572 //============================================================================
573 // ITK Specific macros
574 //===========================================================================
575 //===========================================================================
578 //===========================================================================
579 /// Declares an itk-inherited AtomicBlackBox input
580 #define BBTK_DECLARE_ITK_INPUT(PARENT,NAME,TYPE) \
582 TYPE bbGetInput##NAME () \
583 { return PARENT::GetInput(); } \
584 void bbSetInput##NAME (TYPE d) \
585 { PARENT::SetInput(d); \
586 /*bbSetModifiedStatus();*/ }
587 //===========================================================================
589 //===========================================================================
590 #define BBTK_DECLARE_ITK_OUTPUT(PARENT,NAME,TYPE) \
592 TYPE bbGetOutput##NAME () \
593 { return PARENT::GetOutput(); } \
594 void bbSetOutput##NAME (TYPE d) \
595 { /*PARENT::GetOutput() = d;*/ }
596 //===========================================================================
598 //===========================================================================
599 /// Declares an AtomicBlackBox input corresponding to an inherited itk parameter
600 /// which was declared by itkSetMacro/itkGetMacro
601 /// The NAME **MUST** be the same than the itk parameter name
602 #define BBTK_DECLARE_ITK_PARAM(PARENT,NAME,TYPE) \
604 TYPE bbGetInput##NAME () \
605 { return PARENT::Get##NAME(); } \
606 void bbSetInput##NAME (TYPE d) \
607 { PARENT::Set##NAME(d); \
608 /*bbSetModifiedStatus();*/ }
609 //===========================================================================
614 //===========================================================================
615 //============================================================================
616 // VTK Specific macros
617 //===========================================================================
618 //===========================================================================
621 //===========================================================================
624 // { return GetInput(); /*PARENT::GetInput();*/ } \
625 // { PARENT::SetInput( /*(vtkDataObject*)*/ d); \
629 /// Declares a vtkImageAlgorithm-inherited AtomicBlackBox input
630 #define BBTK_DECLARE_VTK_IMAGE_ALGORITHM_INPUT(PARENT,NAME,TYPE) \
632 TYPE bbGetInput##NAME () \
633 { return GetImageDataInput(0); /*PARENT::GetInput();*/ } \
634 void bbSetInput##NAME (TYPE d) \
635 { PARENT::SetInput( (vtkDataObject*) d); \
636 /*bbSetModifiedStatus();*/ }
637 //===========================================================================
638 /// Declares a vtkPolyDataAlgorithm-inherited AtomicBlackBox input
639 #define BBTK_DECLARE_VTK_POLY_DATA_ALGORITHM_INPUT(PARENT,NAME,TYPE) \
641 TYPE bbGetInput##NAME () \
642 { return GetPolyDataInput(0); /*PARENT::GetInput();*/ } \
643 void bbSetInput##NAME (TYPE d) \
644 { PARENT::SetInput( (vtkDataObject*) d); \
645 /*bbSetModifiedStatus();*/ }
646 //===========================================================================
648 //===========================================================================
649 /// Declares a vtkImageAlgorithm-inherited AtomicBlackBox output
650 #define BBTK_DECLARE_VTK_OUTPUT(PARENT,NAME,TYPE) \
652 TYPE bbGetOutput##NAME () \
653 { return PARENT::GetOutput(); } \
654 void bbSetOutput##NAME (TYPE d) \
655 { /*PARENT::GetOutput() = d;*/ }
656 //===========================================================================
658 //===========================================================================
659 /// Declares a vtkAlgorithm-inherited AtomicBlackBox input
660 #define BBTK_DECLARE_VTK_INPUT(PARENT,NAME,TYPE) \
662 TYPE bbGetInput##NAME () \
663 { return dynamic_cast<TYPE>(PARENT::GetInput()); } \
664 void bbSetInput##NAME (TYPE d) \
665 { PARENT::SetInput( (vtkDataObject*) d); /*PARENT::GetOutput() = d;*/ }
667 //===========================================================================
669 //===========================================================================
670 /// Declares an AtomicBlackBox input corresponding to an inherited vtk parameter
671 /// which was declared by vtkSetMacro/vtkGetMacro
672 /// The NAME **MUST** be the same than the vtk parameter name
673 #define BBTK_DECLARE_VTK_PARAM(PARENT,NAME,TYPE) \
675 TYPE bbGetInput##NAME () \
676 { return PARENT::Get##NAME(); } \
677 void bbSetInput##NAME (TYPE d) \
678 { PARENT::Set##NAME(d); \
679 /*bbSetModifiedStatus();*/ }
680 //===========================================================================
684 //===========================================================================
686 //===========================================================================