bbtkVtkBlackBoxMacros.h

Go to the documentation of this file.
00001 /*=========================================================================                                                                               
00002   Program:   bbtk
00003   Module:    $RCSfile: bbtkVtkBlackBoxMacros.h,v $
00004   Language:  C++
00005   Date:      $Date: 2008/10/17 08:18:14 $
00006   Version:   $Revision: 1.7 $
00007 =========================================================================*/
00008 
00009 /* ---------------------------------------------------------------------
00010 
00011 * Copyright (c) CREATIS-LRMN (Centre de Recherche en Imagerie Medicale)
00012 * Authors : Eduardo Davila, Laurent Guigues, Jean-Pierre Roux
00013 *
00014 *  This software is governed by the CeCILL-B license under French law and 
00015 *  abiding by the rules of distribution of free software. You can  use, 
00016 *  modify and/ or redistribute the software under the terms of the CeCILL-B 
00017 *  license as circulated by CEA, CNRS and INRIA at the following URL 
00018 *  http://www.cecill.info/licences/Licence_CeCILL-B_V1-en.html 
00019 *  or in the file LICENSE.txt.
00020 *
00021 *  As a counterpart to the access to the source code and  rights to copy,
00022 *  modify and redistribute granted by the license, users are provided only
00023 *  with a limited warranty  and the software's author,  the holder of the
00024 *  economic rights,  and the successive licensors  have only  limited
00025 *  liability. 
00026 *
00027 *  The fact that you are presently reading this means that you have had
00028 *  knowledge of the CeCILL-B license and that you accept its terms.
00029 * ------------------------------------------------------------------------ */                                                                         
00030 
00031 
00032 
00037 #ifndef __bbtkVtkBlackBoxMacros_h__
00038 #define __bbtkVtkBlackBoxMacros_h__
00039 //#include <vtkGarbageCollector.h>
00040 //#include <vtkObjectFactory.h>
00041 #include <vtkDebugLeaks.h>
00042 
00043 
00044 //===========================================================================
00045 //============================================================================
00046 // VTK Specific macros
00047 //===========================================================================
00048 //===========================================================================
00049 
00050 
00051 //===========================================================================
00052 #define BBTK_VTK_DELETE()                                               \
00053   void bbDelete() {                                                     \
00054     bbGetOutputOut()->SetSource(NULL);                                  \
00055     vtkParent::Delete();                                                \
00056   }
00057 
00058 //    bbmDescriptorPointer.reset();             
00059 //===========================================================================
00060 
00061 //===========================================================================
00062 #define BBTK_VTK_NEW(CLASS,VTKPARENT)                                   \
00063   inline static Pointer New(const std::string& name)                    \
00064   {                                                                     \
00065     vtkDebugLeaks::ConstructClass(#VTKPARENT);                          \
00066     bbtkDebugMessage("object",1,"##> "<<#CLASS                          \
00067                      <<"::New(\""<<name<<"\")"<<std::endl);             \
00068     Pointer p = MakeBlackBoxPointer(new Self(name));                    \
00069     bbtkDebugMessage("object",1,"<## "<<#CLASS                          \
00070                      <<"::New(\""<<name<<"\")"<<std::endl);             \
00071     return p;                                                           \
00072   }                                                                     \
00073 //===========================================================================
00074 
00075 //===========================================================================
00076 #define BBTK_VTK_CLONE(CLASS,VTKPARENT)                                 \
00077   inline bbtk::BlackBox::Pointer bbClone(const std::string& name)       \
00078   {                                                                     \
00079     vtkDebugLeaks::ConstructClass(#VTKPARENT);                          \
00080     bbtkDebugMessage("object",1,"##> "<<#CLASS                          \
00081                      <<"::bbClone(\""<<name<<"\")"<<std::endl);         \
00082     Pointer p = MakeBlackBoxPointer(new Self(*this,name));              \
00083     bbtkDebugMessage("object",1,"<## "<<#CLASS                          \
00084                      <<"::bbClone(\""<<name<<"\")"<<std::endl);         \
00085     return p;                                                           \
00086   }                                                                     \
00087 
00088 
00089 //===========================================================================
00090 #define BBTK_VTK_BLACK_BOX_INTERFACE(CLASS,PARENTBLACKBOX,VTKPARENT)    \
00091   BBTK_BLACK_BOX_INTERFACE_WITHOUT_NEW(CLASS,PARENTBLACKBOX);           \
00092   typedef VTKPARENT vtkParent;                                          \
00093   BBTK_VTK_DELETE();                                                    \
00094   public :                                                              \
00095   BBTK_VTK_NEW(CLASS,VTKPARENT);                                        \
00096   BBTK_VTK_CLONE(CLASS,VTKPARENT);                                                      
00097 //===========================================================================
00098 
00099 //===========================================================================
00101 #define BBTK_DECLARE_VTK_IMAGE_ALGORITHM_INPUT(NAME,TYPE)               \
00102   public:                                                               \
00103   TYPE bbGetInput##NAME ()                                              \
00104   { return GetImageDataInput(0); /*vtkParent::GetInput();*/ }           \
00105   void bbSetInput##NAME (TYPE d)                                        \
00106   { vtkParent::SetInput( (vtkDataObject*) d);                           \
00107     /*bbSetModifiedStatus();*/ }                                
00108 //===========================================================================
00109 
00110 //===========================================================================
00112 #define BBTK_DECLARE_VTK_POLY_DATA_ALGORITHM_INPUT(NAME,TYPE)           \
00113   public:                                                               \
00114   TYPE bbGetInput##NAME ()                                              \
00115   { return GetPolyDataInput(0); /*vtkParent::GetInput();*/ }            \
00116   void bbSetInput##NAME (TYPE d)                                        \
00117   { vtkParent::SetInput( (vtkDataObject*) d);                           \
00118     /*bbSetModifiedStatus();*/ }                                                       
00119 //===========================================================================
00120 
00121 //===========================================================================
00123 #define BBTK_DECLARE_VTK_OUTPUT(NAME,TYPE)                              \
00124   public:                                                               \
00125   TYPE bbGetOutput##NAME ()                                             \
00126   { return vtkParent::GetOutput(); }                                    \
00127   void bbSetOutput##NAME (TYPE d)                                       \
00128   { /*vtkParent::GetOutput() = d;*/ }                                   
00129 //===========================================================================
00130 
00131 //===========================================================================
00133 #define BBTK_DECLARE_VTK_INPUT(NAME,TYPE)                       \
00134   public:                                                               \
00135   TYPE bbGetInput##NAME ()                                              \
00136   { return dynamic_cast<TYPE>(vtkParent::GetInput()); }                 \
00137   void bbSetInput##NAME (TYPE d)                                        \
00138   { vtkParent::SetInput( (vtkDataObject*) d); /*vtkParent::GetOutput() = d;*/ }
00139 
00140 //===========================================================================
00141 
00142 //===========================================================================
00147 #define BBTK_DECLARE_VTK_PARAM(NAME,TYPE)                       \
00148   public:                                                               \
00149   TYPE bbGetInput##NAME ()                                              \
00150   { return vtkParent::Get##NAME(); }                                    \
00151   void bbSetInput##NAME (TYPE d)                                        \
00152   { vtkParent::Set##NAME(d);                                            \
00153     /*bbSetModifiedStatus();*/ }
00154 //===========================================================================
00155 
00156 
00157 
00158 //============================================================================
00161 #define BBTK_VTK_PROCESS()                                              \
00162   public:                                                               \
00163   inline void bbUserProcess()                                           \
00164   {                                                                     \
00165     bbtkDebugMessage("process",1,"**> Processing ["<<bbGetFullName()    \
00166                      <<"]"<<std::endl);                                 \
00167     vtkParent::Update();                                                \
00168     bbtkDebugMessage("process",2,"<** Processing ["<<bbGetFullName()    \
00169                      <<"]"<<std::endl);                                 \
00170   }
00171 //============================================================================
00172 
00173 
00174 //===========================================================================
00176 //===========================================================================
00177 #endif

Generated on Wed Nov 12 11:37:08 2008 for BBTK by  doxygen 1.5.6