]> Creatis software - bbtk.git/blobdiff - kernel/src/bbtkBlackBox.cxx
#2696 BBTK Bug New Normal - BoxChange BoxExecute not responding at the second actio...
[bbtk.git] / kernel / src / bbtkBlackBox.cxx
index 0206b2924369b54871e9eba5df07b74a59de64c4..6fb1fb83a9c749dfce3cc545269c3f0773ad71bf 100644 (file)
@@ -1,32 +1,39 @@
-/*=========================================================================                                                                               
+/*
+ # ---------------------------------------------------------------------
+ #
+ # Copyright (c) CREATIS (Centre de Recherche en Acquisition et Traitement de l'Image
+ #                        pour la SantÈ)
+ # Authors : Eduardo Davila, Frederic Cervenansky, Claire Mouton
+ # Previous Authors : Laurent Guigues, Jean-Pierre Roux
+ # CreaTools website : www.creatis.insa-lyon.fr/site/fr/creatools_accueil
+ #
+ #  This software is governed by the CeCILL-B license under French law and
+ #  abiding by the rules of distribution of free software. You can  use,
+ #  modify and/ or redistribute the software under the terms of the CeCILL-B
+ #  license as circulated by CEA, CNRS and INRIA at the following URL
+ #  http://www.cecill.info/licences/Licence_CeCILL-B_V1-en.html
+ #  or in the file LICENSE.txt.
+ #
+ #  As a counterpart to the access to the source code and  rights to copy,
+ #  modify and redistribute granted by the license, users are provided only
+ #  with a limited warranty  and the software's author,  the holder of the
+ #  economic rights,  and the successive licensors  have only  limited
+ #  liability.
+ #
+ #  The fact that you are presently reading this means that you have had
+ #  knowledge of the CeCILL-B license and that you accept its terms.
+ # ------------------------------------------------------------------------ */
+
+
+/*=========================================================================
   Program:   bbtk
   Module:    $RCSfile: bbtkBlackBox.cxx,v $
   Language:  C++
-  Date:      $Date: 2009/03/23 13:06:41 $
-  Version:   $Revision: 1.40 $
+  Date:      $Date: 2012/11/16 08:49:01 $
+  Version:   $Revision: 1.56 $
 =========================================================================*/
 
