X-Git-Url: https://git.creatis.insa-lyon.fr/pubgit/?a=blobdiff_plain;f=kernel%2Fsrc%2FbbtkAtomicBlackBoxMacros.h;h=69bcc7c5bbae88b923c4d0d4a2e9cc0b9fd23548;hb=1e2df7fb6ae571ce1cf72e6af1715f0e34675cbf;hp=cd4028eddf6792464895c43ca174b811922d1e22;hpb=6f678e6883d4d2734c81492412903c701c8e1f3c;p=bbtk.git diff --git a/kernel/src/bbtkAtomicBlackBoxMacros.h b/kernel/src/bbtkAtomicBlackBoxMacros.h index cd4028e..69bcc7c 100644 --- a/kernel/src/bbtkAtomicBlackBoxMacros.h +++ b/kernel/src/bbtkAtomicBlackBoxMacros.h @@ -1,21 +1,34 @@ -/*========================================================================= - +/*========================================================================= Program: bbtk Module: $RCSfile: bbtkAtomicBlackBoxMacros.h,v $ Language: C++ - Date: $Date: 2008/02/07 11:06:37 $ - Version: $Revision: 1.1 $ - - Copyright (c) CREATIS (Centre de Recherche et d'Applications en Traitement de - l'Image). All rights reserved. See Doc/License.txt or - http://www.creatis.insa-lyon.fr/Public/bbtk/License.html for details. - - This software is distributed WITHOUT ANY WARRANTY; without even - the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR - PURPOSE. See the above copyright notices for more information. - + Date: $Date: 2008/11/25 11:17:13 $ + Version: $Revision: 1.13 $ =========================================================================*/ +/* --------------------------------------------------------------------- + +* Copyright (c) CREATIS-LRMN (Centre de Recherche en Imagerie Medicale) +* Authors : Eduardo Davila, Laurent Guigues, Jean-Pierre Roux +* +* This software is governed by the CeCILL-B license under French law and +* abiding by the rules of distribution of free software. You can use, +* modify and/ or redistribute the software under the terms of the CeCILL-B +* license as circulated by CEA, CNRS and INRIA at the following URL +* http://www.cecill.info/licences/Licence_CeCILL-B_V1-en.html +* or in the file LICENSE.txt. +* +* As a counterpart to the access to the source code and rights to copy, +* modify and redistribute granted by the license, users are provided only +* with a limited warranty and the software's author, the holder of the +* economic rights, and the successive licensors have only limited +* liability. +* +* The fact that you are presently reading this means that you have had +* knowledge of the CeCILL-B license and that you accept its terms. +* ------------------------------------------------------------------------ */ + + /** * \file @@ -27,49 +40,76 @@ //============================================================================ /// Declares the standard interface of a AtomicBlackBox /// (ctor, New, descriptor related methods) -#define BBTK_USER_BLACK_BOX_INTERFACE(CLASS,PARENT) \ +#define BBTK_BLACK_BOX_INTERFACE_INTERNAL_WITHOUT_NEW(CLASS,PARENT) \ + BBTK_OBJECT_MINIMAL_INTERFACE; \ private: \ - inline static void bbCreateDescriptorIfNeeded(); \ protected: \ CLASS(const std::string& name, bool allocate_connectors = true); \ - CLASS(CLASS& from, const std::string& name, \ + CLASS(Self& from, const std::string& name, \ bool allocate_connectors = true); \ ~CLASS(); \ - public: \ - inline static CLASS* bbNew(const std::string& name) \ - { \ - bbtkDebugMessageInc("Kernel",9,#CLASS<<"::bbNew(\""< "<<#CLASS \ + <<"::New(\""< "<<#CLASS \ + <<"::bbClone(\""< "< Processing ["< "<<#CLASS<<"::"<<#CLASS \ + <<"(\""< "<<#CLASS<<"::"<<#CLASS \ <<"("<bbGetFullName()<<"]"< "<<#CLASS <<"::~"<< #CLASS \ + <<"() ["<bbGetFullName()<<"]"<bbGetFullName()<<"]"<()); \ + BBTK_END_BLACK_BOX_COPY_CONSTRUCTOR(CLASS,from); \ } \ CLASS::~CLASS() \ { \ BBTK_BEGIN_BLACK_BOX_DESTRUCTOR(CLASS); \ CLASS::bbUserDestructor(); \ - BBTK_END_BLACK_BOX_DESTRUCTOR; \ - } + BBTK_END_BLACK_BOX_DESTRUCTOR(CLASS); \ + } \ + void CLASS::bbLockDescriptor() \ + { \ + bbmDescriptorPointer = CLASS ## Descriptor::Instance(); \ + } //============================================================================ @@ -207,28 +262,56 @@ #define BBTK_BEGIN_DESCRIBE_BLACK_BOX(CLASS,PARENT) \ class /*BBTK_EXPORT*/ CLASS ## Descriptor : public PARENT ## Descriptor \ { \ + public: typedef CLASS ## Descriptor Self; \ + BBTK_OBJECT_MINIMAL_INTERFACE; \ public: \ - bbtk::BlackBox::Pointer CreateInstance(const std::string& name) \ + std::string GetObjectName() const \ + { \ + return std::string(BBTK_STRINGIFY(CLASS)) \ + +std::string("Descriptor '")+GetFullTypeName() \ + +std::string("'"); \ + } \ + size_t GetObjectSize() const { return sizeof(*this); } \ + bbtk::BlackBox::Pointer NewBlackBox(const std::string& name) \ { \ - return CLASS::bbNew(name); \ + return CLASS::New(name); \ } \ + virtual bbtk::AtomicBlackBoxDescriptor::Pointer GetInstance() const \ + { \ + return Instance(); \ + } \ + static bbtk::AtomicBlackBoxDescriptor::Pointer Instance() \ + { \ + static bbtk::AtomicBlackBoxDescriptor::WeakPointer i; \ + bbtk::AtomicBlackBoxDescriptor::Pointer j; \ + if (!i.lock()) { j = Self::New(); i = j; } \ + return i.lock(); \ + } \ + static CLASS ## Descriptor::Pointer New() \ + { \ + bbtkDebugMessage("object",1,"##> "< "<<#CLASS<<"Descriptor::" \ + <<#CLASS<<"Descriptor()"< \ (&CLASS::bbGetInput##NAME), \ new bbtk::AtomicBlackBoxTSetFunctor \ @@ -281,20 +369,21 @@ //============================================================================ /// Describes a AtomicBlackBox output (to be put inside the UBB description block) -#define BBTK_OUTPUT(CLASS,NAME,DESCR,TYPE) \ +#define BBTK_OUTPUT(CLASS,NAME,DESCR,TYPE,NATURE) \ AddOutputDescriptor(new bbtk::AtomicBlackBoxOutputDescriptor \ - (typeid(CLASS ## Descriptor),#NAME,DESCR, \ + (typeid(CLASS ## Descriptor),#NAME,DESCR,NATURE, \ new bbtk::AtomicBlackBoxTGetFunctor \ (&CLASS::bbGetOutput##NAME), \ new bbtk::AtomicBlackBoxTSetFunctor \ (&CLASS::bbSetOutput##NAME) ) ) //============================================================================ + //============================================================================ /// Describes a AtomicBlackBox input (to be put inside the UBB description block) -#define BBTK_INPUT_NOCOPY(CLASS,NAME,DESCR,TYPE) \ +#define BBTK_INPUT_NOCOPY(CLASS,NAME,DESCR,TYPE,NATURE) \ AddInputDescriptor(new bbtk::AtomicBlackBoxInputDescriptor \ - (typeid(CLASS ## Descriptor),#NAME,DESCR, \ + (typeid(CLASS ## Descriptor),#NAME,DESCR,NATURE, \ new bbtk::AtomicBlackBoxTGetFunctor \ (&CLASS::bbGetInput##NAME), \ new bbtk::AtomicBlackBoxTSetFunctor \ @@ -304,9 +393,9 @@ //============================================================================ /// Describes a AtomicBlackBox output (to be put inside the UBB description block) -#define BBTK_OUTPUT_NOCOPY(CLASS,NAME,DESCR,TYPE) \ +#define BBTK_OUTPUT_NOCOPY(CLASS,NAME,DESCR,TYPE,NATURE) \ AddOutputDescriptor(new bbtk::AtomicBlackBoxOutputDescriptor \ - (typeid(CLASS ## Descriptor),#NAME,DESCR, \ + (typeid(CLASS ## Descriptor),#NAME,DESCR,NATURE, \ new bbtk::AtomicBlackBoxTGetFunctor \ (&CLASS::bbGetOutput##NAME), \ new bbtk::AtomicBlackBoxTSetFunctor \ @@ -329,42 +418,78 @@ //============================================================================ //============================================================================ +//============================================================================ +#define BBTK_TEMPLATE_BLACK_BOX_INTERFACE(CLASS,PARENT,T) \ + public : typedef CLASS Self; \ + BBTK_BLACK_BOX_INTERFACE_INTERNAL(CLASS,PARENT); +//============================================================================ + //============================================================================ /// Begins a template AtomicBlackBox of template param T description block -#define BBTK_BEGIN_DESCRIBE_TEMPLATE_BLACK_BOX(CLASS) \ - template \ - class /*BBTK_EXPORT*/ CLASS ## Descriptor : public bbtk::BlackBoxDescriptor \ +#define BBTK_BEGIN_DESCRIBE_TEMPLATE_BLACK_BOX(CLASS,PARENT) \ + template \ + class /*BBTK_EXPORT*/ CLASS ## Descriptor : public PARENT ## Descriptor \ { \ + public: typedef CLASS ## Descriptor Self; \ + BBTK_OBJECT_MINIMAL_INTERFACE; \ public: \ - bbtk::BlackBox::Pointer CreateInstance(const std::string& name) \ + std::string GetObjectName() const \ { \ - return CLASS::bbNew(name); \ + return std::string(BBTK_STRINGIFY(CLASS)) \ + +std::string("Descriptor<")+bbtk::TypeName() \ + +std::string("> '")+GetFullTypeName() \ + +std::string("'"); \ + } \ + static Pointer New() \ + { \ + bbtkDebugMessage("object",1,"##> "<()<<">::New" \ + <()<<">::New" \ + <::New(name); \ } \ CLASS ## Descriptor() \ { \ - bbtkDebugMessageInc("Kernel",9,#CLASS<<"Descriptor::"<<#CLASS \ - <<"Descriptor()"< "<<#CLASS<<"Descriptor<" \ + <()<<">::" \ + <<#CLASS<<"Descriptor()"<()<<">::" \ + <<#CLASS<<"Descriptor()"< \ - void CLASS::bbCreateDescriptorIfNeeded() \ - { \ - if ( !bbDescriptorPointer() ) \ - bbDescriptorPointer() = new CLASS ## Descriptor; \ - } + }; + //============================================================================ //============================================================================ /// Describes a template AtomicBlackBox input (to be put inside the template UBB description block) #define BBTK_TEMPLATE_INPUT(CLASS,NAME,DESCR,TYPE) \ AddInputDescriptor(new bbtk::AtomicBlackBoxInputDescriptor \ - (typeid(CLASS ## Descriptor),#NAME,DESCR, \ + (typeid(CLASS ## Descriptor),#NAME,DESCR,"", \ new bbtk::AtomicBlackBoxTGetFunctor,TYPE,TYPE > \ (&CLASS::bbGetInput##NAME), \ new bbtk::AtomicBlackBoxTSetFunctor,TYPE,TYPE > \ @@ -375,7 +500,7 @@ /// Describes a template AtomicBlackBox output (to be put inside the template UBB description block) #define BBTK_TEMPLATE_OUTPUT(CLASS,NAME,DESCR,TYPE) \ AddOutputDescriptor(new bbtk::AtomicBlackBoxOutputDescriptor \ - (typeid(CLASS ## Descriptor),#NAME,DESCR, \ + (typeid(CLASS ## Descriptor),#NAME,DESCR,"", \ new bbtk::AtomicBlackBoxTGetFunctor,TYPE,TYPE > \ (&CLASS::bbGetOutput##NAME), \ new bbtk::AtomicBlackBoxTSetFunctor,TYPE,TYPE > \ @@ -384,76 +509,137 @@ //============================================================================ /// Template AtomicBlackBox std implementation of ctor and dtor -#define BBTK_USER_BLACK_BOX_TEMPLATE_IMPLEMENTATION(CLASS,PARENT) \ +#define BBTK_BLACK_BOX_TEMPLATE_IMPLEMENTATION(CLASS,PARENT) \ template \ CLASS::CLASS(const std::string& name, bool alloc) \ : PARENT(name,false) \ { \ - BBTK_BEGIN_BLACK_BOX_CONSTRUCTOR(CLASS,alloc); \ - CLASS::bbUserConstructor(); \ - BBTK_END_BLACK_BOX_CONSTRUCTOR; \ - } \ + BBTK_BEGIN_BLACK_BOX_CONSTRUCTOR(CLASS,alloc); \ + CLASS::bbUserConstructor(); \ + BBTK_END_BLACK_BOX_CONSTRUCTOR(CLASS); \ + } \ template \ - CLASS::CLASS(CLASS& from, \ - const std::string& name, bool allocate_connectors) \ + CLASS::CLASS(CLASS& from, \ + const std::string& name, bool allocate_connectors) \ : PARENT(from,name,false) \ { \ - BBTK_BEGIN_BLACK_BOX_COPY_CONSTRUCTOR(CLASS,from,allocate_connectors); \ - CLASS::bbUserCopyConstructor(); \ - BBTK_END_BLACK_BOX_CONSTRUCTOR; \ - } \ + BBTK_BEGIN_BLACK_BOX_COPY_CONSTRUCTOR(CLASS,from,allocate_connectors); \ + CLASS::bbUserCopyConstructor(from.GetThisPointer()); \ + BBTK_END_BLACK_BOX_COPY_CONSTRUCTOR(CLASS,from); \ + } \ template \ CLASS::~CLASS() \ { \ - BBTK_BEGIN_BLACK_BOX_DESTRUCTOR(CLASS); \ + BBTK_BEGIN_BLACK_BOX_DESTRUCTOR(CLASS); \ CLASS::bbUserDestructor(); \ - BBTK_END_BLACK_BOX_DESTRUCTOR; \ - } + BBTK_END_BLACK_BOX_DESTRUCTOR(CLASS); \ + } \ + template \ + void CLASS::bbLockDescriptor() \ + { \ + bbmDescriptorPointer = CLASS ## Descriptor::Instance(); \ + } //============================================================================ + + //============================================================================ // Two template params user black boxes macros +//============================================================================ + +//============================================================================ +#define BBTK_TEMPLATE2_BLACK_BOX_INTERFACE(CLASS,PARENT,T1,T2) \ + public : typedef CLASS Self; \ + BBTK_BLACK_BOX_INTERFACE_INTERNAL(CLASS,PARENT); +//=========================================================================== +//============================================================================ /// Begins a template AtomicBlackBox description block of template param T1 and T2 -#define BBTK_BEGIN_DESCRIBE_TEMPLATE2_BLACK_BOX(CLASS) \ +#define BBTK_BEGIN_DESCRIBE_TEMPLATE2_BLACK_BOX(CLASS,PARENT) \ template \ - class /*BBTK_EXPORT*/ CLASS ## Descriptor : public bbtk::BlackBoxDescriptor \ + class /*BBTK_EXPORT*/ CLASS ## Descriptor : public PARENT ## Descriptor \ { \ + public: typedef CLASS ## Descriptor Self; \ + BBTK_OBJECT_MINIMAL_INTERFACE; \ public: \ - bbtk::BlackBox::Pointer CreateInstance(const std::string& name) \ + std::string GetObjectName() const \ + { \ + return std::string(BBTK_STRINGIFY(CLASS)) \ + +std::string("Descriptor<")+bbtk::TypeName() \ + +std::string(",")+bbtk::TypeName() \ + +std::string("> '")+GetFullTypeName() \ + +std::string("'"); \ + } \ + static Pointer New() \ + { \ + bbtkDebugMessage("object",1,"##> "<()<<"," \ + <()<<">::New"<()<<"," \ + <()<<">::New"<::bbNew(name); \ + return CLASS::New(name); \ } \ CLASS ## Descriptor() \ { \ - bbtkDebugMessageInc("Kernel",9,#CLASS<<"Descriptor::"<<#CLASS \ - <<"Descriptor()"< "<<#CLASS<<"Descriptor<" \ + <()<<"," \ + <()<<">::" \ + <<#CLASS<<"Descriptor()"<()<<"," \ + <()<<">::" \ + <<#CLASS<<"Descriptor()"< \ - void CLASS::bbCreateDescriptorIfNeeded() \ - { \ - if ( !bbDescriptorPointer() ) \ - bbDescriptorPointer() = new CLASS ## Descriptor; \ - } + }; + //============================================================================ + + +/* //============================================================================ // Two template params user black boxes macros /// Begins a template AtomicBlackBox description block of template param T1 and T2 #define BBTK_BEGIN_DESCRIBE_TEMPLATE2_WITH_TYPES_BLACK_BOX(CLASS,TYPE1,TYPE2) \ template \ - class /*BBTK_EXPORT*/ CLASS ## Descriptor : public bbtk::BlackBoxDescriptor \ + class CLASS ## Descriptor : public bbtk::BlackBoxDescriptor \ { \ public: \ - bbtk::BlackBox::Pointer CreateInstance(const std::string& name) \ + virtual bbtk:AtomicBlackBoxDescriptor::Pointer GetInstance() const \ + { \ + return Instance(); \ + } \ + static bbtk:AtomicBlackBoxDescriptor::Pointer Instance() \ + { \ + static bbtk:AtomicBlackBoxDescriptor::WeakPointer i; \ + bbtk:AtomicBlackBoxDescriptor::Pointer j; \ + if (!i.lock()) { j = Self::New(); i = j; } \ + return i.lock(); \ + } \ + bbtk::BlackBox::Pointer NewBlackBox(const std::string& name) \ { \ return new CLASS(name); \ } \ @@ -468,22 +654,17 @@ #define BBTK_END_DESCRIBE_TEMPLATE2_WITH_TYPES_BLACK_BOX(CLASS,TYPE1,TYPE2) \ bbtkDecTab("Kernel",9); \ } \ - }; \ - template \ - void CLASS::bbCreateDescriptorIfNeeded() \ - { \ - if ( !bbDescriptorPointer() ) \ - bbDescriptorPointer() = new CLASS ## Descriptor; \ - } -//============================================================================ + }; +//============================================================================ +*/ //============================================================================ /// Describes a 2 template params AtomicBlackBox input (to be put inside the UBB description block) #define BBTK_TEMPLATE2_INPUT(CLASS,NAME,DESCR,TYPE) \ AddInputDescriptor(new bbtk::AtomicBlackBoxInputDescriptor \ - (typeid(CLASS ## Descriptor),#NAME,DESCR, \ + (typeid(CLASS ## Descriptor),#NAME,DESCR,"", \ new bbtk::AtomicBlackBoxTGetFunctor,TYPE,TYPE > \ (&CLASS::bbGetInput##NAME), \ new bbtk::AtomicBlackBoxTSetFunctor,TYPE,TYPE > \ @@ -494,7 +675,7 @@ /// Describes a 2 template params AtomicBlackBox output (to be put inside the UBB description block) #define BBTK_TEMPLATE2_OUTPUT(CLASS,NAME,DESCR,TYPE) \ AddOutputDescriptor(new bbtk::AtomicBlackBoxOutputDescriptor \ - (typeid(CLASS ## Descriptor),#NAME,DESCR, \ + (typeid(CLASS ## Descriptor),#NAME,DESCR,"", \ new bbtk::AtomicBlackBoxTGetFunctor,TYPE,TYPE > \ (&CLASS::bbGetOutput##NAME), \ new bbtk::AtomicBlackBoxTSetFunctor,TYPE,TYPE > \ @@ -503,37 +684,43 @@ //============================================================================ /// Template AtomicBlackBox std implementation of ctor and dtor -#define BBTK_USER_BLACK_BOX_TEMPLATE2_IMPLEMENTATION(CLASS,PARENT) \ +#define BBTK_BLACK_BOX_TEMPLATE2_IMPLEMENTATION(CLASS,PARENT) \ template \ CLASS::CLASS(const std::string& name, bool alloc) \ : PARENT(name,false) \ { \ BBTK_BEGIN_BLACK_BOX_CONSTRUCTOR(CLASS,alloc); \ CLASS::bbUserConstructor(); \ - BBTK_END_BLACK_BOX_CONSTRUCTOR; \ + BBTK_END_BLACK_BOX_CONSTRUCTOR(CLASS); \ } \ - template \ - CLASS::CLASS(CLASS& from, \ - const std::string& name, bool allocate_connectors) \ + template \ + CLASS::CLASS(CLASS& from, \ + const std::string& name, bool allocate_connectors) \ : PARENT(from,name,false) \ { \ BBTK_BEGIN_BLACK_BOX_COPY_CONSTRUCTOR(CLASS,from,allocate_connectors); \ - CLASS::bbUserCopyConstructor(); \ - BBTK_END_BLACK_BOX_CONSTRUCTOR; \ + CLASS::bbUserCopyConstructor(from.GetThisPointer()); \ + BBTK_END_BLACK_BOX_COPY_CONSTRUCTOR(CLASS,from); \ } \ template \ CLASS::~CLASS() \ { \ BBTK_BEGIN_BLACK_BOX_DESTRUCTOR(CLASS); \ CLASS::bbUserDestructor(); \ - BBTK_END_BLACK_BOX_DESTRUCTOR; \ - } + BBTK_END_BLACK_BOX_DESTRUCTOR(CLASS); \ + } \ + template \ + void CLASS::bbLockDescriptor() \ + { \ + bbmDescriptorPointer = CLASS ## Descriptor::Instance(); \ + } //============================================================================ +/* //============================================================================ /// Template AtomicBlackBox std implementation of ctor and dtor -#define BBTK_USER_BLACK_BOX_TEMPLATE2_WITH_TYPES_IMPLEMENTATION(CLASS,PARENT,TYPE1,TYPE2) \ +#define BBTK_BLACK_BOX_TEMPLATE2_WITH_TYPES_IMPLEMENTATION(CLASS,PARENT,TYPE1,TYPE2) \ template \ CLASS::CLASS(const std::string& name, bool alloc) \ : PARENT(name,false) \ @@ -557,123 +744,19 @@ BBTK_BEGIN_BLACK_BOX_DESTRUCTOR(CLASS); \ this->bbUserDestructor(); \ BBTK_END_BLACK_BOX_DESTRUCTOR; \ - } -//============================================================================ - - - - - -//=========================================================================== -//============================================================================ -// ITK Specific macros -//=========================================================================== -//=========================================================================== - - -//=========================================================================== -/// Declares an itk-inherited AtomicBlackBox input -#define BBTK_DECLARE_ITK_INPUT(PARENT,NAME,TYPE) \ - public: \ - TYPE bbGetInput##NAME () \ - { return PARENT::GetInput(); } \ - void bbSetInput##NAME (TYPE d) \ - { PARENT::SetInput(d); \ - /*bbSetModifiedStatus();*/ } -//=========================================================================== - -//=========================================================================== -#define BBTK_DECLARE_ITK_OUTPUT(PARENT,NAME,TYPE) \ - public: \ - TYPE bbGetOutput##NAME () \ - { return PARENT::GetOutput(); } \ - void bbSetOutput##NAME (TYPE d) \ - { /*PARENT::GetOutput() = d;*/ } -//=========================================================================== - -//=========================================================================== -/// Declares an AtomicBlackBox input corresponding to an inherited itk parameter -/// which was declared by itkSetMacro/itkGetMacro -/// The NAME **MUST** be the same than the itk parameter name -#define BBTK_DECLARE_ITK_PARAM(PARENT,NAME,TYPE) \ - public: \ - TYPE bbGetInput##NAME () \ - { return PARENT::Get##NAME(); } \ - void bbSetInput##NAME (TYPE d) \ - { PARENT::Set##NAME(d); \ - /*bbSetModifiedStatus();*/ } -//=========================================================================== - - - - -//=========================================================================== + } \ + template \ + void CLASS::bbLockDescriptor() \ + { \ + bbmDescriptorPointer = CLASS ## Descriptor::Instance(); \ + } //============================================================================ -// VTK Specific macros -//=========================================================================== -//=========================================================================== - -//=========================================================================== +*/ -// EED sept 04 \ -// { return GetInput(); /*PARENT::GetInput();*/ } \ -// { PARENT::SetInput( /*(vtkDataObject*)*/ d); \ -/// Declares a vtkImageAlgorithm-inherited AtomicBlackBox input -#define BBTK_DECLARE_VTK_IMAGE_ALGORITHM_INPUT(PARENT,NAME,TYPE) \ - public: \ - TYPE bbGetInput##NAME () \ - { return GetImageDataInput(0); /*PARENT::GetInput();*/ } \ - void bbSetInput##NAME (TYPE d) \ - { PARENT::SetInput( (vtkDataObject*) d); \ - /*bbSetModifiedStatus();*/ } -//=========================================================================== -/// Declares a vtkPolyDataAlgorithm-inherited AtomicBlackBox input -#define BBTK_DECLARE_VTK_POLY_DATA_ALGORITHM_INPUT(PARENT,NAME,TYPE) \ - public: \ - TYPE bbGetInput##NAME () \ - { return GetPolyDataInput(0); /*PARENT::GetInput();*/ } \ - void bbSetInput##NAME (TYPE d) \ - { PARENT::SetInput( (vtkDataObject*) d); \ - /*bbSetModifiedStatus();*/ } -//=========================================================================== - -//=========================================================================== -/// Declares a vtkImageAlgorithm-inherited AtomicBlackBox output -#define BBTK_DECLARE_VTK_OUTPUT(PARENT,NAME,TYPE) \ - public: \ - TYPE bbGetOutput##NAME () \ - { return PARENT::GetOutput(); } \ - void bbSetOutput##NAME (TYPE d) \ - { /*PARENT::GetOutput() = d;*/ } -//=========================================================================== - -//=========================================================================== -/// Declares a vtkAlgorithm-inherited AtomicBlackBox input -#define BBTK_DECLARE_VTK_INPUT(PARENT,NAME,TYPE) \ - public: \ - TYPE bbGetInput##NAME () \ - { return dynamic_cast(PARENT::GetInput()); } \ - void bbSetInput##NAME (TYPE d) \ - { PARENT::SetInput( (vtkDataObject*) d); /*PARENT::GetOutput() = d;*/ } - -//=========================================================================== - -//=========================================================================== -/// Declares an AtomicBlackBox input corresponding to an inherited vtk parameter -/// which was declared by vtkSetMacro/vtkGetMacro -/// The NAME **MUST** be the same than the vtk parameter name -#define BBTK_DECLARE_VTK_PARAM(PARENT,NAME,TYPE) \ - public: \ - TYPE bbGetInput##NAME () \ - { return PARENT::Get##NAME(); } \ - void bbSetInput##NAME (TYPE d) \ - { PARENT::Set##NAME(d); \ - /*bbSetModifiedStatus();*/ } -//===========================================================================