]> Creatis software - bbtk.git/commitdiff
*** empty log message ***
authorguigues <guigues>
Thu, 7 Feb 2008 11:06:37 +0000 (11:06 +0000)
committerguigues <guigues>
Thu, 7 Feb 2008 11:06:37 +0000 (11:06 +0000)
12 files changed:
kernel/src/bbtkAtomicBlackBox.cxx [new file with mode: 0644]
kernel/src/bbtkAtomicBlackBox.h [new file with mode: 0644]
kernel/src/bbtkAtomicBlackBoxDescriptor.h [new file with mode: 0644]
kernel/src/bbtkAtomicBlackBoxGetSetFunctor.h [new file with mode: 0644]
kernel/src/bbtkAtomicBlackBoxInputDescriptor.cxx [new file with mode: 0644]
kernel/src/bbtkAtomicBlackBoxInputDescriptor.h [new file with mode: 0644]
kernel/src/bbtkAtomicBlackBoxMacros.h [new file with mode: 0644]
kernel/src/bbtkAtomicBlackBoxOutputDescriptor.cxx [new file with mode: 0644]
kernel/src/bbtkAtomicBlackBoxOutputDescriptor.h [new file with mode: 0644]
kernel/src/bbtkBlackBoxDescriptor.cxx
kernel/src/bbtkComplexBlackBoxDescriptor.cxx
kernel/src/bbtkRTTI.h