-/* ---------------------------------------------------------------------
-
-* Copyright (c) CREATIS-LRMN (Centre de Recherche en Imagerie Medicale)
-* Authors : Eduardo Davila, Laurent Guigues, Jean-Pierre Roux
-*
-*  This software is governed by the CeCILL-B license under French law and 
-*  abiding by the rules of distribution of free software. You can  use, 
-*  modify and/ or redistribute the software under the terms of the CeCILL-B 
-*  license as circulated by CEA, CNRS and INRIA at the following URL 
-*  http://www.cecill.info/licences/Licence_CeCILL-B_V1-en.html 
-*  or in the file LICENSE.txt.
-*
-*  As a counterpart to the access to the source code and  rights to copy,
-*  modify and redistribute granted by the license, users are provided only
-*  with a limited warranty  and the software's author,  the holder of the
-*  economic rights,  and the successive licensors  have only  limited
-*  liability. 
-*
-*  The fact that you are presently reading this means that you have had
-*  knowledge of the CeCILL-B license and that you accept its terms.
-* ------------------------------------------------------------------------ */                                                                         
+
 
 /**
  *  \file 
@@ -40,6 +47,7 @@
 
 #include "bbtkConfigurationFile.h"
 #include "bbtkWxBlackBox.h"
+#include "bbtkWx.h"
 
 #include <fstream>
 //#include <vector>
@@ -47,8 +55,6 @@
 
 namespace bbtk
 {
-
-
   static bool bbmgSomeBoxExecuting = false;
   static bool bbmgFreezeExecution = false;
   static std::set<BlackBox::WeakPointer> bbmgExecutionList;
@@ -61,7 +67,7 @@ namespace bbtk
   //=========================================================================
   
   //=========================================================================
-  void BlackBox::Deleter::Delete(Object* p)
+  int BlackBox::Deleter::Delete(Object* p)
   {
     BlackBox* b = dynamic_cast<BlackBox*>(p);
     if (!b)
@@ -77,7 +83,7 @@ namespace bbtk
     BlackBoxDescriptor::WeakPointer desc = b->bbGetDescriptor();
     bbtkDebugMessage("object",2,"##> BlackBox::Deleter(\""<<name<<"\") : deleting black box"<<std::endl);
     
-    b->bbDelete();
+    int refs = b->bbDelete();
 
     bbtkDebugMessage("object",2,"##> BlackBox::Deleter(\""<<name<<"\") : releasing descriptor"<<std::endl);
     
@@ -98,6 +104,7 @@ namespace bbtk
        bbtkDebugMessage("object",2,"##> BlackBox::Deleter(\""<<name<<"\") : descriptor expired : nothing to do (was not held by a package or the box is a complex black box prototype)"<<std::endl);
       }
     bbtkDebugMessage("object",2,"<## BlackBox::Deleter(\""<<name<<"\")"<<std::endl);
+    return refs;
   }
   //=========================================================================
 
@@ -105,15 +112,21 @@ namespace bbtk
   BlackBox::BlackBox(const std::string &name) 
     : 
     //    bbmStatus(MODIFIED), 
+    bbmInitialized(false),
     bbmExecuting(false),
     bbmName(name),
     bbmBoxProcessMode("Pipeline"),
+       bbLetRecursiveExecuteManualMode(false),
     bbmParent()
     
   {
-    bbtkDebugMessage("object",4,"==> BlackBox::BlackBox(\""
+         //JCP 02-11-09
+        // bbmBoxProcessMode = "Pipeline";     
+//std::cout<<"JCP BlackBox::BlackBox(const std::string &name) name=" <<name
+//               <<"bbmBoxProcessMode="<<bbmBoxProcessMode<<std::endl;
+    bbtkBlackBoxDebugMessage("object",4,"==> BlackBox::BlackBox(\""
                     <<name<<"\")"<<std::endl);
-    bbtkDebugMessage("object",4,"<== BlackBox::BlackBox(\""
+    bbtkBlackBoxDebugMessage("object",4,"<== BlackBox::BlackBox(\""
                     <<name<<"\")"<<std::endl);
   }
   //=========================================================================
@@ -126,16 +139,22 @@ namespace bbtk
   BlackBox::BlackBox(BlackBox& from, const std::string &name) 
     :
     //    bbmStatus(from.bbmStatus), 
-      bbmExecuting(false),
-      bbmName(name), 
-      bbmBoxProcessMode(from.bbmBoxProcessMode),
-      bbmParent()
-
+    bbmInitialized(false),
+    bbmExecuting(false),
+    bbmName(name), 
+    bbmBoxProcessMode(from.bbmBoxProcessMode),
+       bbLetRecursiveExecuteManualMode(false),
+    bbmParent()
+    
   {
-    bbtkDebugMessage("object",4,"==> BlackBox::BlackBox("
+         //JCP 02-11-09
+         //bbmBoxProcessMode = from.bbmBoxProcessMode;
+         //std::cout<<"JCP BlackBox::BlackBox(const std::string &name) name=" <<name
+               //  <<"bbmBoxProcessMode="<<bbmBoxProcessMode<<std::endl;
+    bbtkBlackBoxDebugMessage("object",4,"==> BlackBox::BlackBox("
                     <<from.bbGetFullName()<<",\""
                     <<name<<"\")"<<std::endl);
-    bbtkDebugMessage("object",4,"<== BlackBox::BlackBox("
+    bbtkBlackBoxDebugMessage("object",4,"<== BlackBox::BlackBox("
                     <<from.bbGetFullName()<<",\""
                     <<name<<"\")"<<std::endl);
   }
@@ -145,10 +164,10 @@ namespace bbtk
   //=========================================================================
   BlackBox::~BlackBox()
   {
-    bbtkDebugMessage("object",4,"==> BlackBox::~BlackBox() ["<<bbmName
+    bbtkBlackBoxDebugMessage("object",4,"==> BlackBox::~BlackBox() ["<<bbmName
                     <<"]"<<std::endl);
     this->bbDesallocateConnectors();
-    bbtkDebugMessage("object",4,"<== BlackBox::~BlackBox() ["<<bbmName
+    bbtkBlackBoxDebugMessage("object",4,"<== BlackBox::~BlackBox() ["<<bbmName
                     <<"]"<<std::endl);
   }
   //=========================================================================
@@ -165,7 +184,6 @@ namespace bbtk
 
 
   //=========================================================================
-  /// Returns the name with the name of the parent prepended if any
   std::string BlackBox::bbGetNameWithParent() const
   {
     if (bbmParent.lock()) 
@@ -180,7 +198,6 @@ namespace bbtk
   //=========================================================================
 
   //=========================================================================
-  /// Prints the Help on the BlackBox type 
   void BlackBox::bbGetHelp(bool full) const
   {
     bbGetDescriptor()->GetHelp(full); 
@@ -189,76 +206,76 @@ namespace bbtk
 
 
   //=========================================================================
-  /// Returns true if the UserBlackBox has an input of name name
   bool BlackBox::bbHasInput(const std::string& name) const
   {
-    bbtkDebugMessageInc("Kernel",8,
+    bbtkBlackBoxDebugMessage("kernel",8,
                        "BlackBox::bbHasInput(\""
-                       <<name<<"\") ["<<bbGetFullName()<<"]"
+                       <<name<<"\")"
                        <<std::endl);
     bool r = ( bbGetDescriptor()->GetInputDescriptorMap().find(name)
               != bbGetDescriptor()->GetInputDescriptorMap().end());
-    bbtkDebugDecTab("Kernel",8);
+    bbtkDebugDecTab("kernel",8);
     return r;
   }
   //=========================================================================
 
 
   //=========================================================================  
-  /// Returns true if the UserBlackBox has an output of name name
   bool BlackBox::bbHasOutput(const std::string& name) const
   {
-    bbtkDebugMessageInc("Kernel",8,"BlackBox::bbHasOutput(\""
-                       <<name<<"\") ["<<bbGetFullName()<<"]"<<std::endl);
+    bbtkBlackBoxDebugMessage("kernel",8,"BlackBox::bbHasOutput(\""
+                            <<name<<"\")"
+                            <<std::endl);
     bool r = ( bbGetDescriptor()->GetOutputDescriptorMap().find(name)
               != bbGetDescriptor()->GetOutputDescriptorMap().end());
-    bbtkDebugDecTab("Kernel",8);
+    bbtkDebugDecTab("kernel",8);
     return r;
   }
   //=========================================================================
 
 
   //=========================================================================  
-  ///  Gets the output type of a given name
   TypeInfo BlackBox::bbGetOutputType( const std::string &name ) const 
   {
-    bbtkDebugMessageInc("Kernel",8,
-                       "BlackBox::bbGetOutputType(\""
-                       <<name<<"\") ["<<bbGetFullName()<<"]"<<std::endl);
+    bbtkBlackBoxDebugMessage("kernel",8,
+                            "BlackBox::bbGetOutputType(\""
+                            <<name<<"\")"
+                            <<std::endl);
     TypeInfo r = bbGetDescriptor()->GetOutputDescriptor(name)->GetTypeInfo();
-    bbtkDebugDecTab("Kernel",8); 
+    bbtkDebugDecTab("kernel",8); 
     return r;
   }
   //=========================================================================
 
   //=========================================================================
-  ///  Gets the input type of a given name
   TypeInfo BlackBox::bbGetInputType( const std::string &name ) const
   {
-    bbtkDebugMessageInc("Kernel",8,
-                       "BlackBox::bbGetInputType(\""
-                       <<name<<"\") ["<<bbGetFullName()<<"]"<<std::endl);
+    bbtkBlackBoxDebugMessage("kernel",8,
+                            "BlackBox::bbGetInputType(\""
+                            <<name<<"\")"
+                            <<std::endl);
     TypeInfo r = bbGetDescriptor()->GetInputDescriptor(name)->GetTypeInfo();
-    bbtkDebugDecTab("Kernel",8);
+    bbtkDebugDecTab("kernel",8);
     return r;
   }
   //=========================================================================
 
 
   //=========================================================================
-  /// Allocates the i/o connectors of the black box
   void BlackBox::bbAllocateConnectors()
   {  
-    bbtkDebugMessageInc("Kernel",8,
-                       "BlackBox::bbAllocateConnectors() ["
-                       <<bbGetFullName()<<"]"
+    bbtkBlackBoxDebugMessage("kernel",8,
+                       "BlackBox::bbAllocateConnectors()"
                        <<std::endl);                                   
+
+    MakeBlackBoxPointer(this,true);
+
     const BlackBoxDescriptor::InputDescriptorMapType& imap 
       = bbGetDescriptor()->GetInputDescriptorMap(); 
     BlackBoxDescriptor::InputDescriptorMapType::const_iterator i;      
     for ( i = imap.begin(); i != imap.end(); ++i )                     
       {                                                                        
-       bbtkDebugMessage("Kernel",8,"* Allocate \""<<i->first<<"\""<<std::endl);
+       bbtkBlackBoxDebugMessage("kernel",8,"* Allocate \""<<i->first<<"\""<<std::endl);
        bbGetInputConnectorMap()[i->second->GetName()] 
          = new BlackBoxInputConnector(GetThisPointer<BlackBox>());
       }                                                                        
@@ -267,20 +284,18 @@ namespace bbtk
     BlackBoxDescriptor::OutputDescriptorMapType::const_iterator o; 
     for ( o = omap.begin(); o != omap.end(); ++o )
       {                                                        
-       bbtkDebugMessage("Kernel",8,"* Allocate \""<<o->first<<"\""<<std::endl);
+       bbtkBlackBoxDebugMessage("kernel",8,"* Allocate \""<<o->first<<"\""<<std::endl);
        bbGetOutputConnectorMap()[o->second->GetName()] 
-         = new BlackBoxOutputConnector();
+         = new BlackBoxOutputConnector(GetThisPointer<BlackBox>());
       }
-    bbtkDebugDecTab("Kernel",8);  
   }
   //=========================================================================
 
 
   //=========================================================================
-  /// Desallocates the i/o connectors of the black box
   void BlackBox::bbDesallocateConnectors()
   {
-    bbtkDebugMessageInc("Kernel",8,
+    bbtkBlackBoxDebugMessage("kernel",8,
                        "BlackBox::bbDesallocateConnectors()"
                        <<std::endl);                                   
 
@@ -288,31 +303,29 @@ namespace bbtk
     for ( i = bbGetInputConnectorMap().begin();
          i != bbGetInputConnectorMap().end(); ++i )                   
       {                                                                        
-       bbtkDebugMessage("Kernel",8,"* Delete \""<<i->first<<"\""<<std::endl);
+       bbtkBlackBoxDebugMessage("kernel",8,"* Delete \""<<i->first<<"\""<<std::endl);
        delete (i->second);
       }                                                                        
     OutputConnectorMapType::const_iterator o;  
     for ( o = bbGetOutputConnectorMap().begin(); 
          o != bbGetOutputConnectorMap().end(); ++o )                   
       {                                                                        
-       bbtkDebugMessage("Kernel",8,"* Delete \""<<o->first<<"\""<<std::endl);         
+       bbtkBlackBoxDebugMessage("kernel",8,"* Delete \""<<o->first<<"\""<<std::endl);         
        delete (o->second);
       }                                                                        
    
-    bbtkDebugDecTab("Kernel",8);  
-
+    bbtkDebugDecTab("kernel",8);
   }
   //=========================================================================
 
 
   //=========================================================================
-  /// Copies the input / output values from another box
   void BlackBox::bbCopyIOValues(BlackBox& from)
   {
-    bbtkDebugMessageInc("Kernel",1,
-                       "BlackBox::bbCopyIOValues("
-                       <<from.bbGetFullName()<<") ["
-                       <<bbGetFullName()<<"]"<<std::endl);
+    bbtkBlackBoxDebugMessage("kernel",1,
+                            "BlackBox::bbCopyIOValues("
+                            <<from.bbGetFullName()<<")"
+                            <<std::endl);
     // copies the input values
     const BlackBoxDescriptor::InputDescriptorMapType& imap 
       = bbGetDescriptor()->GetInputDescriptorMap(); 
@@ -321,7 +334,7 @@ namespace bbtk
       {                
        if (! i->second->GetCopyConstruct() ) continue;
        std::string input = i->second->GetName();
-       bbtkDebugMessage("Kernel",2,"* Copying input "<<input<<std::endl);
+       bbtkBlackBoxDebugMessage("kernel",2,"* Copying input "<<input<<std::endl);
        this->bbSetInput(input, from.bbGetInput(input) );
       }                                                                        
     // copies the output values
@@ -332,12 +345,11 @@ namespace bbtk
       {                                                        
        if (! o->second->GetCopyConstruct() ) continue;
        std::string output = o->second->GetName();
-       bbtkDebugMessage("Kernel",2,"* Copying output "<<output<<std::endl);
+       bbtkBlackBoxDebugMessage("kernel",2,"* Copying output "<<output<<std::endl);
        this->bbSetOutput(output, from.bbGetOutput(output) );
       }
 
-    bbtkDebugDecTab("Kernel",9);
-
+    bbtkDebugDecTab("kernel",9);
   }
   //=========================================================================
 
@@ -350,63 +362,69 @@ namespace bbtk
 #ifdef USE_WXWIDGETS
             || Wx::IsSomeWindowAlive() 
 #endif
-            ); 
+            );
   }
   //=========================================================================
 
 
 
-  //=========================================================================
-  /// User overloadable destruction method of a black box
-  void BlackBox::bbUserDelete() 
-  {   
-    bbtkDebugMessage("process",5,
-                    "=> BlackBox::bbUserDelete() ["
-                    <<bbGetFullName()<<"]"
-                    <<" : not overloaded; using standard deletion"
-                    <<std::endl);
-    delete this;
-  }
-  //=========================================================================
-
-
   //=========================================================================
   BlackBox::BoxProcessModeValue BlackBox::bbGetBoxProcessModeValue() const
   {
     const std::string& p = bbmBoxProcessMode;
     if ( (p == "0") ||
         (p == "P") || (p == "p") ||
-        (p == "Pipeline") || (p == "pipeline") ) return Pipeline;
+        (p == "Pipeline") || (p == "pipeline") ) return bbPipeline;
     if ( (p == "1") ||
         (p == "A") || (p == "a") ||
-        (p == "Always") || (p == "always") ) return Always;
+        (p == "Always") || (p == "always") ) return bbAlways;
     if ( (p == "2") ||
         (p == "R") || (p == "r") ||
-        (p == "Reactive") || (p == "reactive") ) return Reactive;
-    bbtkError(bbGetFullName()<<" : BoxProcessMode value '"<<p
+        (p == "Reactive") || (p == "reactive") ) 
+               return bbReactive;
+    /*
+    if ( (p == "3") ||
+        (p == "F") || (p == "f") ||
+        (p == "Flash") || (p == "flash") ) return Flash;
+    */
+
+         if ( (p == "3") ||
+          (p == "M") || (p == "m") ||
+          (p == "Manual") || (p == "manual") ) return bbManual;
+         
+         bbtkError(bbGetFullName()<<" : BoxProcessMode value '"<<p
              <<"' unknown. Possible values : "
              <<"'0'/'P'/'p'/'Pipeline'/'pipeline' | "
              <<"'1'/'A'/'a'/'Always'/'always' | "
-             <<"'2'/'R'/'r'/'Reactive'/'reactive'"<<std::endl);
+             <<"'2'/'R'/'r'/'Reactive'/'reactive'"
+             //      <<"'3'/'F'/'f'/'Flash'/'flash'"
+             <<"'3'/'M'/'m'/'Manual'/'manual'"
+                 <<std::endl);
   }
   //=========================================================================
   
   //=========================================================================
   bool  BlackBox::bbBoxProcessModeIsReactive() const
   {
-    return (bbGetBoxProcessModeValue() == Reactive);
+    return (bbGetBoxProcessModeValue() == bbReactive);
   }
   //=========================================================================
 
   //=========================================================================
   bool  BlackBox::bbBoxProcessModeIsAlways() const
   {
-    return (bbGetBoxProcessModeValue() == Always);
+    return (bbGetBoxProcessModeValue() == bbAlways);
   }
   //=========================================================================
 
 
