]> Creatis software - bbtk.git/blobdiff - kernel/src/bbtkAtomicBlackBoxMacros.h
*** empty log message ***
[bbtk.git] / kernel / src / bbtkAtomicBlackBoxMacros.h
index 7ff6640249c0f4c5baddb15655bf704a77581c37..ef5042aae19e35de69223c1d438d14119975f312 100644 (file)
@@ -3,8 +3,8 @@
   Program:   bbtk
   Module:    $RCSfile: bbtkAtomicBlackBoxMacros.h,v $
   Language:  C++
-  Date:      $Date: 2008/04/18 12:59:15 $
-  Version:   $Revision: 1.5 $
+  Date:      $Date: 2008/07/29 07:31:13 $
+  Version:   $Revision: 1.10 $
                                                                                 
   Copyright (c) CREATIS (Centre de Recherche et d'Applications en Traitement de
   l'Image). All rights reserved. See Doc/License.txt or
 #ifndef __bbtkAtomicBlackBoxMacros_h__
 #define __bbtkAtomicBlackBoxMacros_h__
 
+//============================================================================
+/// Declares the standard interface of a AtomicBlackBox 
+/// (ctor, New, descriptor related methods)
+#define BBTK_BLACK_BOX_INTERFACE_INTERNAL_WITHOUT_NEW(CLASS,PARENT)    \
+  BBTK_OBJECT_MINIMAL_INTERFACE;                               \
+  private:                                                             \
+  protected:                                                           \
+  CLASS(const std::string& name, bool allocate_connectors = true);     \
+  CLASS(Self& from, const std::string& name,                           \
+       bool allocate_connectors = true);                               \
+  ~CLASS();                                                            \
+  public:                                                              \
+  std::string GetObjectName() const                                    \
+  { return std::string(#CLASS)+std::string(" '")                       \
+      +bbGetNameWithParent()+std::string("'"); }                       \
+  virtual void bbLockDescriptor();                                     \
+  private:                                                             \
+  CLASS() : PARENT("") {}                                              \
+  CLASS(const CLASS&) : PARENT("") {}                                  
+
+//============================================================================
+
 //============================================================================
 /// Declares the standard interface of a AtomicBlackBox 
 /// (ctor, New, descriptor related methods)
   BBTK_BLACK_BOX_INTERFACE_INTERNAL(CLASS,PARENT);
 //============================================================================
 
+//============================================================================
+#define BBTK_BLACK_BOX_INTERFACE_WITHOUT_NEW(CLASS,PARENT)     \
+  public : typedef CLASS Self;                         \
+  BBTK_BLACK_BOX_INTERFACE_INTERNAL_WITHOUT_NEW(CLASS,PARENT);
+//============================================================================
+
 //============================================================================
 /// Defines the bbUserProcess method
 #define BBTK_PROCESS(CALLBACK)                                         \
   public:                                                              \
   inline void bbUserProcess()                                          \
   {                                                                    \
-    bbtkDebugMessageInc("Process",1,"=> "<<bbGetTypeName()<<"::bbUserProcess() [" \
-                       <<bbGetFullName()<<"]"<<std::endl);             \
+    bbtkDebugMessage("process",1,"**> Processing ["<<bbGetFullName()   \
+                    <<"]"<<std::endl);                                 \
     CALLBACK();                                                                \
-    bbtkDebugMessageDec("Process",1,"<= "<<bbGetTypeName()<<"::bbUserProcess() [" \
-                       <<bbGetFullName()<<"]"<<std::endl);             \
+    bbtkDebugMessage("process",2,"<** Processing ["<<bbGetFullName()   \
+                    <<"]"<<std::endl);                                 \
   }
 //============================================================================
 
 
 
 
-//===========================================================================
-//============================================================================
-// 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();*/ }
-//===========================================================================
-
-
-
-
-//===========================================================================
-//============================================================================
-// 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<TYPE>(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();*/ }
-//===========================================================================