diff --git a/kernel/src/bbtkAtomicBlackBox.cxx b/kernel/src/bbtkAtomicBlackBox.cxx
new file mode 100644 (file)
index 0000000..6b8d402
--- /dev/null
@@ -0,0 +1,242 @@
+/*=========================================================================
+                                                                                
+  Program:   bbtk
+  Module:    $RCSfile: bbtkAtomicBlackBox.cxx,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.
+                                                                                
+=========================================================================*/
+
+
+/**
+ *  \file 
+ *  \brief class bbtk::AtomicBlackBox : abstract user defined black boxes
+ */
+#include "bbtkAtomicBlackBox.h"
+
+namespace bbtk
+{
+  
+  //=========================================================================
+  AtomicBlackBox::AtomicBlackBox(const std::string &name, bool alloc)
+    : BlackBox(name)
+  {
+    bbtkDebugMessageInc("Kernel",7,
+                       "AtomicBlackBox::AtomicBlackBox(\""
+                       <<name<<"\")"<<std::endl);
+    bbtkDebugDecTab("Kernel",7);
+  }
+  //========================================================================= 
+  
+  //=========================================================================
+  /// Constructor from an existing box (copy) with a new name 
+  AtomicBlackBox::AtomicBlackBox(AtomicBlackBox& from, 
+                            const std::string &name, 
+                            bool alloc)
+    : BlackBox(from,name)
+  {
+    bbtkDebugMessageInc("Kernel",7,
+                       "AtomicBlackBox::AtomicBlackBox("
+                       <<from.bbGetFullName()<<",\""
+                       <<name<<"\")"<<std::endl);
+    bbtkDebugDecTab("Kernel",7);
+    
+  }
+  //=========================================================================
+  
+  
+  //=========================================================================
+  ///  Destructor
+  AtomicBlackBox::~AtomicBlackBox()
+  {
+    bbtkDebugMessage("Kernel",7,"AtomicBlackBox::~AtomicBlackBox()"
+                    <<std::endl);
+  } 
+  //=========================================================================
+  
+  
+
+  //=========================================================================
+  /// Main processing method of the box.
+  IOStatus AtomicBlackBox::bbBackwardUpdate( Connection* caller )
+  {
+    bbtkDebugMessageInc("Process",1,
+                       "=> AtomicBlackBox::bbBackwardUpdate() ["
+                       <<bbGetFullName()<<"]"<<std::endl);
+    
+    bbtkDebugMessage("Process",5,"Initial Status  = "<<bbGetStatus()<<std::endl);
+    bbtkDebugMessage("Process",5,"BoxProcessMode  = "<<bbGetInputBoxProcessMode()<<std::endl);
+   
+    /* 
+    if ( bbGetStatus() == UPDATING ) 
+      {
+       bbtkMessage("Warning",1,"!! WARNING !! Cyclic pipeline execution (bbBackwardUpdate ["<<bbGetFullName()<<"] reentered). This may indicate an error in pipeline conception"<<std::endl);
+       //      return UPTODATE;
+       bbSetStatus(MODIFIED);
+      }
+    */
+
+    if ( ( bbGetStatus() == MODIFIED ) ||
+        ( bbBoxProcessModeIsAlways() ) )
+      {
+       bool wasExecuting = bbGlobalGetSomeBoxExecuting();
+       bbGlobalSetSomeBoxExecuting(true);
+
+       //      bbSetStatus(UPDATING);
+
+       // Updates its inputs
+       IOStatus s = bbUpdateInputs();
+       
+       bbtkDebugMessage("Process",6,"Inputs post-update status = "<<s<<std::endl);
+       // If all inputs are in UPTODATE post-update status 
+       // and mProcessMode is not "Always"
+       // then the box is now UPTODATE
+       if ( ( s == UPTODATE ) && 
+            ( ! bbBoxProcessModeIsAlways() ) ) 
+         {
+           bbSetStatus(UPTODATE);
+         }
+       else 
+         {
+           // else it remains MODIFIED
+           bbSetStatus(MODIFIED);
+         }     
+
+       // Creates the window (WxBlackbox)
+       //      bbCreateWindow();
+
+       // Children update (WxContainerBlackBox)
+       //      bbUpdateChildren(caller);       
+
+       // User process
+       bbProcess();
+
+       // Displays the window (WxBlackbox)
+       bbShowWindow(caller);
+
+
+
+       bbGlobalSetSomeBoxExecuting(wasExecuting);
+
+
+      }
+    else 
+      {
+       bbtkDebugMessage("Process",5,"Up-to-date : nothing to do"<<std::endl);
+      }
+
+    bbtkDebugMessage("Process",5,"Final Status    = "
+                    <<bbGetStatus()<<std::endl);
+    bbtkDebugMessage("Process",1,
+                    "<= AtomicBlackBox::bbBackwardUpdate() ["
+                    <<bbGetFullName()<<"]"<<std::endl);
+    bbtkDebugDecTab("Process",1);
+
+    return bbGetStatus();
+
+  }
+  //=========================================================================
+  
+    
+  //=========================================================================
+  Data AtomicBlackBox::bbGetOutput( const std::string &name )
+  {
+    bbtkDebugMessageInc("Data",7,
+                       "AtomicBlackBox::bbGetOutput(\""<<name<<"\") ["
+                       <<bbGetFullName()<<"]"
+                       <<std::endl);
+    
+    Data p = ((AtomicBlackBoxOutputDescriptor*)bbGetDescriptor()->GetOutputDescriptor(name))->GetGetFunctor()->Get(this);
+    
+    bbtkDebugDecTab("Data",7);
+    return p;
+  }
+  //=========================================================================
+  
+  
+  //=========================================================================
+  ///  Gets the input Data of a given name
+  Data AtomicBlackBox::bbGetInput( const std::string &name ) 
+  {
+    bbtkDebugMessageInc("Data",7,
+                       "AtomicBlackBox::bbGetInput(\""<<name<<"\") ["
+                       <<bbGetFullName()<<"]"
+                       <<std::endl);  
+    
+    Data p = ((AtomicBlackBoxInputDescriptor*)bbGetDescriptor()->GetInputDescriptor(name))->GetGetFunctor()->Get(this);
+    
+    bbtkDebugDecTab("Data",7);
+    return p;
+  }
+  //=========================================================================
+  
+  
+  //=========================================================================
+  ///  Sets the data of the output called <name>
+  void AtomicBlackBox::bbSetOutput( const std::string &name, Data data)
+  {
+    bbtkDebugMessageInc("Data",7,
+                       "AtomicBlackBox::bbSetOutput(\""<<name<<"\",data) ["
+                       <<bbGetFullName()<<"]"
+                       <<std::endl); 
+    
+    ((AtomicBlackBoxOutputDescriptor*)bbGetDescriptor()->GetOutputDescriptor(name))->GetSetFunctor()->Set(this,data);
+    
+    bbtkDebugDecTab("Data",7);
+  }  
+  //=========================================================================
+  
+  
+  //=========================================================================
+  ///  Sets the data of the input called <name>
+  void AtomicBlackBox::bbSetInput( const std::string &name, Data data, 
+                                bool setModified )
+  {
+    bbtkDebugMessageInc("Data",7,
+                       "AtomicBlackBox::bbSetInput(\""<<name<<"\",data) ["
+                       <<bbGetFullName()<<"]"
+                       <<std::endl);  
+    ((AtomicBlackBoxInputDescriptor*)bbGetDescriptor()->GetInputDescriptor(name))->GetSetFunctor()->Set(this,data);
+    
+    if (setModified) 
+      {
+       bbSetModifiedStatus();
+      }
+    
+    bbtkDebugDecTab("Data",7);
+  }
+  //=========================================================================
+  
+    //=========================================================================
+  ///  Sets the data of the input called <name>
+  void AtomicBlackBox::bbBruteForceSetInputPointer( const std::string &name, 
+                                                 void* data, 
+                                                 bool setModified )
+  {
+    bbtkDebugMessageInc("Data",7,
+                       "AtomicBlackBox::bbBruteForceSetInputPointer(\""
+                       <<name<<"\",data) ["
+                       <<bbGetFullName()<<"]"
+                       <<std::endl);  
+    ((AtomicBlackBoxInputDescriptor*)bbGetDescriptor()->GetInputDescriptor(name))->GetSetFunctor()->BruteForceSetPointer(this,data);
+    
+    if (setModified) 
+      {
+       bbSetModifiedStatus();
+      }
+    
+    bbtkDebugDecTab("Data",7);
+  }
+  //=========================================================================
+  
+}
+// EO namespace bbtk
diff --git a/kernel/src/bbtkAtomicBlackBox.h b/kernel/src/bbtkAtomicBlackBox.h
new file mode 100644 (file)
index 0000000..a0102bb
--- /dev/null
@@ -0,0 +1,143 @@
+/*=========================================================================
+                                                                                
+  Program:   bbtk
+  Module:    $RCSfile: bbtkAtomicBlackBox.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.
+                                                                                
+=========================================================================*/
+
+
+/**
+ *  \file 
+ *  \brief class bbtk::AtomicBlackBox : ancestor of all user defined (concrete) black boxes which are atomic (vs. complex boxes which are made up of other (atomic or complex) boxes).
+ */
+
+/**
+ *  \class bbtk::AtomicBlackBox
+ *  \brief Ancestor of all user defined (concrete) black boxes which are atomic (vs. complex boxes which are made up of other (atomic or complex) boxes).
+ */
+#ifndef __bbtkAtomicBlackBox_h__
+#define __bbtkAtomicBlackBox_h__
+
+#include "bbtkBlackBox.h"
+#include "bbtkAtomicBlackBoxDescriptor.h"
+
+namespace bbtk
+{
+
+  //==================================================================
+  class BBTK_EXPORT AtomicBlackBox : public bbtk::BlackBox
+  {
+    //==================================================================
+  public: 
+    //==================================================================
+    /// Gets the output Data of a given label
+    Data bbGetOutput( const std::string &label );
+    ///  Gets the input Data of a given label
+    Data bbGetInput( const std::string &label );
+    ///  Sets the data of the output called <name>
+    void bbSetOutput( const std::string &name, Data data);
+    ///  Sets the data of the input called <name>
+    void bbSetInput( const std::string &name, Data data, 
+                    bool setModified = true);
+    ///  Sets the data of the input called <name>
+    void bbBruteForceSetInputPointer( const std::string &name, 
+                                     void* data, 
+                                     bool setModified = true);
+    //==================================================================
+
+    //==================================================================
+    ///  Destructor
+    virtual ~AtomicBlackBox();
+    //==================================================================
+
+    //==================================================================
+  protected:
+    //==================================================================
+    ///  Constructor with the AtomicBlackBox's instance name
+    AtomicBlackBox(const std::string &name, bool alloc = true);
+    /// Constructor from an existing box (copy) with a new instance name 
+    AtomicBlackBox(AtomicBlackBox& from, const std::string &name, 
+                bool alloc = true);
+    //==================================================================
+
+  public:
+    //==================================================================   
+    /// Recursive pipeline processing in backward direction 
+    /// (recursion is in backward direction however execution always goes forward).
+    /// 
+    /// \returns The final status of the box (UPTODATE or MODIFIED)
+    ///
+    /// First checks that re-processing is needed (either Status==MODIFIED or InputProcessMode==Always)
+    /// then : 
+    /// - updates its inputs by calling bbUpdateInputs (which recursively calls bbBackwardUpdate on amont boxes)
+    /// - calls bbProcess which here simply calls the user callback bbUserProcess which does the actual processing. 
+    ///    bbProcess is overloaded in WxBlackBox to handle widget creation and show
+    IOStatus bbBackwardUpdate(Connection* caller);
+    //==================================================================
+
+    //==================================================================
+  protected:
+    //==================================================================
+    /// Calls the user defined processing method.
+    /// Overloaded in WxBlackBox to handle widget creation and show
+    virtual void bbProcess() { this->bbUserProcess(); }
+    //==================================================================
+
+    //==================================================================
+    /// User callback which computes the outputs as a function of the inputs. 
+    /// It is assumed to be deterministic and thus is only called is the inputs have changed 
+    /// (i.e. if the black box is marked as modified)
+    virtual void bbUserProcess() 
+    {
+      bbtkWarning("AtomicBlackBox::bbUserProcess() not overloaded for box '"
+                 <<bbGetFullName()
+                 <<"' : the box does nothing. Is it a bug or a feature ?"
+                 <<std::endl);
+    }
+    //==================================================================
+
+    //==================================================================
+    /// User callback called in the box contructor
+    virtual void bbUserConstructor() {}
+    /// User callback called in the box copy constructor
+    virtual void bbUserCopyConstructor() {}
+    /// User callback called in the box destructor
+    virtual void bbUserDestructor() {}
+    //==================================================================    
+
+     //==================================================================
+  private:
+    //================================================================== 
+    /// Default constructor is private : 
+    /// derived classes must use the constructor with the AtomicBlackBox's name
+    AtomicBlackBox() : BlackBox("") {}
+    //================================================================== 
+
+
+  };
+  // Class AtomicBlackBox
+  //===========================================================================
+
+
+
+}
+// namespace bbtk
+
+
+#include "bbtkAtomicBlackBoxMacros.h"
+
+#endif
+
diff --git a/kernel/src/bbtkAtomicBlackBoxDescriptor.h b/kernel/src/bbtkAtomicBlackBoxDescriptor.h
new file mode 100644 (file)
index 0000000..d732b90
--- /dev/null
@@ -0,0 +1,78 @@
+/*=========================================================================
+                                                                                
+  Program:   bbtk
+  Module:    $RCSfile: bbtkAtomicBlackBoxDescriptor.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.
+                                                                                
+=========================================================================*/
+
+/**
+ *  \file 
+ *  \brief Class bbtk::AtomicBlackBoxDescriptor : structure containing the description of a AtomicBlackBox input (name, description, type, functor)
+ */
+/**
+ * \class bbtk::AtomicBlackBoxDescriptor
+ * \brief Structure containing the description of a AtomicBlackBox input (name, description, type, functor)
+ */
+#ifndef __bbtkAtomicBlackBoxDescriptor_h__
+#define __bbtkAtomicBlackBoxDescriptor_h__
+
+#include "bbtkBlackBoxDescriptor.h"
+#include "bbtkAtomicBlackBoxInputDescriptor.h"
+#include "bbtkAtomicBlackBoxOutputDescriptor.h"
+
+namespace bbtk
+{
+
+
+  class BBTK_EXPORT AtomicBlackBoxDescriptor : public bbtk::BlackBoxDescriptor
+  {
+  public:
+    AtomicBlackBoxDescriptor() 
+    {  
+      // Creates the input 'BoxProcessMode'
+      AddInputDescriptor
+       (new 
+        bbtk::AtomicBlackBoxInputDescriptor
+        (typeid(AtomicBlackBoxDescriptor),
+         "BoxProcessMode",
+         "Sets the processing mode of the box (Pipeline | Always | Reactive)", 
+         new bbtk::AtomicBlackBoxTGetFunctor<BlackBox,std::string,std::string>(&BlackBox::bbGetInputBoxProcessMode), 
+         new bbtk::AtomicBlackBoxTSetFunctor<BlackBox,std::string,std::string>(&BlackBox::bbSetInputBoxProcessMode) ) );
+      // Creates the input 'BoxExecute'
+      AddInputDescriptor
+       (new
+        bbtk::AtomicBlackBoxInputDescriptor
+        (typeid(AtomicBlackBoxDescriptor),
+         "BoxExecute",
+         "Any signal received by this input executes the box", 
+         new bbtk::AtomicBlackBoxTGetFunctor<BlackBox,Void,Void>(&BlackBox::bbGetInputBoxExecute), 
+         new bbtk::AtomicBlackBoxTSetFunctor<BlackBox,Void,Void>(&BlackBox::bbSetInputBoxExecute) ) );
+      // Creates the output 'BoxChange'      
+      AddOutputDescriptor
+       (new 
+        bbtk::AtomicBlackBoxOutputDescriptor
+        (typeid(AtomicBlackBoxDescriptor),
+         "BoxChange",
+         "Signal modifications of the box", 
+         new bbtk::AtomicBlackBoxTGetFunctor<BlackBox,Void,Void>(&BlackBox::bbGetOutputBoxChange), 
+         new bbtk::AtomicBlackBoxTSetFunctor<BlackBox,Void,Void>(&BlackBox::bbSetOutputBoxChange) ) );
+      //
+      AddToCategory("atomic box");
+    }
+  };
+    
+}
+// namespace bbtk
+#endif
diff --git a/kernel/src/bbtkAtomicBlackBoxGetSetFunctor.h b/kernel/src/bbtkAtomicBlackBoxGetSetFunctor.h
new file mode 100644 (file)
index 0000000..e67b76f
--- /dev/null
@@ -0,0 +1,268 @@
+/*=========================================================================
+                                                                                
+  Program:   bbtk
+  Module:    $RCSfile: bbtkAtomicBlackBoxGetSetFunctor.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.
+                                                                                
+=========================================================================*/
+
+
+/**
+ *  \file 
+ *  \brief Class bbtk::AtomicBlackBoxGetFunctor / Class bbtk::AtomicBlackBoxSetFunctor : abstract functors of the Get and Set accessors of the inputs and outputs of a AtomicBlackBox ; Concrete derivatives.
+ */
+
+/**
+ *  \class bbtk::AtomicBlackBoxGetFunctor
+ *  \brief Abstract functor of the Get accessors of the inputs and outputs of a AtomicBlackBox
+ *  \class bbtk::AtomicBlackBoxSetFunctor
+ *  \brief Abstract functor of the Set accessors of the inputs and outputs of a AtomicBlackBox
+ * \class bbtk::AtomicBlackBoxTGetFunctor
+ * \brief Template for concrete functors of the Get accessors of the inputs and outputs of a AtomicBlackBox (inherits from bbtk::AtomicBlackBoxGetFunctor).
+ * \class bbtk::AtomicBlackBoxTSetFunctor
+ * \brief Template for concrete functors of the Set accessors of the inputs and outputs of a AtomicBlackBox (inherits from bbtk::AtomicBlackBoxSetFunctor).
+ */
+#ifndef __bbtkAtomicBlackBoxGetSetFunctor_h__
+#define __bbtkAtomicBlackBoxGetSetFunctor_h__
+
+#include "bbtkData.h"
+#include "bbtkMessageManager.h"
+
+namespace bbtk
+{
+
+   // Forward declaration
+  class AtomicBlackBox;
+
+
+  //===========================================================================
+  class BBTK_EXPORT AtomicBlackBoxGetFunctor
+  {
+  public:
+    /// Default constructor
+    AtomicBlackBoxGetFunctor() {}
+    /// Abstract method which applies the "Get" function of AtomicBlackBox o
+    virtual Data Get(AtomicBlackBox* o) = 0;
+    /// 
+    virtual TypeInfo GetTypeInfo() const = 0;
+    /// 
+    virtual std::string GetTypeName() const = 0;
+    /// 
+    virtual std::string GetHumanTypeName() const = 0;
+    /// 
+    virtual bool IsPointerType() const = 0;
+
+  };
+  //===========================================================================
+
+
+  //===========================================================================
+  class AtomicBlackBoxSetFunctor
+  {
+  public:
+    /// Default constructor
+    AtomicBlackBoxSetFunctor() {}
+    /// Abstract method which applies the "Set" function of AtomicBlackBox o
+    virtual void Set(AtomicBlackBox* o, const Data&) = 0;
+    /// 
+    virtual TypeInfo GetTypeInfo() const = 0;
+    /// 
+    virtual std::string GetTypeName() const = 0;
+    /// 
+    virtual std::string GetHumanTypeName() const = 0;
+    /// 
+    virtual bool IsPointerType() const = 0;
+    /// Abstract method which applies the "Set" function of AtomicBlackBox o
+    /// using brute force cast to the typed pointer required by the "Set" fun.
+    /// Only works if the param type of the "Set" function is a pointer 
+    /// (see template specialization below).
+    /// !!! Use with care !!!
+    virtual void BruteForceSetPointer(AtomicBlackBox* o, void* p) = 0;
+
+  };
+  //===========================================================================
+
+
+
+  //===========================================================================
+  template <class UBB, class T, class TRETURN> 
+  class AtomicBlackBoxTGetFunctor : public bbtk::AtomicBlackBoxGetFunctor
+  {
+  public:
+    /// Type of pointer on a UBB::Get method  
+    typedef TRETURN (UBB::*GetMethodPointerType)(void); //const
+
+    /// Construction with the pointer on the Get method
+    AtomicBlackBoxTGetFunctor(GetMethodPointerType g) :
+      mGetMethodPointer(g)
+      {
+       bbtkDebugMessage("Data",9,"AtomicBlackBoxTGetFunctor<"<<
+                        TypeName<UBB>()<<","<<
+                        TypeName<T>()<<","<<
+                        TypeName<TRETURN>()<<
+                        ">::AtomicBlackBoxTGetFunctor()"<<std::endl);
+      }
+      
+    /// Concrete application of the Get method of object o
+    Data Get(AtomicBlackBox* o) 
+    {
+      bbtkDebugMessage("Data",9,"AtomicBlackBoxTGetFunctor<"<<
+                      TypeName<UBB>()<<","<<
+                      TypeName<T>()<<","<<
+                      TypeName<TRETURN>()<<
+                      ">::Get()"<<std::endl);
+      return (((UBB*)o)->*mGetMethodPointer)();
+    }
+    /// 
+    TypeInfo GetTypeInfo() const { return typeid(T); }
+    std::string GetTypeName() const { return TypeName<T>(); }
+    std::string GetHumanTypeName() const { return HumanTypeName<T>(); }
+    /// 
+    virtual bool IsPointerType() const 
+    {
+#ifdef _USE_BOOST_
+       return boost::is_pointer<T>::value;
+#else
+       return false;
+#endif
+    }
+
+  private:
+    ///  Pointer on the Get method  
+    GetMethodPointerType mGetMethodPointer;
+  };
+  //===========================================================================
+
+
+
+  //===========================================================================
+  template <class UBB, class T, class TACCESS> 
+  class AtomicBlackBoxTSetFunctor : public AtomicBlackBoxSetFunctor
+  {
+  public:
+    /// Type of pointer on a UBB::Set method  
+    typedef void (UBB::*SetMethodPointerType)(TACCESS);
+
+    /// Construction with the pointer on the Set method
+    AtomicBlackBoxTSetFunctor(SetMethodPointerType s) :
+      mSetMethodPointer(s) 
+      {
+       bbtkDebugMessage("Data",9,"AtomicBlackBoxTSetFunctor<"<<
+                       TypeName<UBB>()<<","<<
+                       TypeName<T>()<<","<<
+                       TypeName<TACCESS>()<<
+                        ">::AtomicBlackBoxTSetFunctor()"<<std::endl);
+      }
+      
+    /// Concrete application of the Set method of object o
+    void Set(AtomicBlackBox* o, const Data& d)
+    { 
+      bbtkDebugMessage("Data",9,"AtomicBlackBoxTSetfunctor<"<<
+                       TypeName<UBB>()<<","<<
+                       TypeName<T>()<<","<<
+                       TypeName<TACCESS>()<<
+                      ">::Set()"<<std::endl);
+      //      (((UBB*)o)->*mSetMethodPointer)(*(T*)d);
+      //      bbtkAssert( bbtkEqualTypes( d.type(), typeid(T) ) );
+      T t = d.unsafe_get<T>();
+      (((UBB*)o)->*mSetMethodPointer)(t);
+      //      bbtkDebugMessage("Kernel",9,"SetOK"<<std::endl);
+    }
+
+    /// 
+    TypeInfo GetTypeInfo() const { return typeid(T); }
+    std::string GetTypeName() const { return TypeName<T>(); }
+    std::string GetHumanTypeName() const { return HumanTypeName<T>(); }
+    virtual bool IsPointerType() const { return false; }
+    virtual void BruteForceSetPointer(AtomicBlackBox* b, void* p) 
+    {
+      bbtkInternalError("AtomicBlackBoxTSetFunctor<"
+                       <<TypeName<UBB>()<<","
+                       <<TypeName<T>()<<","
+                       <<TypeName<TACCESS>()
+                       <<">::BruteForceSetPointer("
+                       <<b<<","<<p<<")"
+                       <<" called whereas type '"
+                       <<TypeName<T>()
+                       <<"' is not a pointer type"); 
+    }
+  private:
+    ///  Pointer on the Set method  
+    SetMethodPointerType mSetMethodPointer;
+  };
+  //===========================================================================
+
+
+
+  //===========================================================================
+  /// Template specialization of AtomicBlackBoxTSetFunctor for pointer types
+  template <class UBB, class T, class TACCESS> 
+  class AtomicBlackBoxTSetFunctor<UBB,T*,TACCESS*> 
+    : public AtomicBlackBoxSetFunctor
+  {
+  public:
+    /// Type of pointer on a UBB::Set method  
+    typedef void (UBB::*SetMethodPointerType)(TACCESS*);
+
+    /// Construction with the pointer on the Set method
+    AtomicBlackBoxTSetFunctor(SetMethodPointerType s) :
+      mSetMethodPointer(s) 
+    {
+      bbtkDebugMessage("Data",9,"AtomicBlackBoxTSetFunctor<"<<
+                      TypeName<UBB>()<<","<<
+                      TypeName<T*>()<<","<<
+                      TypeName<TACCESS*>()<<
+                      ">::AtomicBlackBoxTSetFunctor()"<<std::endl);
+    }
+    
+    /// Concrete application of the Set method of object o
+    void Set(AtomicBlackBox* o, const Data& d)
+    { 
+      bbtkDebugMessage("Data",9,"AtomicBlackBoxTSetfunctor<"<<
+                      TypeName<UBB>()<<","<<
+                      TypeName<T*>()<<","<<
+                      TypeName<TACCESS*>()<<
+                      ">::Set()"<<std::endl);
+      
+      (((UBB*)o)->*mSetMethodPointer)(d.unsafe_get<T*>());
+
+    }
+
+    /// 
+    TypeInfo GetTypeInfo() const { return typeid(T*); }
+    std::string GetTypeName() const { return TypeName<T*>(); }
+    std::string GetHumanTypeName() const { return HumanTypeName<T*>(); }
+    virtual bool IsPointerType() const { return true; }
+
+    virtual void BruteForceSetPointer(AtomicBlackBox* o, void* p) 
+    {  
+      bbtkDebugMessage("Data",9,"AtomicBlackBoxTSetFunctor<"
+                      <<TypeName<UBB>()<<","
+                      <<TypeName<T*>()<<","
+                      <<TypeName<TACCESS*>()
+                      <<">::BruteForceSetPointer() (pointer specialization)");
+
+      (((UBB*)o)->*mSetMethodPointer)((T*)p);
+
+    }
+  private:
+    ///  Pointer on the Set method  
+    SetMethodPointerType mSetMethodPointer;
+  };
+  //===========================================================================
+
+}
+// namespace bbtk
+#endif
diff --git a/kernel/src/bbtkAtomicBlackBoxInputDescriptor.cxx b/kernel/src/bbtkAtomicBlackBoxInputDescriptor.cxx
new file mode 100644 (file)
index 0000000..b0c6e8c
--- /dev/null
@@ -0,0 +1,60 @@
+/*=========================================================================
+                                                                                
+  Program:   bbtk
+  Module:    $RCSfile: bbtkAtomicBlackBoxInputDescriptor.cxx,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.
+                                                                                
+=========================================================================*/
+
+/**
+ *  \file 
+ *  \brief Class bbtk::AtomicBlackBoxInputDescriptor : structure containing the description of a AtomicBlackBox input (name, description, type, functor)
+ */
+#include "bbtkAtomicBlackBoxInputDescriptor.h"
+
+
+namespace bbtk
+{
+  
+  AtomicBlackBoxInputDescriptor::
+  AtomicBlackBoxInputDescriptor( TypeInfo creator_type_info,
+                              const std::string& name,
+                              const std::string& description,
+                              AtomicBlackBoxGetFunctor* getfunctor,
+                              AtomicBlackBoxSetFunctor* setfunctor,
+                              bool copy_construct) 
+    : 
+    BlackBoxInputDescriptor(creator_type_info,
+                           name,description,MANDATORY,copy_construct),
+    mGetFunctor(getfunctor),
+    mSetFunctor(setfunctor)
+  {  
+    bbtkDebugMessage("Kernel",9,
+                    "AtomicBlackBoxInputDescriptor::"
+                    <<"AtomicBlackBoxInputDescriptor(\""
+                    <<name<<"\",\""<<description<<"\","
+                    <<getfunctor<<","<<setfunctor<<","
+                    <<copy_construct<<")"<<std::endl);
+  }
+
+
+
+  AtomicBlackBoxInputDescriptor::~AtomicBlackBoxInputDescriptor()
+  {
+    bbtkDebugMessage("Kernel",9,
+                    "AtomicBlackBoxInputDescriptor::"
+                    <<"~AtomicBlackBoxInputDescriptor(\""
+                    <<GetName()<<"\",\""<<GetDescription()<<"\","
+                    <<mGetFunctor<<","<<mSetFunctor<<")"<<std::endl);
+  } 
+}
diff --git a/kernel/src/bbtkAtomicBlackBoxInputDescriptor.h b/kernel/src/bbtkAtomicBlackBoxInputDescriptor.h
new file mode 100644 (file)
index 0000000..a44c420
--- /dev/null
@@ -0,0 +1,83 @@
+/*=========================================================================
+                                                                                
+  Program:   bbtk
+  Module:    $RCSfile: bbtkAtomicBlackBoxInputDescriptor.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.
+                                                                                
+=========================================================================*/
+
+/**
+ *  \file 
+ *  \brief Class bbtk::AtomicBlackBoxInputDescriptor : structure containing the description of a AtomicBlackBox input (name, description, type, functor)
+ */
+/**
+ * \class bbtk::AtomicBlackBoxInputDescriptor
+ * \brief Structure containing the description of a AtomicBlackBox input (name, description, type, functor)
+ */
+#ifndef __bbtkAtomicBlackBoxInputDescriptor_h__
+#define __bbtkAtomicBlackBoxInputDescriptor_h__
+
+#include "bbtkBlackBoxInputDescriptor.h"
+#include "bbtkAtomicBlackBoxGetSetFunctor.h"
+#include <typeinfo>
+
+namespace bbtk
+{
+
+
+  class BBTK_EXPORT AtomicBlackBoxInputDescriptor : 
+    public bbtk::BlackBoxInputDescriptor
+  {
+  public:
+    //typedef enum {
+    //  MANDATORY,
+    //  OPTIONAL
+    //} InputType;
+
+      
+    AtomicBlackBoxInputDescriptor( TypeInfo creator_type_info,
+                                const std::string& name,
+                                const std::string& description,
+                                AtomicBlackBoxGetFunctor* getfunctor,
+                                AtomicBlackBoxSetFunctor* setfunctor,
+                                bool copy_construct = true);
+
+    ~AtomicBlackBoxInputDescriptor();  
+    /// Returns the type of the input
+    TypeInfo GetTypeInfo() const { return mGetFunctor->GetTypeInfo(); }
+    /// Returns the name of the type of the input
+    std::string GetTypeName() const { return mGetFunctor->GetTypeName(); }
+    /// Returns the name of the type of the input
+    std::string GetHumanTypeName() const { return mGetFunctor->GetHumanTypeName(); }    
+    /// Returns true iff the type is a pointer to class 
+    virtual bool IsPointerType() const { return mGetFunctor->IsPointerType(); }    
+    /// Returns the functor on the Get method
+    AtomicBlackBoxGetFunctor* GetGetFunctor() { return mGetFunctor; }
+    /// Returns the functor on the Set method
+    AtomicBlackBoxSetFunctor* GetSetFunctor() { return mSetFunctor; }
+    
+    
+  private:
+    /// Default ctor is private 
+    AtomicBlackBoxInputDescriptor() : 
+      BlackBoxInputDescriptor(typeid(void),"","") {}
+    /// The functor on the Get method
+    AtomicBlackBoxGetFunctor* mGetFunctor;
+    /// The functor on the Set method
+    AtomicBlackBoxSetFunctor* mSetFunctor;
+  };
+  
+}
+// namespace bbtk
+#endif
diff --git a/kernel/src/bbtkAtomicBlackBoxMacros.h b/kernel/src/bbtkAtomicBlackBoxMacros.h
new file mode 100644 (file)
index 0000000..cd4028e
--- /dev/null
@@ -0,0 +1,683 @@
+/*=========================================================================
+                                                                                
+  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.
+                                                                                
+=========================================================================*/
+
+
+/**
+ *  \file 
+ *  \brief Defines macros for the creation of new user black boxes
+ */
+#ifndef __bbtkAtomicBlackBoxMacros_h__
+#define __bbtkAtomicBlackBoxMacros_h__
+
+//============================================================================
+/// Declares the standard interface of a AtomicBlackBox 
+/// (ctor, New, descriptor related methods)
+#define BBTK_USER_BLACK_BOX_INTERFACE(CLASS,PARENT)                    \
+  private:                                                             \
+  inline static void bbCreateDescriptorIfNeeded();                     \
+  protected:                                                           \
+  CLASS(const std::string& name, bool allocate_connectors = true);     \
+  CLASS(CLASS& from, const std::string& name,                          \
+       bool allocate_connectors = true);                               \
+  ~CLASS();                                                            \
+  public: \
+  inline static CLASS* bbNew(const std::string& name)                  \
+  {                                                                    \
+    bbtkDebugMessageInc("Kernel",9,#CLASS<<"::bbNew(\""<<name<<"\")"<<std::endl); \
+    bbCreateDescriptorIfNeeded();                                      \
+    CLASS* c = new CLASS(name);                                                \
+    bbtkDebugDecTab("Kernel",9);                                               \
+    return c;                                                          \
+  }                                                                    \
+  inline bbtk::BlackBox* bbClone(const std::string& name)              \
+  {                                                                    \
+    bbtkDebugMessageInc("Kernel",9,#CLASS<<"::bbClone(\""<<name<<"\")"<<std::endl); \
+    bbCreateDescriptorIfNeeded();                                      \
+    CLASS* c = new CLASS(*this,name);                                  \
+    bbtkDebugDecTab("Kernel",9);                                               \
+    return c;                                                          \
+  }                                                                    \
+  bbtk::BlackBoxDescriptor* bbGetDescriptor() const                    \
+  {                                                                    \
+    return (bbtk::BlackBoxDescriptor*)bbDescriptor();                  \
+  }                                                                    \
+  static bbtk::BlackBoxDescriptor* bbDescriptor()                      \
+  {                                                                    \
+    bbCreateDescriptorIfNeeded();                                      \
+    return bbDescriptorPointer();                                      \
+  }                                                                    \
+  private:                                                             \
+  CLASS() : PARENT("") {}                                              \
+  static bbtk::BlackBoxDescriptor*& bbDescriptorPointer()              \
+  {                                                                    \
+    static bbtk::BlackBoxDescriptor* d = 0;                            \
+    return d;                                                          \
+  }                                                                    
+//============================================================================
+
+
+//============================================================================
+/// Defines the bbUserProcess method
+#define BBTK_PROCESS(CALLBACK)                                         \
+  public:                                                              \
+  inline void bbUserProcess()                                          \
+  {                                                                    \
+    bbtkDebugMessageInc("Process",1,"=> "<<bbGetTypeName()<<"::bbUserProcess() [" \
+                       <<bbGetFullName()<<"]"<<std::endl);             \
+    CALLBACK();                                                                \
+    bbtkDebugMessageDec("Process",1,"<= "<<bbGetTypeName()<<"::bbUserProcess() [" \
+                       <<bbGetFullName()<<"]"<<std::endl);             \
+  }
+//============================================================================
+
+
+//============================================================================
+/// Declares a new AtomicBlackBox input (to be put in the class interface)
+#define BBTK_DECLARE_INPUT(NAME,TYPE)                                  \
+  protected:                                                           \
+  TYPE bbmInput##NAME;                                                 \
+  public:                                                              \
+  TYPE bbGetInput##NAME ()                                             \
+  { return bbmInput##NAME; }                                           \
+  void bbSetInput##NAME (TYPE d)                                       \
+  { bbmInput##NAME = d;                                                        \
+    /*bbSetModifiedStatus();*/ }                               
+//============================================================================
+
+//============================================================================
+/// Declares a new AtomicBlackBox output (to be put in the class interface)
+#define BBTK_DECLARE_OUTPUT(NAME,TYPE)                                 \
+  protected:                                                           \
+  TYPE bbmOutput##NAME;                                                        \
+  public:                                                              \
+  TYPE bbGetOutput##NAME ()                                            \
+  { return bbmOutput##NAME; }                                          \
+  void  bbSetOutput##NAME (TYPE d)                                     \
+  { bbmOutput##NAME = d; }                                     
+//============================================================================
+
+//============================================================================
+/// Declares an inherited AtomicBlackBox input (to be put in the class interface)
+#define BBTK_DECLARE_INHERITED_INPUT(NAME,TYPE,GETMETHOD,SETMETHOD)    \
+  public:                                                              \
+  TYPE bbGetInput##NAME ()                                             \
+  { return GETMETHOD(); }                                              \
+  void bbSetInput##NAME (TYPE d)                                       \
+  { SETMETHOD(d);                                                      \
+    /*bbSetModifiedStatus();*/ }                       
+//============================================================================
+
+
+//============================================================================
+/// Declares an inherited AtomicBlackBox output (to be put in the class interface)
+#define BBTK_DECLARE_INHERITED_OUTPUT(NAME,TYPE,GETMETHOD,SETMETHOD)   \
+  public:                                                              \
+  TYPE bbGetOutput##NAME () const                                      \
+  { return GETMETHOD(); }                                              \
+  void bbSetOutput##NAME (TYPE d)                                      \
+  { SETMETHOD(d); }                                                    
+//============================================================================
+
+
+
+//============================================================================
+#define BBTK_BEGIN_BLACK_BOX_CONSTRUCTOR(CLASS,ALLOC)                  \
+  bbtkDebugMessageInc("Kernel",7,#CLASS<<"::"<<#CLASS                  \
+                     <<"(\""<<bbGetName()<<"\")"<<std::endl);          \
+  if (ALLOC) bbAllocateConnectors();                                   
+//============================================================================
+
+//============================================================================
+#define BBTK_BEGIN_BLACK_BOX_COPY_CONSTRUCTOR(CLASS,FROM,ALLOC)                \
+  bbtkDebugMessageInc("Kernel",7,#CLASS<<"::"<<#CLASS                  \
+                     <<"("<<FROM.bbGetFullName()<<",\""                \
+                     <<bbGetName()<<"\")"<<std::endl);                 \
+  if (ALLOC)                                                           \
+    {                                                                  \
+      bbAllocateConnectors();                                          \
+      bbCopyIOValues(FROM);                                            \
+   }
+//============================================================================
+
+
+//============================================================================
+#define BBTK_END_BLACK_BOX_CONSTRUCTOR         \
+  bbtkDebugDecTab("Kernel",7)
+//============================================================================
+
+//============================================================================
+#define BBTK_BEGIN_BLACK_BOX_DESTRUCTOR(CLASS)                         \
+  bbtkDebugMessageInc("Kernel",7,#CLASS <<"::~"<< #CLASS                       \
+                     <<"() ["<<this->bbGetFullName()<<"]"<<std::endl);
+//============================================================================
+
+
+
+
+//============================================================================
+#define BBTK_END_BLACK_BOX_DESTRUCTOR          \
+  bbtkDebugDecTab("Kernel",7)
+//============================================================================
+
+
+//============================================================================
+/// AtomicBlackBox std implementation of ctor and dtor
+#define BBTK_USER_BLACK_BOX_IMPLEMENTATION(CLASS,PARENT)               \
+  CLASS::CLASS(const std::string& name, bool allocate_connectors)      \
+    : PARENT(name,false)                                               \
+  {                                                                    \
+    BBTK_BEGIN_BLACK_BOX_CONSTRUCTOR(CLASS,allocate_connectors);       \
+    CLASS::bbUserConstructor();                                                \
+    BBTK_END_BLACK_BOX_CONSTRUCTOR;                                    \
+  }                                                                    \
+  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::~CLASS()                                                      \
+  {                                                                    \
+    BBTK_BEGIN_BLACK_BOX_DESTRUCTOR(CLASS);                            \
+    CLASS::bbUserDestructor();                                         \
+    BBTK_END_BLACK_BOX_DESTRUCTOR;                                     \
+  }                                                                    
+//============================================================================
+
+
+//============================================================================
+/// Begins the AtomicBlackBox description block
+#define BBTK_BEGIN_DESCRIBE_BLACK_BOX(CLASS,PARENT)                    \
+  class /*BBTK_EXPORT*/ CLASS ## Descriptor : public PARENT ## Descriptor \
+  {                                                                    \
+  public:                                                              \
+    bbtk::BlackBox::Pointer CreateInstance(const std::string& name)    \
+    {                                                                  \
+      return CLASS::bbNew(name);                                       \
+    }                                                                  \
+    CLASS ## Descriptor()                                              \
+      {                                                                        \
+       bbtkDebugMessageInc("Kernel",9,#CLASS<<"Descriptor::"<<#CLASS   \
+                           <<"Descriptor()"<<std::endl)
+//============================================================================
+
+//============================================================================
+/// Ends the AtomicBlackBox description block
+#define BBTK_END_DESCRIBE_BLACK_BOX(CLASS)                             \
+  bbtkDecTab("Kernel",9);                                                      \
+  }                                                                    \
+  };                                                                   \
+  void CLASS::bbCreateDescriptorIfNeeded()                             \
+  {                                                                    \
+    if ( !bbDescriptorPointer() )                                      \
+      bbDescriptorPointer() = new CLASS ## Descriptor;                 \
+  }
+//============================================================================
+
+
+//============================================================================
+/// Declares the name of a AtomicBlackBox (to be put inside the UBB description block)
+#define BBTK_NAME(NAME) SetTypeName(NAME)
+//============================================================================
+
+//============================================================================
+/// Declares the author of a AtomicBlackBox (to be put inside the UBB description block)
+#define BBTK_AUTHOR(AUTHOR) AddToAuthor(AUTHOR)
+//============================================================================
+
+//============================================================================
+/// Declares the categories of a AtomicBlackBox (to be put inside the UBB description block)
+#define BBTK_CATEGORY(CATEGORY) AddToCategory(CATEGORY)
+//============================================================================
+
+//============================================================================
+/// Declares the description of a AtomicBlackBox (to be put inside the UBB description block)
+#define BBTK_DESCRIPTION(DESCR) AddToDescription(DESCR)
+//============================================================================
+
+//============================================================================
+/// Declares the kind of a AtomicBlackBox (to be put inside the UBB description block)
+//#define BBTK_KIND(KIND) SetKind(KIND)
+//============================================================================
+
+//============================================================================
+/// Declares that the AtomicBlackBox is an adaptor (to be put inside the UBB description block)
+#define BBTK_ADAPTOR() SetKInd(bbtk::BlackBoxDescriptor::ADAPTOR)
+//============================================================================
+
+//============================================================================
+/// Declares that the AtomicBlackBox is the default adaptor of the package (to be put inside the UBB description block)
+#define BBTK_DEFAULT_ADAPTOR() SetKind(bbtk::BlackBoxDescriptor::DEFAULT_ADAPTOR)
+//============================================================================
+
+//============================================================================
+/// Describes a AtomicBlackBox input (to be put inside the UBB description block)
+#define BBTK_INPUT(CLASS,NAME,DESCR,TYPE)                              \
+  AddInputDescriptor(new bbtk::AtomicBlackBoxInputDescriptor           \
+                    (typeid(CLASS ## Descriptor),                      \
+                     #NAME,DESCR,                                      \
+                     new bbtk::AtomicBlackBoxTGetFunctor<CLASS,TYPE,TYPE > \
+                     (&CLASS::bbGetInput##NAME),                       \
+                     new bbtk::AtomicBlackBoxTSetFunctor<CLASS,TYPE,TYPE > \
+                     (&CLASS::bbSetInput##NAME) ) )
+//============================================================================
+
+//============================================================================
+/// Describes a AtomicBlackBox output (to be put inside the UBB description block)
+#define BBTK_OUTPUT(CLASS,NAME,DESCR,TYPE)                             \
+  AddOutputDescriptor(new bbtk::AtomicBlackBoxOutputDescriptor         \
+                     (typeid(CLASS ## Descriptor),#NAME,DESCR,                         \
+                      new bbtk::AtomicBlackBoxTGetFunctor<CLASS,TYPE,TYPE > \
+                      (&CLASS::bbGetOutput##NAME),                     \
+                      new bbtk::AtomicBlackBoxTSetFunctor<CLASS,TYPE,TYPE > \
+                      (&CLASS::bbSetOutput##NAME) ) )
+//============================================================================
+
+//============================================================================
+/// Describes a AtomicBlackBox input (to be put inside the UBB description block)
+#define BBTK_INPUT_NOCOPY(CLASS,NAME,DESCR,TYPE)                       \
+  AddInputDescriptor(new bbtk::AtomicBlackBoxInputDescriptor           \
+                    (typeid(CLASS ## Descriptor),#NAME,DESCR,                                  \
+                     new bbtk::AtomicBlackBoxTGetFunctor<CLASS,TYPE,TYPE > \
+                     (&CLASS::bbGetInput##NAME),                       \
+                     new bbtk::AtomicBlackBoxTSetFunctor<CLASS,TYPE,TYPE > \
+                     (&CLASS::bbSetInput##NAME),                       \
+                     false) )
+//============================================================================
+
+//============================================================================
+/// Describes a AtomicBlackBox output (to be put inside the UBB description block)
+#define BBTK_OUTPUT_NOCOPY(CLASS,NAME,DESCR,TYPE)                      \
+  AddOutputDescriptor(new bbtk::AtomicBlackBoxOutputDescriptor         \
+                     (typeid(CLASS ## Descriptor),#NAME,DESCR,                         \
+                      new bbtk::AtomicBlackBoxTGetFunctor<CLASS,TYPE,TYPE > \
+                      (&CLASS::bbGetOutput##NAME),                     \
+                      new bbtk::AtomicBlackBoxTSetFunctor<CLASS,TYPE,TYPE > \
+                      (&CLASS::bbSetOutput##NAME),\
+                      false) )
+//============================================================================
+
+
+
+
+
+
+
+
+
+
+//============================================================================
+//============================================================================
+// Template user black boxes macros
+//============================================================================
+//============================================================================
+
+//============================================================================
+/// Begins a template AtomicBlackBox of template param T description block
+#define BBTK_BEGIN_DESCRIBE_TEMPLATE_BLACK_BOX(CLASS)  \
+  template <class T>                                   \
+  class /*BBTK_EXPORT*/ CLASS ## Descriptor : public bbtk::BlackBoxDescriptor \
+  {                                                                    \
+  public:                                                              \
+    bbtk::BlackBox::Pointer CreateInstance(const std::string& name)    \
+    {                                                                  \
+      return CLASS<T>::bbNew(name);                                    \
+    }                                                                  \
+    CLASS ## Descriptor()                                              \
+      {                                                                        \
+       bbtkDebugMessageInc("Kernel",9,#CLASS<<"Descriptor::"<<#CLASS   \
+                           <<"Descriptor()"<<std::endl)
+//============================================================================
+
+//============================================================================
+/// Ends a template AtomicBlackBox of template param T description block
+#define BBTK_END_DESCRIBE_TEMPLATE_BLACK_BOX(CLASS)    \
+  bbtkDecTab("Kernel",9);                                                      \
+  }                                                                    \
+  };                                                                   \
+  template <class T>                                   \
+  void CLASS<T>::bbCreateDescriptorIfNeeded()          \
+  {                                                                    \
+    if ( !bbDescriptorPointer() )                                      \
+      bbDescriptorPointer() = new CLASS ## Descriptor<T>;      \
+  }
+//============================================================================
+
+//============================================================================
+/// 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,                                  \
+                     new bbtk::AtomicBlackBoxTGetFunctor<CLASS<T>,TYPE,TYPE > \
+                     (&CLASS<T>::bbGetInput##NAME),                    \
+                     new bbtk::AtomicBlackBoxTSetFunctor<CLASS<T>,TYPE,TYPE > \
+                     (&CLASS<T>::bbSetInput##NAME) ) )
+//============================================================================
+
+//============================================================================
+/// 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,                         \
+                      new bbtk::AtomicBlackBoxTGetFunctor<CLASS<T>,TYPE,TYPE > \
+                      (&CLASS<T>::bbGetOutput##NAME),                  \
+                      new bbtk::AtomicBlackBoxTSetFunctor<CLASS<T>,TYPE,TYPE > \
+                      (&CLASS<T>::bbSetOutput##NAME) ) )
+//============================================================================
+
+//============================================================================
+/// Template AtomicBlackBox std implementation of ctor and dtor
+#define BBTK_USER_BLACK_BOX_TEMPLATE_IMPLEMENTATION(CLASS,PARENT)      \
+  template <class T>                                                   \
+  CLASS<T>::CLASS(const std::string& name, bool alloc)                 \
+    : PARENT(name,false)                                               \
+  {                                                                    \
+    BBTK_BEGIN_BLACK_BOX_CONSTRUCTOR(CLASS<T>,alloc);                  \
+    CLASS<T>::bbUserConstructor();                             \
+    BBTK_END_BLACK_BOX_CONSTRUCTOR;                                    \
+  }                            \
+  template <class T>                                                   \
+  CLASS<T>::CLASS(CLASS<T>& from,                                              \
+              const std::string& name, bool allocate_connectors)       \
+    : PARENT(from,name,false)                                          \
+  {                                                                    \
+    BBTK_BEGIN_BLACK_BOX_COPY_CONSTRUCTOR(CLASS<T>,from,allocate_connectors); \
+    CLASS<T>::bbUserCopyConstructor();                                 \
+    BBTK_END_BLACK_BOX_CONSTRUCTOR;                                    \
+  }            \
+  template <class T>                                                   \
+  CLASS<T>::~CLASS()                                                   \
+  {                                                                    \
+    BBTK_BEGIN_BLACK_BOX_DESTRUCTOR(CLASS<T>);                         \
+    CLASS<T>::bbUserDestructor();                                      \
+    BBTK_END_BLACK_BOX_DESTRUCTOR;                                     \
+  }                                                                    
+//============================================================================
+
+//============================================================================
+// Two template params user black boxes macros
+
+/// Begins a template AtomicBlackBox description block of template param T1 and T2 
+#define BBTK_BEGIN_DESCRIBE_TEMPLATE2_BLACK_BOX(CLASS)         \
+  template <class T1, class T2>                                                \
+  class /*BBTK_EXPORT*/ CLASS ## Descriptor : public bbtk::BlackBoxDescriptor \
+  {                                                                    \
+  public:                                                              \
+    bbtk::BlackBox::Pointer CreateInstance(const std::string& name)    \
+    {                                                                  \
+      return CLASS<T1,T2>::bbNew(name);                                        \
+    }                                                                  \
+    CLASS ## Descriptor()                                              \
+      {                                                                        \
+      bbtkDebugMessageInc("Kernel",9,#CLASS<<"Descriptor::"<<#CLASS    \
+                         <<"Descriptor()"<<std::endl)
+//============================================================================
+
+//============================================================================
+/// Ends a template AtomicBlackBox description block of template param T1 and T2
+#define BBTK_END_DESCRIBE_TEMPLATE2_BLACK_BOX(CLASS)           \
+  bbtkDecTab("Kernel",9);                                                      \
+  }                                                                    \
+  };                                                                   \
+  template <class T1, class T2>                                                \
+  void CLASS<T1,T2>::bbCreateDescriptorIfNeeded()                      \
+  {                                                                    \
+    if ( !bbDescriptorPointer() )                                      \
+      bbDescriptorPointer() = new CLASS ## Descriptor<T1,T2>;          \
+  }
+//============================================================================
+
+//============================================================================
+// 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 <TYPE1 T1, TYPE2 T2>                                                \
+  class /*BBTK_EXPORT*/ CLASS ## Descriptor : public bbtk::BlackBoxDescriptor \
+  {                                                                    \
+  public:                                                              \
+    bbtk::BlackBox::Pointer CreateInstance(const std::string& name)    \
+    {                                                                  \
+      return new CLASS<T1,T2>(name);                                   \
+    }                                                                  \
+    CLASS ## Descriptor()                                              \
+      {                                                                        \
+      bbtkDebugMessageInc("Kernel",9,#CLASS<<"Descriptor::"<<#CLASS    \
+                         <<"Descriptor()"<<std::endl)
+//============================================================================
+
+//============================================================================
+/// Ends a template AtomicBlackBox description block of template param T1 and T2
+#define BBTK_END_DESCRIBE_TEMPLATE2_WITH_TYPES_BLACK_BOX(CLASS,TYPE1,TYPE2)    \
+  bbtkDecTab("Kernel",9);                                                      \
+  }                                                                    \
+  };                                                                   \
+  template <TYPE1 T1, TYPE2 T2>                                                \
+  void CLASS<T1,T2>::bbCreateDescriptorIfNeeded()                      \
+  {                                                                    \
+    if ( !bbDescriptorPointer() )                                      \
+      bbDescriptorPointer() = new CLASS ## Descriptor<T1,T2>;          \
+  }
+//============================================================================
+
+
+
+//============================================================================
+/// 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,                                  \
+                     new bbtk::AtomicBlackBoxTGetFunctor<CLASS<T1,T2>,TYPE,TYPE >      \
+                     (&CLASS<T1,T2>::bbGetInput##NAME),                \
+                     new bbtk::AtomicBlackBoxTSetFunctor<CLASS<T1,T2>,TYPE,TYPE >      \
+                     (&CLASS<T1,T2>::bbSetInput##NAME) ) )
+//============================================================================
+
+//============================================================================
+/// 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,                         \
+                      new bbtk::AtomicBlackBoxTGetFunctor<CLASS<T1,T2>,TYPE,TYPE > \
+                      (&CLASS<T1,T2>::bbGetOutput##NAME),              \
+                      new bbtk::AtomicBlackBoxTSetFunctor<CLASS<T1,T2>,TYPE,TYPE > \
+                      (&CLASS<T1,T2>::bbSetOutput##NAME) ) )
+//============================================================================
+
+//============================================================================
+/// Template AtomicBlackBox std implementation of ctor and dtor
+#define BBTK_USER_BLACK_BOX_TEMPLATE2_IMPLEMENTATION(CLASS,PARENT)     \
+  template <class T1, class T2>                                                \
+  CLASS<T1,T2>::CLASS(const std::string& name, bool alloc)             \
+    : PARENT(name,false)                                               \
+  {                                                                    \
+    BBTK_BEGIN_BLACK_BOX_CONSTRUCTOR(CLASS,alloc);                     \
+    CLASS<T1,T2>::bbUserConstructor();                                 \
+    BBTK_END_BLACK_BOX_CONSTRUCTOR;                                    \
+  }                                                                    \
+  template <class T1, class T2>                                                        \
+  CLASS<T1,T2>::CLASS(CLASS<T1,T2>& from,                                              \
+              const std::string& name, bool allocate_connectors)       \
+    : PARENT(from,name,false)                                          \
+  {                                                                    \
+    BBTK_BEGIN_BLACK_BOX_COPY_CONSTRUCTOR(CLASS,from,allocate_connectors); \
+    CLASS<T1,T2>::bbUserCopyConstructor();                             \
+    BBTK_END_BLACK_BOX_CONSTRUCTOR;                                    \
+  }                                                                    \
+  template <class T1, class T2>                                                \
+  CLASS<T1,T2>::~CLASS()                                               \
+  {                                                                    \
+    BBTK_BEGIN_BLACK_BOX_DESTRUCTOR(CLASS);                            \
+    CLASS<T1,T2>::bbUserDestructor();                                  \
+    BBTK_END_BLACK_BOX_DESTRUCTOR;                                     \
+  }                                                                    
+//============================================================================
+
+
+//============================================================================
+/// Template AtomicBlackBox std implementation of ctor and dtor
+#define BBTK_USER_BLACK_BOX_TEMPLATE2_WITH_TYPES_IMPLEMENTATION(CLASS,PARENT,TYPE1,TYPE2) \
+  template <TYPE1 T1, TYPE2 T2>                                                \
+  CLASS<T1,T2>::CLASS(const std::string& name, bool alloc)             \
+    : PARENT(name,false)                                               \
+  {                                                                    \
+    BBTK_BEGIN_BLACK_BOX_CONSTRUCTOR(CLASS,alloc);                     \
+    this->bbUserConstructor();                                         \
+    BBTK_END_BLACK_BOX_CONSTRUCTOR;                                    \
+  }                                                                    \
+  template <TYPE1 T1, TYPE2 T2>                                                \
+  CLASS<T1,T2>::CLASS(CLASS<T1,T2>& from,                              \
+                     const std::string& name, bool allocate_connectors) \
+    : PARENT(from,name,false)                                          \
+  {                                                                    \
+    BBTK_BEGIN_BLACK_BOX_COPY_CONSTRUCTOR(CLASS,from,allocate_connectors); \
+    this->bbUserCopyConstructor();                                     \
+    BBTK_END_BLACK_BOX_CONSTRUCTOR;                                    \
+  }                                                                    \
+  template <TYPE1 T1, TYPE2 T2>                                                \
+  CLASS<T1,T2>::~CLASS()                                               \
+  {                                                                    \
+    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();*/ }
+//===========================================================================
+
+
+
+
+//===========================================================================
+//============================================================================
+// 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();*/ }
+//===========================================================================
+
+
+
+//===========================================================================
+/// EOF
+//===========================================================================
+#endif
diff --git a/kernel/src/bbtkAtomicBlackBoxOutputDescriptor.cxx b/kernel/src/bbtkAtomicBlackBoxOutputDescriptor.cxx
new file mode 100644 (file)
index 0000000..db79f8f
--- /dev/null
@@ -0,0 +1,57 @@
+/*=========================================================================
+                                                                                
+  Program:   bbtk
+  Module:    $RCSfile: bbtkAtomicBlackBoxOutputDescriptor.cxx,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.
+                                                                                
+=========================================================================*/
+
+/**
+ *  \file 
+ *  \brief Class bbtk::AtomicBlackBoxOutputDescriptor : structure containing the description of a AtomicBlackBox output (name, description, type, functor)
+ */
+#include "bbtkAtomicBlackBoxOutputDescriptor.h"
+   
+
+namespace bbtk
+{
+
+
+  AtomicBlackBoxOutputDescriptor::
+  AtomicBlackBoxOutputDescriptor( TypeInfo creator_type_info,
+                               const std::string& name,
+                               const std::string& description,
+                               AtomicBlackBoxGetFunctor* getfunctor,
+                               AtomicBlackBoxSetFunctor* setfunctor,
+                               bool copy_construct ) 
+    : 
+    BlackBoxOutputDescriptor(creator_type_info,
+                            name,description,copy_construct),
+    mGetFunctor(getfunctor),
+    mSetFunctor(setfunctor)
+  {    
+    
+    bbtkDebugMessage("Kernel",9,
+                    "AtomicBlackBoxOutputDescriptor::AtomicBlackBoxOutputDescriptor(\""
+                    <<name<<"\",\""<<description
+                    <<"\""<<getfunctor<<","<<setfunctor
+                    <<","<<copy_construct<<")"<<std::endl);
+  }
+  
+
+  AtomicBlackBoxOutputDescriptor::~AtomicBlackBoxOutputDescriptor() 
+  {
+    bbtkDebugMessage("Kernel",9,"AtomicBlackBoxOutputDescriptor::~AtomicBlackBoxOutputDescriptor(\""<<GetName()<<"\",\""<<GetDescription()<<"\""<<mGetFunctor<<","<<mSetFunctor<<")"<<std::endl);
+  }
+  
+}
diff --git a/kernel/src/bbtkAtomicBlackBoxOutputDescriptor.h b/kernel/src/bbtkAtomicBlackBoxOutputDescriptor.h
new file mode 100644 (file)
index 0000000..56db3be
--- /dev/null
@@ -0,0 +1,78 @@
+/*=========================================================================
+                                                                                
+  Program:   bbtk
+  Module:    $RCSfile: bbtkAtomicBlackBoxOutputDescriptor.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.
+                                                                                
+=========================================================================*/
+
+/**
+ *  \file 
+ *  \brief Class bbtk::AtomicBlackBoxOutputDescriptor : structure containing the description of a AtomicBlackBox output (name, description, type, functor)
+ */
+/**
+ * \class bbtk::AtomicBlackBoxOutputDescriptor
+ * \brief Structure containing the description of a AtomicBlackBox output (name, description, type, functor)
+ */
+
+#ifndef __bbtkAtomicBlackBoxOutputDescriptor_h__
+#define __bbtkAtomicBlackBoxOutputDescriptor_h__
+
+#include "bbtkBlackBoxOutputDescriptor.h"
+#include "bbtkAtomicBlackBoxGetSetFunctor.h"
+#include "bbtkMessageManager.h"
+
+namespace bbtk
+{
+
+
+  class BBTK_EXPORT AtomicBlackBoxOutputDescriptor : 
+    public bbtk::BlackBoxOutputDescriptor
+  {
+  public:
+      
+    AtomicBlackBoxOutputDescriptor( TypeInfo creator_type_info,
+                                 const std::string& name,
+                                 const std::string& description,
+                                 AtomicBlackBoxGetFunctor* getfunctor,
+                                 AtomicBlackBoxSetFunctor* setfunctor,
+                                 bool copy_construct = true);
+    ~AtomicBlackBoxOutputDescriptor();
+    
+    /// Returns the type of the input
+    TypeInfo GetTypeInfo() const { return mGetFunctor->GetTypeInfo(); }
+    /// Returns the name of the type of the input
+    std::string GetTypeName() const { return mGetFunctor->GetTypeName(); }
+   /// Returns the name of the type of the input
+    std::string GetHumanTypeName() const { return mGetFunctor->GetHumanTypeName(); }
+    /// Returns true iff the type is a pointer to class 
+    virtual bool IsPointerType() const { return mGetFunctor->IsPointerType(); }   /// Returns the functor on the Get method
+    AtomicBlackBoxGetFunctor* GetGetFunctor() { return mGetFunctor; }
+    /// Returns the functor on the Set method
+    AtomicBlackBoxSetFunctor* GetSetFunctor() { return mSetFunctor; }
+    
+    
+  private:
+    /// Default ctor is private 
+    AtomicBlackBoxOutputDescriptor() : 
+      BlackBoxOutputDescriptor(typeid(void),"","") {}
+    /// The functor on the Get method
+    AtomicBlackBoxGetFunctor* mGetFunctor;
+    /// The functor on the Set method
+    AtomicBlackBoxSetFunctor* mSetFunctor;
+  };
+
+  
+}
+// namespace bbtk
+#endif
index 6f5ab20e7c7cfa0c4d1571c3e120fa500de566fb..cd1596155b18612759b57561fdfeb063930c47e0 100644 (file)
@@ -3,8 +3,8 @@
   Program:   bbtk
   Module:    $RCSfile: bbtkBlackBoxDescriptor.cxx,v $
   Language:  C++
-  Date:      $Date: 2008/02/07 07:58:53 $
-  Version:   $Revision: 1.10 $
+  Date:      $Date: 2008/02/07 11:06:37 $
+  Version:   $Revision: 1.11 $
                                                                                 
   Copyright (c) CREATIS (Centre de Recherche et d'Applications en Traitement de
   l'Image). All rights reserved. See Doc/License.txt or
@@ -232,7 +232,8 @@ namespace bbtk
 
 
     std::string descr = GetDescription();
-    //Utilities::html_format(descr);
+    Utilities::html_format(descr);
+    std::cout << "HTML *** "<<descr<<std::endl;
     std::string author = GetAuthor();
     Utilities::html_format(author);
 
@@ -301,7 +302,7 @@ namespace bbtk
       Utilities::html_format(type);
       
       std::string descr(in->second->GetDescription());
-      //Utilities::html_format(descr);
+      Utilities::html_format(descr);
       
       std::string out = 
        "<TR><TD style='vertical-align: top;' bgcolor=\"" + col
@@ -364,7 +365,7 @@ namespace bbtk
        Utilities::html_format(type);
        
        std::string descr(o->second->GetDescription());
-       //Utilities::html_format(descr);
+       Utilities::html_format(descr);
        
        std::string out = 
          "<TR><TD style='vertical-align: top;' bgcolor=\"" + col
index 70fc8c7a2d619b298c21044a2a40d65074c8b007..8485061fde7bdf29ca43926ac542e9eab36905cc 100644 (file)
@@ -3,8 +3,8 @@
   Program:   bbtk
   Module:    $RCSfile: bbtkComplexBlackBoxDescriptor.cxx,v $
   Language:  C++
-  Date:      $Date: 2008/02/06 14:58:41 $
-  Version:   $Revision: 1.6 $
+  Date:      $Date: 2008/02/07 11:06:37 $
+  Version:   $Revision: 1.7 $
                                                                                 
   Copyright (c) CREATIS (Centre de Recherche et d'Applications en Traitement de
   l'Image). All rights reserved. See Doc/License.txt or
@@ -281,7 +281,7 @@ namespace bbtk
 
 
     std::string descr = GetDescription();
-    //Utilities::html_format(descr);
+    Utilities::html_format(descr);
     
     std::string author = GetAuthor();
     Utilities::html_format(author);
@@ -302,7 +302,7 @@ namespace bbtk
     std::string inc = GetScriptFileName();
     if (inc.size()>0) 
       {
-    (s) << "<TR><TD style='vertical-align: top;'><b> Use command </b></TD><TD style='vertical-align: top;'> : </TD><TD style='vertical-align: top;'> include " 
+    (s) << "<TR><TD style='vertical-align: top;'><b> To use it </b></TD><TD style='vertical-align: top;'> : </TD><TD style='vertical-align: top;'> include " 
       << inc << "</TD></TR>\n";
        
       }
@@ -371,7 +371,7 @@ namespace bbtk
        Utilities::html_format(type);
        
        std::string descr(in->second->GetDescription());
-       //Utilities::html_format(descr);
+       Utilities::html_format(descr);
 
        (s) << "<TR><TD style='vertical-align: top;'><B><PRE> "<<name<<" </PRE></B></TD>"
          << "<TD style='vertical-align: top;'><I><PRE> "<<type<<" </PRE></I></TD>"
@@ -404,7 +404,7 @@ namespace bbtk
        Utilities::html_format(type);
        
        std::string descr(o->second->GetDescription());
-       //Utilities::html_format(descr);
+       Utilities::html_format(descr);
        
        (s) << "<TR><TD style='vertical-align: top;'><B><PRE> "<<name<<" </PRE></B></TD>"
          << "<TD style='vertical-align: top;'><I><PRE> "<<type<<" </PRE></I></TD>"
index ca7ec422abf131c53a2f27e59391b38d0ae3087a..89366e96d0dde6f1a2c8a9f9703860f5574450de 100644 (file)
@@ -3,8 +3,8 @@
   Program:   bbtk
   Module:    $RCSfile: bbtkRTTI.h,v $
   Language:  C++
-  Date:      $Date: 2008/01/22 15:02:00 $
-  Version:   $Revision: 1.1 $
+  Date:      $Date: 2008/02/07 11:06:37 $
+  Version:   $Revision: 1.2 $
                                                                                 
   Copyright (c) CREATIS (Centre de Recherche et d'Applications en Traitement de
   l'Image). All rights reserved. See doc/license.txt or
@@ -136,36 +136,35 @@ namespace bbtk
     template <> inline std::string HumanTypeName< TYPE >(const TYPE&)  \
     { return NAME; }   
   
-  BBTK_DEFINE_HUMAN_READABLE_TYPE_NAME(std::string,"std::string");
-  BBTK_DEFINE_HUMAN_READABLE_TYPE_NAME(signed char,"char");
-  BBTK_DEFINE_HUMAN_READABLE_TYPE_NAME(signed short,"short");
-  BBTK_DEFINE_HUMAN_READABLE_TYPE_NAME(signed int,"int");
-  BBTK_DEFINE_HUMAN_READABLE_TYPE_NAME(unsigned char,"unsigned char");
-  BBTK_DEFINE_HUMAN_READABLE_TYPE_NAME(unsigned short,"unsigned short");
-  BBTK_DEFINE_HUMAN_READABLE_TYPE_NAME(unsigned int,"unsigned int");
-  
-  // Human readable strings for std::vector
-  BBTK_DEFINE_HUMAN_READABLE_TYPE_NAME(std::vector<int8_t>,
-                                      "std::vector<char>");
-  BBTK_DEFINE_HUMAN_READABLE_TYPE_NAME(std::vector<uint8_t>,
-                                      "std::vector<uchar>");
-  BBTK_DEFINE_HUMAN_READABLE_TYPE_NAME(std::vector<int16_t>,
-                                      "std::vector<short>");
-  BBTK_DEFINE_HUMAN_READABLE_TYPE_NAME(std::vector<uint16_t>,
-                                      "std::vector<ushort>");
-  BBTK_DEFINE_HUMAN_READABLE_TYPE_NAME(std::vector<int32_t>,
-                                      "std::vector<int>");
-  BBTK_DEFINE_HUMAN_READABLE_TYPE_NAME(std::vector<uint32_t>,
-                                      "std::vector<uint>");
-  BBTK_DEFINE_HUMAN_READABLE_TYPE_NAME(std::vector<long>,
-                                      "std::vector<long>");
-  BBTK_DEFINE_HUMAN_READABLE_TYPE_NAME(std::vector<float>,
-                                      "std::vector<float>");
-  BBTK_DEFINE_HUMAN_READABLE_TYPE_NAME(std::vector<double>,
-                                      "std::vector<double>");
-  BBTK_DEFINE_HUMAN_READABLE_TYPE_NAME(std::vector<std::string>,
-                                      "std::vector<std::string>");
+  BBTK_DEFINE_HUMAN_READABLE_TYPE_NAME(std::string,"String");
+  BBTK_DEFINE_HUMAN_READABLE_TYPE_NAME(signed char,"Char");
+  BBTK_DEFINE_HUMAN_READABLE_TYPE_NAME(signed short,"Short");
+  BBTK_DEFINE_HUMAN_READABLE_TYPE_NAME(signed int,"Int");
+  BBTK_DEFINE_HUMAN_READABLE_TYPE_NAME(unsigned char,"UChar");
+  BBTK_DEFINE_HUMAN_READABLE_TYPE_NAME(unsigned short,"UShort");
+  BBTK_DEFINE_HUMAN_READABLE_TYPE_NAME(unsigned int,"UInt");
+  BBTK_DEFINE_HUMAN_READABLE_TYPE_NAME(float,"Float");
+  BBTK_DEFINE_HUMAN_READABLE_TYPE_NAME(double,"Double");
+  BBTK_DEFINE_HUMAN_READABLE_TYPE_NAME(bool,"Bool");
+  BBTK_DEFINE_HUMAN_READABLE_TYPE_NAME(long,"Long");
 
+  // Human readable strings for std::vector
+#define BBTK_DEFINE_HUMAN_READABLE_VECTOR_TYPE_NAME(TYPE)              \
+  template <> inline std::string HumanTypeName< std::vector<TYPE> >()  \
+  { return "Vector"+HumanTypeName<TYPE>(); }                           \
+    template <> inline std::string HumanTypeName< std::vector<TYPE> >  \
+    (const std::vector<TYPE>&) { return "Vector"+HumanTypeName<TYPE>(); }      
+
+  BBTK_DEFINE_HUMAN_READABLE_VECTOR_TYPE_NAME(int8_t);
+  BBTK_DEFINE_HUMAN_READABLE_VECTOR_TYPE_NAME(uint8_t);
+  BBTK_DEFINE_HUMAN_READABLE_VECTOR_TYPE_NAME(int16_t);
+  BBTK_DEFINE_HUMAN_READABLE_VECTOR_TYPE_NAME(uint16_t);
+  BBTK_DEFINE_HUMAN_READABLE_VECTOR_TYPE_NAME(int32_t);
+  BBTK_DEFINE_HUMAN_READABLE_VECTOR_TYPE_NAME(uint32_t);
+  BBTK_DEFINE_HUMAN_READABLE_VECTOR_TYPE_NAME(long);
+  BBTK_DEFINE_HUMAN_READABLE_VECTOR_TYPE_NAME(float);
+  BBTK_DEFINE_HUMAN_READABLE_VECTOR_TYPE_NAME(double);
+  BBTK_DEFINE_HUMAN_READABLE_VECTOR_TYPE_NAME(std::string);
 
 /// The bbtk::TypeInfo type is a const ref on std::type_info (which can only be manipulated as such (because typeid returns const std::type_info& and type_info has all constructors private)) 
   typedef const std::type_info& TypeInfo;