-
+       //=========================================================================
+       bool  BlackBox::bbBoxProcessModeIsManual() const
+       {
+               return (bbGetBoxProcessModeValue() == bbManual);
+       }
+       //=========================================================================
+       
 
   //=========================================================================
   void BlackBox::bbAddOutputObserver(const std::string& output, 
@@ -425,149 +443,63 @@ namespace bbtk
   //=========================================================================
 
 
-  /*
   //=========================================================================
-  ///  Sets the ChangeTime of input 
-  void BlackBox::bbSetInputChangeTime(BlackBoxInputConnector* c, 
-                                     const ChangeTime& t)
-  {
-    bbtkDebugMessage("change",1,
-                    "==> BlackBox::bbSetInputChangeTime("<<c<<","<<t<<") ["
-                    <<bbGetFullName()<<"]"<<std::endl);
-    
-    // If new time is greater than old one
-    if ( c->SetChangeTime(t) ) 
-      {
-       bool was_up_to_date = bbIsUpToDate();
-       // If new time is greater than the old max time of inputs
-       if ( mMaxInputChangeTime.Set(t) ) 
-         {
-           // If the box turned out-of-date
-           if ( was_up_to_date && bbIsOutOfDate() )
-             {
-               // 
-               if ( ( bbBoxProcessModeIsReactive()  ||
-                      (c==bbGetInputConnectorMap().find("BoxExecute")->second))
-                    && (bbCanReact() ) )
-                 {
-                   bbtkDebugMessage("change",2,
-                                    "an input of "
-                                    <<bbGetFullName()
-                                    <<" changed and box is in Reactive mode or BoxExecute input changed : adding it to the global execution list"
-                                    <<std::endl);
-                   bbGlobalAddToExecutionList( GetThisPointer<BlackBox>() );
-                 }
-               // Have to propagate the modification to aval boxes
-               OutputConnectorMapType::iterator i;
-               for (i = bbGetOutputConnectorMap().begin();
-                    i != bbGetOutputConnectorMap().end();
-                    ++i)
-                 {
-                   i->second->SetChangeTime(t);
-                 }
-               // update the MinOutputChangeTime
-               mMinOutputChangeTime.Set(t);
-             }
-         }
-      }
-  }
-  //=========================================================================
-
- //=========================================================================
-  ///  Sets the ChangeTime of output 
-  void BlackBox::bbSetOutputChangeTime(BlackBoxOutputConnector* c, 
-                                      const ChangeTime& t)
+  void BlackBox::bbSetStatusAndPropagate(BlackBoxInputConnector* c,
+                                        IOStatus s)
   {
-    bbtkDebugMessage("change",1,
-                    "==> BlackBox::bbSetOutputChangeTime("<<c<<","<<t<<") ["
-                    <<bbGetFullName()<<"]"<<std::endl);
-    
-    //ChangeTime old = 
-    c->SetChangeTime(t);
-    // c->GetChangeTime() = t;
-    //    bbUpdateMinOutputChangeTime(t);
-    // propagate
-    
-  }
-  //=========================================================================
-  */
+    bbtkBlackBoxDebugMessage("change",5,
+                            "=> BlackBox::bbSetStatusAndPropagate(input,"
+                            <<GetIOStatusString(s)<<")"
+                            <<std::endl);
 
-  /*
-  //=========================================================================
-  void BlackBox::bbUpdateMaxInputChangeTime(const ChangeTime& t)
-  {    
-
-    
-    if ( t > mMaxInputChangeTime ) 
-      {
-       mMaxInputChangeTime = t;
-       if ( mMinOutputChangeTime > mMaxInputChangeTime )
-         {
-           
-         }
-      }
-    
-  }
-  //=========================================================================
+    if (s==UPTODATE) bbtkError("bbSetStatusAndPropagate with status UPTODATE!");
+    c->SetStatus(s);
 
-  //=========================================================================
-  void bbUpdateMinOutputChangeTime(const ChangeTime& t)
-  {
-    ChangeTime old = mMinOutputChangeTime;
-    mMinOutputChangeTime = MAXLONG;
-    OutputConnectorMapType::iterator i;
-    for (i = bbGetOutputConnectorMap.begin();
-        i != bbGetOutputConnectorMap.end();
-        ++i)
-      {
-       if (i->second->GetChangeTime() < mMinOutputChangeTime)
-         mMinOutputChangeTime = i->second->GetChangeTime();
-      }
-    if ( mMinOutputChangeTime < old )
+    // Flash reaction
+    /*
+    if (bbGetBoxProcessModeValue() == Flash)
       {
+       this->bbExecute();
       }
-   
-  }
-  //=========================================================================
-  */
+    */
 
-  //=========================================================================
-  /// Signals that the BlackBox has been modified through 
-  /// the input connector c
-  /// and propagates it downward
-  /// ** NOT USER INTENDED **
-  void BlackBox::bbSetStatusAndPropagate(BlackBoxInputConnector* c,
-                                        IOStatus s)
-  {
-    bbtkDebugMessageInc("change",5,
-                       "=> BlackBox::bbSetStatusAndPropagate(input,"
-                       <<GetIOStatusString(s)<<") ["
-                       <<bbGetFullName()<<"]"<<std::endl);
 
-    if (s==UPTODATE) bbtkError("bbSetStatusAndPropagate with status UPTODATE!");
-    c->SetStatus(s);
     OutputConnectorMapType::const_iterator o;  
     for ( o = bbGetOutputConnectorMap().begin(); 
          o != bbGetOutputConnectorMap().end(); ++o )                   
-      {                                                                        
-       if (o->second->GetStatus()==UPTODATE) 
+      {
+
+
+       if (o->first=="BoxChange")
+       {
+               o->second->SetStatus(UPTODATE);
+       }
+
+
+
+//EED 24/08/2015
+// EED CASPITAS 2
+       if (o->second->GetStatus()==UPTODATE)
+//     if ((o->second->GetStatus()==UPTODATE) || (o->second->GetStatus()==OUTOFDATE))
+//     if ((o->second->GetStatus()==UPTODATE) || (o->second->GetStatus()==MODIFIED))
          {
            o->second->SetStatus(OUTOFDATE);
            o->second->SignalChange(GetThisPointer<BlackBox>(),o->first); 
-         }
-      }                                                                        
+         } // if
+       } // for                                                        
     
-    if ( ( bbBoxProcessModeIsReactive()  ||
-          (c==bbGetInputConnectorMap().find("BoxExecute")->second))
-        && (bbCanReact() ) )
+
+    if (  ( bbBoxProcessModeIsReactive()
+          || (c==bbGetInputConnectorMap().find("BoxExecute")->second))
+          && (bbCanReact() ) )
       {
-       bbtkDebugMessage("change",2,
+       bbtkBlackBoxDebugMessage("change",2,
                         "-> Execution triggered by Reactive mode or BoxExecute input change"<<std::endl);
         bbGlobalAddToExecutionList( GetThisPointer<BlackBox>() );
-      }    
-    bbtkDebugMessageInc("change",5,
-                       "<= BlackBox::bbSetStatusAndPropagate(input) ["
-                       <<bbGetFullName()<<"]"<<std::endl);
+      } // if
+    bbtkBlackBoxDebugMessage("change",5,
+                            "<= BlackBox::bbSetStatusAndPropagate(input)"
+                            <<std::endl);
   }
   //=========================================================================
 
