]> Creatis software - bbtk.git/blobdiff - packages/std/src/bbstdMagicBox.h
Add StringVectorToNumericalVector box to package std
[bbtk.git] / packages / std / src / bbstdMagicBox.h
index ffd86dea3ae581cc7c9862dda5430398f4e754b4..4f0bebe06f61353be8b87c4856afb0b3fbc49b72 100644 (file)
@@ -2,8 +2,8 @@
   Program:   bbtk
   Module:    $RCSfile: bbstdMagicBox.h,v $
   Language:  C++
-  Date:      $Date: 2008/12/12 08:55:21 $
-  Version:   $Revision: 1.10 $
+  Date:      $Date: 2009/06/08 14:50:06 $
+  Version:   $Revision: 1.13 $
 =========================================================================*/
 
 /* ---------------------------------------------------------------------
@@ -37,6 +37,7 @@
 
 namespace bbstd
 {
+
   //==================================================================
   class bbstd_EXPORT MagicBox
     : 
@@ -46,15 +47,11 @@ namespace bbstd
     BBTK_DECLARE_INPUT(In,bbtk::Data);
     BBTK_DECLARE_OUTPUT(Out,bbtk::Data);
     BBTK_PROCESS(DoProcess);
-    void DoProcess() { bbSetOutputOut( bbGetInputIn() ); }
-    
-  protected:
-    //    virtual void bbUserConstructor();
-    
-  };
+    void DoProcess();
+ };
   //==================================================================
   
-  
+
   //==================================================================
   // We have to create a particular SetFunctor for MagicBox because
   // its input is of type bbtk::Data (i.e. any) and :
@@ -78,7 +75,9 @@ namespace bbstd
     /// Concrete application of the Set method of object o
     void Set(bbtk::AtomicBlackBox* o, const bbtk::Data& d)
     { 
-      bbtkDebugMessage("Data",9,"MagicBoxSetfunctor::Set()"<<std::endl);
+      bbtkDebugMessage("data",9,"MagicBoxSetfunctor::Set("<<
+                      bbtk::HumanTypeName(d.type())<<
+                      ")"<<std::endl);
       (((MagicBox*)o)->*mSetMethodPointer)(d);
     }
     
@@ -93,7 +92,7 @@ namespace bbstd
     SetMethodPointerType mSetMethodPointer;
   };
   //===========================================================================
-
+  
 
   //===========================================================================
   BBTK_BEGIN_DESCRIBE_BLACK_BOX(MagicBox,bbtk::AtomicBlackBox);
@@ -101,13 +100,15 @@ namespace bbstd
   BBTK_AUTHOR("laurent.guigues@creatis.insa-lyon.fr");
   BBTK_CATEGORY("misc");
   BBTK_DESCRIPTION("Takes *any kind* of data and copies it to its output. Is a magic box as any box output can be plugged into it and its output can be plugged into any other box input (dynamic type checking, see below), hence it can be put between **any** two boxes. Type matching between its output and the input of the box(es) to which it is connected is made at *run-time*. The pipeline will be executed if the data types : i) match exactly ii) can be transformed by an adaptor iii) are related pointers, i.e. if the output pointer can be upcasted (static_cast) or downcasted (dynamic_cast) to an input type pointer (see the bbtk::any output connection rule in the guide for details). Important uses of the MagicBox are : 1) performing run-time pointer cast, either upward or backward an object hierarchy 2) perform data adaptation (adaptor creation) at run-time vs. pipeline creation time.");
-  AddInputDescriptor
+ AddInputDescriptor
   (new bbtk::AtomicBlackBoxInputDescriptor
    (typeid(MagicBoxDescriptor),
     "In","Input data","",
     new bbtk::AtomicBlackBoxTGetFunctor<MagicBox,bbtk::Data,bbtk::Data>
     (&MagicBox::bbGetInputIn),
     new MagicBoxSetFunctor (&MagicBox::bbSetInputIn) ) );
+
   AddOutputDescriptor
   (new bbtk::AtomicBlackBoxOutputDescriptor
    (typeid(MagicBoxDescriptor),