@@ -575,11 +507,11 @@ namespace bbtk
   //=========================================================================  
   void BlackBox::bbSignalOutputModification(bool reaction)
   {
-    bbtkDebugMessageInc("change",5,
-                       "=> BlackBox::bbSignalOutputModification("
-                       <<reaction<<") ["
-                       <<bbGetFullName()<<"]"<<std::endl);
-    
+    bbtkBlackBoxDebugMessage("change",5,
+                            "=> BlackBox::bbSignalOutputModification("
+                            <<reaction<<")"
+                            <<"]"<<std::endl);
+
     OutputConnectorMapType::iterator i;
     for ( i  = bbGetOutputConnectorMap().begin(); 
          i != bbGetOutputConnectorMap().end(); ++i) 
@@ -593,24 +525,25 @@ namespace bbtk
        //        {
            i->second->SignalChange(GetThisPointer<BlackBox>(),i->first); 
            //    }
-      } 
+      } // for
 
     if (reaction) bbGlobalProcessExecutionList();
 
-    bbtkDebugMessageDec("change",5,
-                       "<= BlackBox::bbSignalOutputModification() ["
-                       <<bbGetFullName()<<"]"<<std::endl);
-    
+    bbtkBlackBoxDebugMessage("change",5,
+                            "<= BlackBox::bbSignalOutputModification()"
+                            <<std::endl);
   }  
   //=========================================================================   
+
+
   //=========================================================================  
   void BlackBox::bbSignalOutputModification(const std::string& output,
                                            bool reaction)
   {
-    bbtkDebugMessageInc("change",5,
-                       "=> BlackBox::bbSignalOutputModification("
-                       <<output<<","<<reaction<<") ["
-                       <<bbGetFullName()<<"]"<<std::endl);
+    bbtkBlackBoxDebugMessage("change",5,
+                            "=> BlackBox::bbSignalOutputModification("
+                            <<output<<","<<reaction<<")"
+                            <<std::endl);
     
     OutputConnectorMapType::iterator i = 
       bbGetOutputConnectorMap().find(output);
@@ -636,20 +569,19 @@ namespace bbtk
        if (reaction) bbGlobalProcessExecutionList();
        //      }
 
-    bbtkDebugMessageDec("change",5,
-                       "<= BlackBox::bbSignalOutputModification("
-                       <<output<<") ["
-                       <<bbGetFullName()<<"]"<<std::endl);
-    
+       bbtkBlackBoxDebugMessage("change",5,
+                            "<= BlackBox::bbSignalOutputModification("
+                            <<output<<")"
+                            <<std::endl);
   }  
   //=========================================================================   
   //=========================================================================  
   void BlackBox::bbSignalOutputModification(const std::vector<std::string>& output,
        bool reaction)
   {
-    bbtkDebugMessageInc("change",5,
-                       "=> BlackBox::bbSignalOutputModification(vector of outputs) ["
-                       <<bbGetFullName()<<"]"<<std::endl);
+    bbtkBlackBoxDebugMessage("change",5,
+                       "=> BlackBox::bbSignalOutputModification(vector of outputs)"
+<<std::endl);
     OutputConnectorMapType::iterator i;
     std::vector<std::string>::const_iterator o;
     bool changed = false;
@@ -681,10 +613,9 @@ namespace bbtk
            //  }
       }
 
-    bbtkDebugMessageDec("change",5,
-                       "<= BlackBox::bbSignalOutputModification(vector of outputs) ["
-                       <<bbGetFullName()<<"]"<<std::endl);
-
+    bbtkBlackBoxDebugMessage("change",5,
+                            "<= BlackBox::bbSignalOutputModification(vector of outputs)"
+                            <<std::endl);
   }  
   //=========================================================================   
 
@@ -698,15 +629,15 @@ namespace bbtk
   /// Main processing method of the box.
   void BlackBox::bbExecute(bool force)
   {
-    bbtkDebugMessageInc("process",2,
-                       "=> BlackBox::bbExecute("<<(int)force<<") ["
-                       <<bbGetFullName()<<"]"<<std::endl);
+    bbtkBlackBoxDebugMessage("process",2,
+                            "=> BlackBox::bbExecute("<<(int)force<<")"
+                            <<std::endl);
  
     // If already executing : return
     /*
     if (bbGetExecuting()) 
       {
-       bbtkDebugMessage("process",2,
+       bbtkBlackBoxDebugMessage("process",2,
                         " -> already executing : abort"<<std::endl);
        return;
       }
@@ -715,7 +646,7 @@ namespace bbtk
     // If execution frozen : return
     if (bbGlobalGetFreezeExecution()) 
       {
-       bbtkDebugMessage("process",2,
+       bbtkBlackBoxDebugMessage("process",2,
                         " -> FreezeExecution global flag is 'true' : abort execution"<<std::endl);
       }
 
@@ -724,54 +655,117 @@ namespace bbtk
     // If force is true then update is triggered even if the box is UPTODATE
     //    if (force) bbSetModifiedStatus();
 
+       if ( bbBoxProcessModeIsManual() ) 
+       {
+               bbLetRecursiveExecuteManualMode = true;
+    }
+         
+         
     // Calls the main recursive execution method 
     bbRecursiveExecute(Connection::Pointer());
 
-    bbtkDebugMessageDec("process",2,
-                       "<= BlackBox::bbExecute() ["
-                       <<bbGetFullName()<<"]"<<std::endl);
+         
+       if ( bbBoxProcessModeIsManual() ) 
+       {
+               bbLetRecursiveExecuteManualMode = false;
+       }
+         
+         
+    bbtkBlackBoxDebugMessage("process",2,
+                            "<= BlackBox::bbExecute()"
+                            <<std::endl);
+  }
+  //=========================================================================
+
+  //=========================================================================
+  void BlackBox::bbInitializeProcessing()
+  {
+    if (!bbmInitialized) 
+      {
+       bbtkBlackBoxDebugMessage("process",2,"** Initialize processing"
+                                <<std::endl);
+       this->bbRecursiveInitializeProcessing();
+       bbmInitialized = true;
+      }
   }
   //=========================================================================
 
+  //=========================================================================
+  void BlackBox::bbFinalizeProcessing()
+  {
+    if (bbmInitialized) 
+      {
+       bbtkBlackBoxDebugMessage("process",2,"** Finalize processing"
+                                <<std::endl);
+       this->bbRecursiveFinalizeProcessing();
+       bbmInitialized = false;
+      }
+  }
+  //=========================================================================
 
+  
   //=========================================================================
-  /// Main recursive processing method of the box.
   void BlackBox::bbRecursiveExecute( Connection::Pointer caller )
   {
-    bbtkDebugMessageInc("process",3,
+
+    bbtkBlackBoxDebugMessage("process",3,
                        "=> BlackBox::bbRecursiveExecute("
-                       <<(caller?caller->GetFullName():"0")<<") ["
-                       <<bbGetFullName()<<"]"<<std::endl);
+                       <<(caller?caller->GetFullName():"0")<<")"
+                       <<std::endl);
 
     // If already executing : return
     if (bbGetExecuting()) 
       {
-       bbtkDebugMessage("process",3,
+       bbtkBlackBoxDebugMessage("process",3,
                         " -> already executing : abort"<<std::endl);
        return; 
       }
+    
+    // If not initialized do it
+    bbInitializeProcessing();
 
     bbSetExecuting(true);
     bool wasExecuting = bbGlobalGetSomeBoxExecuting();
     bbGlobalSetSomeBoxExecuting(true);
-
-       this->bbCreateWidget();
-
-    // Updates its inputs
-    IOStatus s = bbUpdateInputs();
     
-    if ( (s != UPTODATE) ||
-        bbBoxProcessModeIsAlways() )
+    // Creates the window if the black box has one
+    this->bbCreateWindow();
+    
+    // Updates its inputs
+         
+//       IOStatus s;
+         IOStatus s=UPTODATE;
+//       IOStatus s=OUTOFDATE;
+//       IOStatus s=MODIFIED;
+                 
+
+         if ( ( bbBoxProcessModeIsManual()==false )  || 
+                  ( (bbBoxProcessModeIsManual()==true) && (bbLetRecursiveExecuteManualMode==true) ) )
+         {
+                 s = bbUpdateInputs();
+         }       
+                 
+    if ( (s != UPTODATE) ||  bbBoxProcessModeIsAlways() )
       {
          // Displays the window (WxBlackbox)
          //    bbShowWindow(caller);
 
          // Actual processing (virtual)
-         this->bbProcess();
-       
-       
-         // Update the I/O statuses
-         bbComputePostProcessStatus();
+                 if ( ( bbBoxProcessModeIsManual()==false )  || 
+                          ( (bbBoxProcessModeIsManual()==true)&&(bbLetRecursiveExecuteManualMode==true) ) 
+                        )
+                       {
+                               this->bbProcess();              
+                   } // Manual analysis
+                 
+//EED ups                      if ((bbBoxProcessModeIsManual()==true) && (bbLetRecursiveExecuteManualMode==false))
+//EED ups                      {
+//EED ups                        bbSignalOutputModification(true);
+//EED ups                      }
+                 
+                 
+                 // Update the I/O statuses
+                 bbComputePostProcessStatus();
       }
     else 
       {
@@ -782,29 +776,29 @@ namespace bbtk
          {
            if (o->second->GetStatus() != UPTODATE)
              {
-               bbtkWarning("BlackBox::bbRecursiveExecute ["
-                           <<bbGetFullName()
-                           <<"] : all inputs are Up-to-date but output '"
+               bbtkWarning("BlackBox::bbRecursiveExecute: "
+                           <<"all inputs are Up-to-date but output '"
                            <<o->first<<"' is Out-of-date ???");
              }
          }
        
-        bbtkDebugMessage("process",3," -> Up-to-date : nothing to do"
+        bbtkBlackBoxDebugMessage("process",3," -> Up-to-date : nothing to do"
                         <<std::endl);
       }
 
-         this->bbShowWidget(); 
+    // Shows the window if the black box has one
+    this->bbShowWindow(); 
 
          
-    bbtkDebugMessage("process",3,
-            "<= BlackBox::bbRecursiveExecute() ["
-            <<bbGetFullName()<<"]"<<std::endl);
+    bbtkBlackBoxDebugMessage("process",3,
+            "<= BlackBox::bbRecursiveExecute()"
+            <<std::endl);
 
     bbSetExecuting(false);
     bbGlobalSetSomeBoxExecuting(wasExecuting);
 
-    return; 
 
+    return;
   }
   //=========================================================================
   
@@ -813,14 +807,10 @@ namespace bbtk
 
 
   //=========================================================================
-  /// Updates the BlackBox inputs
-  /// Calls RecursiveExecute on all BlackBoxInputConnector
-  /// \returns The maximum of final IOStatus after each input update
   IOStatus BlackBox::bbUpdateInputs()
   {
-    bbtkDebugMessageInc("process",4,
-                       "=> BlackBox::bbUpdateInputs() ["
-                       <<bbGetFullName()<<"]"
+    bbtkBlackBoxDebugMessage("process",4,
+                       "=> BlackBox::bbUpdateInputs()"
                        <<std::endl);   
 
     IOStatus s = UPTODATE;
@@ -834,40 +824,33 @@ namespace bbtk
        //if (  bbGetDescriptor()->GetInputDescriptor(i->first)->GetTypeInfo() 
        //      == typeid(Void) ) 
        //  continue;
-       bbtkDebugMessageDec("change",2,
-                           bbGetName()<<"."<<i->first
-                           <<" ["<<i->second<<"] "
-                           <<" status before update = '"
+       bbtkBlackBoxDebugMessage("change",2,
+                           "Input '"<<i->first
+                           <<"': status before update = '"
                            <<GetIOStatusString(i->second->GetStatus())
                            <<"'"<<std::endl);
        i->second->RecursiveExecute();
        IOStatus t = i->second->GetStatus();
        if (t > s) s = t;
-       bbtkDebugMessageDec("change",2,
-                           bbGetName()<<"."<<i->first
-                           <<" ["<<i->second<<"] "
-                           <<" status before process = '"
-                           <<GetIOStatusString(i->second->GetStatus())
-                           <<"'"<<std::endl);
+       bbtkBlackBoxDebugMessage("change",2,
+                                "Input '"<<i->first
+                                <<"': status before process = '"
+                                <<GetIOStatusString(i->second->GetStatus())
+                                <<"'"<<std::endl);
       }
     
-    bbtkDebugMessageDec("process",4,
-                       "<= BlackBox::bbUpdateInputs() ["
-                       <<bbGetFullName()<<"]"
-                       <<std::endl);   
-    
-    
+    bbtkBlackBoxDebugMessage("process",4,
+                       "<= BlackBox::bbUpdateInputs()"
+                       <<std::endl);
     return s;
   }
   //=========================================================================
 
   //==================================================================
-  /// Computes the final IOStatus of inputs and outputs after processing
-  void BlackBox::bbComputePostProcessStatus()
+   void BlackBox::bbComputePostProcessStatus()
   {
-    bbtkDebugMessageInc("process",4,
-                       "=> BlackBox::bbComputePostProcessStatus() ["
-                       <<bbGetFullName()<<"]"
+    bbtkBlackBoxDebugMessage("process",4,
+                       "=> BlackBox::bbComputePostProcessStatus()"
                        <<std::endl);   
 
     IOStatus new_output_status = UPTODATE;
@@ -882,43 +865,50 @@ namespace bbtk
        if (t == OUTOFDATE) new_output_status = OUTOFDATE;
        // A previously MODIFIED status turns to UPTODATE
        if (t==MODIFIED) i->second->SetStatus(UPTODATE);
-       bbtkDebugMessage("change",2,
-                        bbGetName()<<"."<<i->first<<" : "
+       bbtkBlackBoxDebugMessage("change",2,
+                        "Input '"<<i->first<<"' : "
                         << GetIOStatusString(t) << " -> "
                         << GetIOStatusString(i->second->GetStatus())
                         << std::endl);
       }
-       bbtkDebugMessage("change",2,
-                        bbGetName()<<" new output status : "
-                        << GetIOStatusString(new_output_status)
-                        <<std::endl);
+    bbtkBlackBoxDebugMessage("change",2,
+                            "New output status : "
+                            << GetIOStatusString(new_output_status)
+                            <<std::endl);
     // Update the output statuses
     OutputConnectorMapType::iterator o;
     for ( o = bbGetOutputConnectorMap().begin(); 
          o!= bbGetOutputConnectorMap().end(); ++o) 
       {
-       o->second->SetStatus(new_output_status);
+               
+//EED            if  ( ( bbBoxProcessModeIsManual()==false )  || 
+//EED                      ( (bbBoxProcessModeIsManual()==true) && (bbLetRecursiveExecuteManualMode==true) ) 
+//EED                    )
+//EED            {
+                         o->second->SetStatus(new_output_status);
+//EED            }  else  {
+//EED                    if  (( (bbBoxProcessModeIsManual()==true) && (bbLetRecursiveExecuteManualMode==false) )  ) 
+//EED                    {
+//EED                            o->second->SetStatus(UPTODATE);
+//EED                    }
+//EED            } // Manual analysis
+                         
       }
 
-    bbtkDebugMessageInc("process",4,
-                       "<= BlackBox::bbComputePostProcessStatus() ["
-                       <<bbGetFullName()<<"]"
-                       <<std::endl);   
-
+    bbtkBlackBoxDebugMessage("process",4,
+                       "<= BlackBox::bbComputePostProcessStatus()"
+                       <<std::endl);
   }
   //==================================================================
 
   //=========================================================================
-  /// Connects the input <name> to the connection c
   void BlackBox::bbConnectInput( const std::string& name, Connection* c)
   {
-    bbtkDebugMessage("connection",2,
+    bbtkBlackBoxDebugMessage("connection",2,
                        "==> BlackBox::bbConnectInput(\""
-                       <<name<<"\","<<c->GetFullName()<<") ["
-                       <<bbGetFullName()<<"]"
+                       <<name<<"\","<<c->GetFullName()<<")"
                        <<std::endl);       
 
-
     InputConnectorMapType::iterator i = bbGetInputConnectorMap().find(name);
     if (i==bbGetInputConnectorMap().end())
       {
@@ -927,26 +917,23 @@ namespace bbtk
     i->second->SetConnection(c);
     // The input *MUST* be set OUTOFDATE to update its input on next execution
     bbSetStatusAndPropagate(i->second,OUTOFDATE);
-    
-    bbtkDebugMessage("connection",2,
-                       "<== BlackBox::bbConnectInput(\""
-                       <<name<<"\","<<c->GetFullName()<<") ["
-                       <<bbGetFullName()<<"]"
-                       <<std::endl);       
 
+    bbtkBlackBoxDebugMessage("connection",2,
+                       "<== BlackBox::bbConnectInput(\""
+                       <<name<<"\","<<c->GetFullName()<<")"
+                       <<std::endl);
   }
   //=========================================================================
 
 
   //=========================================================================  
-  /// Connects the output <name> to the connection c
   void BlackBox::bbConnectOutput( const std::string& name, Connection* c)
   {
-    bbtkDebugMessage("connection",2,
-                    "==> BlackBox::bbConnectOutput(\""<<name<<"\","
-                    <<c->GetFullName()<<") ["
-                    <<bbGetFullName()<<"]"<<std::endl);       
-    
+    bbtkBlackBoxDebugMessage("connection",2,
+                            "==> BlackBox::bbConnectOutput(\""<<name<<"\","
+                            <<c->GetFullName()<<")"
+                            <<std::endl);       
+
     OutputConnectorMapType::iterator i = bbGetOutputConnectorMap().find(name);
     if (i==bbGetOutputConnectorMap().end())
       {
@@ -954,30 +941,26 @@ namespace bbtk
       }
     i->second->SetConnection(c);
 
-    bbtkDebugMessage("connection",2,
-                    "<== BlackBox::bbConnectOutput(\""<<name<<"\","
-                    <<c->GetFullName()<<") ["
-                    <<bbGetFullName()<<"]"<<std::endl);       
-
+    bbtkBlackBoxDebugMessage("connection",2,
+                            "<== BlackBox::bbConnectOutput(\""<<name<<"\","
+                            <<c->GetFullName()<<")"
+                            <<std::endl);
   }
   //=========================================================================
 
 
   //=========================================================================
-  /// Disconnects the input <name> from the connection c
-  void BlackBox::bbDisconnectInput( const std::string& name, Connection* c)
+   void BlackBox::bbDisconnectInput( const std::string& name, Connection* c)
   {
 
-    bbtkDebugMessage("connection",2,
+    bbtkBlackBoxDebugMessage("connection",2,
                     "==> BlackBox::bbDisconnectInput(\""<<name
-                    <<"\","<<c->GetFullName()<<") ["
-                    <<bbGetFullName()<<"]"
-                    <<std::endl);      
-
+                    <<"\","<<c->GetFullName()<<")"
+                    <<std::endl);
     if (!c) 
       {
 
-       bbtkDebugMessage("connection",2,"c==0"<<std::endl);     
+       bbtkBlackBoxDebugMessage("connection",2,"c==0"<<std::endl);     
        return;
       }
 
@@ -988,10 +971,9 @@ namespace bbtk
       }
     i->second->UnsetConnection(c);
 
-    bbtkDebugMessage("connection",2,
+    bbtkBlackBoxDebugMessage("connection",2,
                     "<== BlackBox::bbDisconnectInput(\""<<name
-                    <<"\","<<c->GetFullName()<<") ["
-                    <<bbGetFullName()<<"]"
+                    <<"\","<<c->GetFullName()<<")"
                     <<std::endl);      
 
   }
@@ -999,18 +981,16 @@ namespace bbtk
 
 
   //=========================================================================
-  /// Disconnects the output <name> from the connection c
-  void BlackBox::bbDisconnectOutput( const std::string& name, Connection* c)
+   void BlackBox::bbDisconnectOutput( const std::string& name, Connection* c)
   {
-    bbtkDebugMessage("connection",2,
+    bbtkBlackBoxDebugMessage("connection",2,
                     "==> BlackBox::bbDisconnectOutput(\""<<name
-                    <<"\","<<c->GetFullName()<<") ["
-                    <<bbGetFullName()<<"]"
+                    <<"\","<<c->GetFullName()<<")"
                     <<std::endl);       
     if (!c) 
       {
 
-       bbtkDebugMessage("connection",2,"c==0"<<std::endl);     
+       bbtkBlackBoxDebugMessage("connection",2,"c==0"<<std::endl);     
        return;
       }
 
@@ -1021,17 +1001,36 @@ namespace bbtk
       }
     i->second->UnsetConnection(c);
 
-    bbtkDebugMessage("connection",2,
+    bbtkBlackBoxDebugMessage("connection",2,
                     "<== BlackBox::bbDisconnectOutput(\""<<name
-                    <<"\","<<c->GetFullName()<<") ["
-                    <<bbGetFullName()<<"]"
+                    <<"\","<<c->GetFullName()<<")"
                     <<std::endl);       
   } 
   //=========================================================================
  
 
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
   //=========================================================================
-  /// Virtual
   void BlackBox::bbWriteDotInputOutputName(FILE *ff,bool inputoutput,int detail, int level)
   {
     fprintf(ff,"%s%p",bbGetTypeName().c_str(),this);
@@ -1234,8 +1233,8 @@ namespace bbtk
           const BlackBoxOutputDescriptor* id = bbGetDescriptor()->GetOutputDescriptor(ii->first); 
           tempStrTypeName=id->GetTypeName();
           SubsBrackets(tempStrTypeName);
-           std::string Name(ii->first);
-           SubsBrackets(Name);
+          std::string Name(ii->first);
+          SubsBrackets(Name);
           labelStr=labelStr+"<"+ii->first.c_str()+"> " + valueStr + Name.c_str() + "  ["+tempStrTypeName+"]";
        }
        labelStr = labelStr+ "      } }" ;
@@ -1288,35 +1287,35 @@ namespace bbtk
 
 
   //=========================================================================
-  void BlackBox::bbShowRelations(BlackBox::Pointer parentblackbox, 
+  void BlackBox::bbPrintHelp(BlackBox::Pointer parentblackbox, 
                                 int detail, int level
                                 /*,Factory *factory*/ )
   {
      
     if (this->bbGetDescriptor()->GetPackage()) 
       {
-       bbtkMessage("Help",1,"Black Box '"<<bbGetName()<<"' <"<<
+            bbtkBlackBoxMessage("help",1,"Black Box '"<<bbGetName()<<"' <"<<
                    this->bbGetDescriptor()->GetPackage()->GetName()
                    <<"::"<<this->bbGetDescriptor()->GetTypeName()<<">"<<std::endl);
       }
     else 
       {
-       bbtkMessage("Help",1,"Black Box <::"<<this->bbGetDescriptor()->GetTypeName()<<">"<<std::endl);
+            bbtkBlackBoxMessage("help",1,"Black Box <::"<<this->bbGetDescriptor()->GetTypeName()<<">"<<std::endl);
       }
     /*
     if (bbIsUpToDate())
       {
-       bbtkMessage("Help",1,"Up-to-date ["<<mMaxInputChangeTime<<","
+            bbtkBlackBoxMessage("help",1,"Up-to-date ["<<mMaxInputChangeTime<<","
                    <<mMinOutputChangeTime<<"]"<<std::endl);
       }
     else 
       {
-       bbtkMessage("Help",1,"Out-of-date ["<<mMaxInputChangeTime<<","
+            bbtkBlackBoxMessage("help",1,"Out-of-date ["<<mMaxInputChangeTime<<","
                    <<mMinOutputChangeTime<<"]"<<std::endl);
       }
     */
-    //    bbtkMessage("Help",1," "<<GetDescription()<<std::endl);
-    //    bbtkMessage("Help",1," By : "<<GetAuthor()<<std::endl);
+    //    bbtkBlackBoxMessage("help",1," "<<GetDescription()<<std::endl);
+    //    bbtkBlackBoxMessage("help",1," By : "<<GetAuthor()<<std::endl);
 
     std::vector<std::string> iname;
     std::vector<std::string> ivalue;
@@ -1328,114 +1327,132 @@ namespace bbtk
     unsigned int valuelmax = 0;
     //   unsigned int connlmax = 0;
     for ( i = mInputConnectorMap.begin(); i != mInputConnectorMap.end(); ++i ) 
-      {
-       iname.push_back(i->first);
-       if (iname.back().size()>namelmax) namelmax = iname.back().size();
-       ivalue.push_back(bbGetInputAsString(i->first));
-       if (ivalue.back().size()>valuelmax) valuelmax = ivalue.back().size();
-       std::string s("");
-       Connection* con = i->second->GetConnection();
-       if (con!=0){
-         s = con->GetOriginalBlackBoxFrom()->bbGetName();
-         s += ".";
-         s += con->GetOriginalBlackBoxFromOutput();
-       }  // if con
-       iconn.push_back(s);
-       istatus.push_back(GetIOStatusString(i->second->GetStatus()));
-      }
+    {
+          iname.push_back(i->first);
+          if (iname.back().size()>namelmax) namelmax = iname.back().size();
+          ivalue.push_back(bbGetInputAsString(i->first));
+          if (ivalue.back().size()>valuelmax) valuelmax = ivalue.back().size();
+          std::string s("");
+          Connection* con = i->second->GetConnection();
+          if (con!=0){
+             s = con->GetOriginalBlackBoxFrom()->bbGetName();
+             s += ".";
+             s += con->GetOriginalBlackBoxFromOutput();
+          }  // if con
+          iconn.push_back(s);
+          istatus.push_back(GetIOStatusString(i->second->GetStatus()));
+    }
     OutputConnectorMapType::iterator o;
     std::vector<std::string> oname;
     std::vector<std::string> ovalue;
     std::vector<std::vector<std::string> > oconn;
     std::vector<std::string> ostatus;
     for ( o = mOutputConnectorMap.begin(); o != mOutputConnectorMap.end(); ++o ) 
-      {
-       oname.push_back(o->first);
-       if (oname.back().size()>namelmax) namelmax = oname.back().size();
-       ovalue.push_back(bbGetOutputAsString(o->first));
-       if (ovalue.back().size()>valuelmax) valuelmax = ovalue.back().size();
-       std::vector<std::string> ss;
-       const std::vector<Connection*>& con 
-         = o->second->GetConnectionVector();
-       std::vector<Connection*>::const_iterator c;
-       for (c=con.begin();c!=con.end();++c) 
-         {
-           std::string s;
-           s = (*c)->GetOriginalBlackBoxTo()->bbGetName();
-           s += ".";
-           s += (*c)->GetOriginalBlackBoxToInput();
-           ss.push_back(s);
-       }  // if con
-       oconn.push_back(ss);
-       ostatus.push_back(GetIOStatusString(o->second->GetStatus()));
-      }
+    {
+          oname.push_back(o->first);
+          if (oname.back().size()>namelmax)
+          namelmax = oname.back().size();
+          ovalue.push_back(bbGetOutputAsString(o->first));
+          if (ovalue.back().size()>valuelmax) 
+          valuelmax = ovalue.back().size();
+          std::vector<std::string> ss;
+          const std::vector<Connection*>& con 
+                                   = o->second->GetConnectionVector();
+          std::vector<Connection*>::const_iterator c;
+          for (c=con.begin();c!=con.end();++c) 
+          {
+              std::string s;
+              s = (*c)->GetOriginalBlackBoxTo()->bbGetName();
+              s += ".";
+              s += (*c)->GetOriginalBlackBoxToInput();
+              ss.push_back(s);
+           }  // if con
+           oconn.push_back(ss);
+           ostatus.push_back(GetIOStatusString(o->second->GetStatus()));
+    }
 
     if (iname.size()) 
-      bbtkMessage("Help",1," * Inputs : "<<std::endl);
+      bbtkBlackBoxMessage("help",1," * Inputs : "<<std::endl);
     else 
-      bbtkMessage("Help",1," * No inputs"<<std::endl);
+      bbtkBlackBoxMessage("help",1," * No inputs"<<std::endl);
 
     std::vector<std::string>::iterator i1,i2,i3,i4;
     for (i1=iname.begin(),i2=ivalue.begin(),i3=iconn.begin(),i4=istatus.begin();
-        i1!=iname.end(),i2!=ivalue.end(),i3!=iconn.end(),i4!=istatus.end();
-        ++i1,++i2,++i3,++i4)
-      {
-       std::string name(*i1);
-       name += "'";
-       name.append(1+namelmax-name.size(),' ');
-       std::string value(*i2);
-       value += "'";
-       value.append(1+valuelmax-value.size(),' ');
-       if (i3->size()) 
-         bbtkMessage("Help",1,"    '"<<name<<" = '"<<value<<" <-- '"
-                     <<*i3<<"'");
-       else 
-         bbtkMessage("Help",1,"    '"<<name<<" = '"<<value);
-       bbtkMessage("Help",1," ["<<*i4<<"]"<<std::endl);
-      }
+            i1!=iname.end(),i2!=ivalue.end(),i3!=iconn.end(),i4!=istatus.end();
+          ++i1,++i2,++i3,++i4)
+     {
+           std::string name(*i1);
+           name += "'";
+           name.append(1+namelmax-name.size(),' ');
+           std::string value(*i2);
+           value += "'";
+           value.append(1+valuelmax-value.size(),' ');
+           if (i3->size()) 
+             bbtkBlackBoxMessage("help",1,"    '"<<name<<" = '"<<value<<" <-- '" <<*i3<<"'");
+           else 
+             bbtkBlackBoxMessage("help",1,"    '"<<name<<" = '"<<value);
+           bbtkBlackBoxMessage("help",1," ["<<*i4<<"]"<<std::endl);
+     }
 
     if (oname.size()) 
-      bbtkMessage("Help",1," * Outputs : "<<std::endl);
+       bbtkBlackBoxMessage("help",1," * Outputs : "<<std::endl);
     else 
-      bbtkMessage("Help",1," * No outputs"<<std::endl);
+       bbtkBlackBoxMessage("help",1," * No outputs"<<std::endl);
 
     std::vector<std::vector<std::string> >::iterator i5;
 
     for (i1=oname.begin(),i2=ovalue.begin(),i5=oconn.begin(),i4=ostatus.begin();
-        i1!=oname.end(),i2!=ovalue.end(),i5!=oconn.end(),i4!=ostatus.end();
-        ++i1,++i2,++i4,++i5)
-      {
-       std::string name(*i1);
-       name += "'";
-       name.append(1+namelmax-name.size(),' ');
-       std::string value(*i2);
-       value += "'";
-       value.append(1+valuelmax-value.size(),' ');
-       if (!(*i5).size())
-         bbtkMessage("Help",1,"    '"<<name<<" = '"<<value);
-       else 
-         {
-           std::string pref = "    '"+name+" = '"+value;
-           for (i3=i5->begin();i3!=i5->end();++i3)
-             {
-               bbtkMessage("Help",1,pref<<" --> '"<<*i3<<"'");
-               pref.replace(0,pref.size(),pref.size(),' ');
-             }
-         }
-       bbtkMessage("Help",1," ["<<*i4<<"]"<<std::endl);
-      }
+            i1!=oname.end(),i2!=ovalue.end(),i5!=oconn.end(),i4!=ostatus.end();
+          ++i1,++i2,++i4,++i5)
+    {
+           std::string name(*i1);
+           name += "'";
+           name.append(1+namelmax-name.size(),' ');
+           std::string value(*i2);
+           value += "'";
+           value.append(1+valuelmax-value.size(),' ');
+           if (!(*i5).size())
+             bbtkBlackBoxMessage("help",1,"    '"<<name<<" = '"<<value);
+           else 
+           {
+              std::string pref = "    '"+name+" = '"+value;
+              for (i3=i5->begin();i3!=i5->end();++i3)
+              {
+                     bbtkBlackBoxMessage("help",1,pref<<" --> '"<<*i3<<"'");
+                     pref.replace(0,pref.size(),pref.size(),' ');
+              }
+           }
+           bbtkBlackBoxMessage("help",1," ["<<*i4<<"]"<<std::endl);
+    }
 
    }
   //=========================================================================
 
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
   static bool bbmgGlobalProcessingExecutionList = false;
 
   //=========================================================================
    void BlackBox::bbGlobalProcessExecutionList()
    {   
-     bbtkDebugMessageInc("process",3,
-                        "=> BlackBox::bbGlobalProcessExecutionList()"
-                        <<std::endl);    
+     bbtkDebugMessage("process",3,
+                     "=> BlackBox::bbGlobalProcessExecutionList()"
+                     <<std::endl);    
      if (bbmgGlobalProcessingExecutionList) 
        {
         bbtkDebugMessage("process",3,"BlackBox::bbGlobalProcessExecutionList() reentered !");
@@ -1452,8 +1469,8 @@ namespace bbtk
         if (p.lock())
           {
             bbtkDebugMessage("process",4,
-                             " -> Executing "<<
-                             p.lock()->bbGetFullName()<<std::endl);
+                             " -> Executing '"<<
+                             p.lock()->bbGetName()<<"'"<<std::endl);
             p.lock()->bbExecute(true);
           }
         else 
@@ -1463,11 +1480,12 @@ namespace bbtk
        }
      
      bbmgExecutionList.clear();
-     bbtkDebugMessageDec("process",3,
+     bbtkDebugMessage("process",3,
                         "<= BlackBox::bbGlobalProcessExecutionList()"
                         <<std::endl);     
      
      bbmgGlobalProcessingExecutionList = false;
+
      
    }
   //=========================================================================
@@ -1494,7 +1512,7 @@ namespace bbtk
 
   void BlackBox::bbGlobalAddToExecutionList( BlackBox::Pointer b )
   {  
-    bbtkDebugMessage("process",3,"* bbGlobalAddToExecutionList("<<b->bbGetFullName()<<")"<<std::endl);
+    bbtkDebugMessage("process",3,"* bbGlobalAddToExecutionList("<<b->bbGetName()<<")"<<std::endl);
     if (bbmgGlobalProcessingExecutionList) 
       {
        bbtkDebugMessage("process",3,"bbGlobalAddToExecutionList called inside bbGlobalProcessExecutionList !");
@@ -1508,20 +1526,11 @@ namespace bbtk
   //=========================================================================
   void BlackBox::Check(bool recursive)
   {
-    bbtkMessage("debug",1,"*** Checking Black Box "<<(void*)this<<" ["<<bbGetFullName()
-               <<"] ... OK"<<std::endl);
+    bbtkBlackBoxMessage("debug",1,"*** Checking"
+                       <<" ... OK"<<std::endl);
   }
   //=========================================================================
 
-  void BlackBox::bbUserOnShowWidget(std::string nameInput)
-  {
-         bbtk::BlackBoxInputConnector *cc;
-         cc = this->bbGetInputConnectorMap().find( nameInput.c_str() )->second;
-         if (cc->GetConnection()!=NULL) 
-         {
-                 cc->GetConnection()->GetBlackBoxFrom()->bbUserOnShow();
-         }
-  }