]> Creatis software - bbtk.git/blobdiff - kernel/src/bbtkBlackBox.cxx
Fixed Window deletion mechanism
[bbtk.git] / kernel / src / bbtkBlackBox.cxx
index fbf94a0f6e694b477c591038a85eeb197ac8b6d3..795d8d490e6ac45e6425f081e6308d37108782ec 100644 (file)
@@ -2,8 +2,8 @@
   Program:   bbtk
   Module:    $RCSfile: bbtkBlackBox.cxx,v $
   Language:  C++
-  Date:      $Date: 2009/05/18 10:45:40 $
-  Version:   $Revision: 1.45 $
+  Date:      $Date: 2009/05/28 08:12:05 $
+  Version:   $Revision: 1.46 $
 =========================================================================*/
 
 /* ---------------------------------------------------------------------
@@ -114,9 +114,9 @@ namespace bbtk
     bbmParent()
     
   {
-    bbtkDebugMessage("object",4,"==> BlackBox::BlackBox(\""
+    bbtkBlackBoxDebugMessage("object",4,"==> BlackBox::BlackBox(\""
                     <<name<<"\")"<<std::endl);
-    bbtkDebugMessage("object",4,"<== BlackBox::BlackBox(\""
+    bbtkBlackBoxDebugMessage("object",4,"<== BlackBox::BlackBox(\""
                     <<name<<"\")"<<std::endl);
   }
   //=========================================================================
@@ -136,10 +136,10 @@ namespace bbtk
     bbmParent()
     
   {
-    bbtkDebugMessage("object",4,"==> BlackBox::BlackBox("
+    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);
   }
@@ -149,10 +149,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);
   }
   //=========================================================================
@@ -196,13 +196,13 @@ 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;
   }
   //=========================================================================
@@ -212,11 +212,12 @@ namespace bbtk
   /// 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;
   }
   //=========================================================================
@@ -226,11 +227,12 @@ namespace bbtk
   ///  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;
   }
   //=========================================================================
@@ -239,11 +241,12 @@ namespace bbtk
   ///  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;
   }
   //=========================================================================
@@ -253,16 +256,18 @@ namespace bbtk
   /// 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>());
       }                                                                        
@@ -271,11 +276,11 @@ 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);  
+
   }
   //=========================================================================
 
@@ -284,7 +289,7 @@ namespace bbtk
   /// Desallocates the i/o connectors of the black box
   void BlackBox::bbDesallocateConnectors()
   {
-    bbtkDebugMessageInc("Kernel",8,
+    bbtkBlackBoxDebugMessage("kernel",8,
                        "BlackBox::bbDesallocateConnectors()"
                        <<std::endl);                                   
 
@@ -292,18 +297,18 @@ 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);  
 
   }
   //=========================================================================
@@ -313,10 +318,10 @@ namespace bbtk
   /// 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(); 
@@ -325,7 +330,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
@@ -336,11 +341,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);
 
   }
   //=========================================================================
@@ -364,11 +369,10 @@ namespace bbtk
   /// User overloadable destruction method of a black box
   void BlackBox::bbUserDelete() 
   {   
-    bbtkDebugMessage("process",5,
-                    "=> BlackBox::bbUserDelete() ["
-                    <<bbGetFullName()<<"]"
-                    <<" : not overloaded; using standard deletion"
-                    <<std::endl);
+    bbtkBlackBoxDebugMessage("process",5,
+                            "=> BlackBox::bbUserDelete()"
+                            <<" : not overloaded; using standard deletion"
+                            <<std::endl);
     delete this;
   }
   //=========================================================================
@@ -442,7 +446,7 @@ namespace bbtk
   void BlackBox::bbSetInputChangeTime(BlackBoxInputConnector* c, 
                                      const ChangeTime& t)
   {
-    bbtkDebugMessage("change",1,
+    bbtkBlackBoxDebugMessage("change",1,
                     "==> BlackBox::bbSetInputChangeTime("<<c<<","<<t<<") ["
                     <<bbGetFullName()<<"]"<<std::endl);
     
@@ -461,7 +465,7 @@ namespace bbtk
                       (c==bbGetInputConnectorMap().find("BoxExecute")->second))
                     && (bbCanReact() ) )
                  {
-                   bbtkDebugMessage("change",2,
+                   bbtkBlackBoxDebugMessage("change",2,
                                     "an input of "
                                     <<bbGetFullName()
                                     <<" changed and box is in Reactive mode or BoxExecute input changed : adding it to the global execution list"
@@ -489,7 +493,7 @@ namespace bbtk
   void BlackBox::bbSetOutputChangeTime(BlackBoxOutputConnector* c, 
                                       const ChangeTime& t)
   {
-    bbtkDebugMessage("change",1,
+    bbtkBlackBoxDebugMessage("change",1,
                     "==> BlackBox::bbSetOutputChangeTime("<<c<<","<<t<<") ["
                     <<bbGetFullName()<<"]"<<std::endl);
     
@@ -550,10 +554,10 @@ namespace bbtk
   void BlackBox::bbSetStatusAndPropagate(BlackBoxInputConnector* c,
                                         IOStatus s)
   {
-    bbtkDebugMessageInc("change",5,
-                       "=> BlackBox::bbSetStatusAndPropagate(input,"
-                       <<GetIOStatusString(s)<<") ["
-                       <<bbGetFullName()<<"]"<<std::endl);
+    bbtkBlackBoxDebugMessage("change",5,
+                            "=> BlackBox::bbSetStatusAndPropagate(input,"
+                            <<GetIOStatusString(s)<<")"
+                            <<std::endl);
 
     if (s==UPTODATE) bbtkError("bbSetStatusAndPropagate with status UPTODATE!");
     c->SetStatus(s);
@@ -581,13 +585,13 @@ namespace bbtk
           (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);
+    bbtkBlackBoxDebugMessage("change",5,
+                            "<= BlackBox::bbSetStatusAndPropagate(input)"
+                            <<std::endl);
   }
   //=========================================================================
 
@@ -595,10 +599,10 @@ 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(); 
@@ -617,9 +621,9 @@ namespace bbtk
 
     if (reaction) bbGlobalProcessExecutionList();
 
-    bbtkDebugMessageDec("change",5,
-                       "<= BlackBox::bbSignalOutputModification() ["
-                       <<bbGetFullName()<<"]"<<std::endl);
+    bbtkBlackBoxDebugMessage("change",5,
+                            "<= BlackBox::bbSignalOutputModification()"
+                            <<std::endl);
     
   }  
   //=========================================================================   
@@ -627,10 +631,10 @@ namespace bbtk
   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);
@@ -656,10 +660,10 @@ namespace bbtk
        if (reaction) bbGlobalProcessExecutionList();
        //      }
 
-    bbtkDebugMessageDec("change",5,
-                       "<= BlackBox::bbSignalOutputModification("
-                       <<output<<") ["
-                       <<bbGetFullName()<<"]"<<std::endl);
+       bbtkBlackBoxDebugMessage("change",5,
+                            "<= BlackBox::bbSignalOutputModification("
+                            <<output<<")"
+                            <<std::endl);
     
   }  
   //=========================================================================   
@@ -667,9 +671,9 @@ namespace bbtk
   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;
@@ -701,9 +705,9 @@ namespace bbtk
            //  }
       }
 
-    bbtkDebugMessageDec("change",5,
-                       "<= BlackBox::bbSignalOutputModification(vector of outputs) ["
-                       <<bbGetFullName()<<"]"<<std::endl);
+    bbtkBlackBoxDebugMessage("change",5,
+                            "<= BlackBox::bbSignalOutputModification(vector of outputs)"
+                            <<std::endl);
 
   }  
   //=========================================================================   
@@ -718,15 +722,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;
       }
@@ -735,7 +739,7 @@ namespace bbtk
     // If execution frozen : return
     if (bbGlobalGetFreezeExecution()) 
       {
-       bbtkDebugMessage("process",2,
+       bbtkBlackBoxDebugMessage("process",2,
                         " -> FreezeExecution global flag is 'true' : abort execution"<<std::endl);
       }
 
@@ -747,19 +751,19 @@ namespace bbtk
     // Calls the main recursive execution method 
     bbRecursiveExecute(Connection::Pointer());
 
-    bbtkDebugMessageDec("process",2,
-                       "<= BlackBox::bbExecute() ["
-                       <<bbGetFullName()<<"]"<<std::endl);
+    bbtkBlackBoxDebugMessage("process",2,
+                            "<= BlackBox::bbExecute()"
+                            <<std::endl);
   }
   //=========================================================================
 
   //=========================================================================
   void BlackBox::bbInitializeProcessing()
   {
-    std::cout << "INIT BEFORE TEST"<<bbGetFullName()<<std::endl;
     if (!bbmInitialized) 
       {
-       std::cout << "INIT "<<bbGetFullName()<<std::endl;
+       bbtkBlackBoxDebugMessage("process",2,"** Initialize processing"
+                                <<std::endl);
        this->bbRecursiveInitializeProcessing();
        bbmInitialized = true;
       }
@@ -771,7 +775,8 @@ namespace bbtk
   {
     if (bbmInitialized) 
       {
-       std::cout << "FINI "<<bbGetFullName()<<std::endl;
+       bbtkBlackBoxDebugMessage("process",2,"** Finalize processing"
+                                <<std::endl);
        this->bbRecursiveFinalizeProcessing();
        bbmInitialized = false;
       }
@@ -783,15 +788,15 @@ namespace bbtk
   /// 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; 
       }
@@ -831,14 +836,13 @@ 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);
       }
 
@@ -846,9 +850,9 @@ namespace bbtk
     this->bbShowWindow(); 
 
          
-    bbtkDebugMessage("process",3,
-            "<= BlackBox::bbRecursiveExecute() ["
-            <<bbGetFullName()<<"]"<<std::endl);
+    bbtkBlackBoxDebugMessage("process",3,
+            "<= BlackBox::bbRecursiveExecute()"
+            <<std::endl);
 
     bbSetExecuting(false);
     bbGlobalSetSomeBoxExecuting(wasExecuting);
@@ -868,9 +872,8 @@ namespace bbtk
   /// \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;
@@ -884,26 +887,23 @@ 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()<<"]"
+    bbtkBlackBoxDebugMessage("process",4,
+                       "<= BlackBox::bbUpdateInputs()"
                        <<std::endl);   
     
     
@@ -915,9 +915,8 @@ namespace bbtk
   /// Computes the final IOStatus of inputs and outputs after processing
   void BlackBox::bbComputePostProcessStatus()
   {
-    bbtkDebugMessageInc("process",4,
-                       "=> BlackBox::bbComputePostProcessStatus() ["
-                       <<bbGetFullName()<<"]"
+    bbtkBlackBoxDebugMessage("process",4,
+                       "=> BlackBox::bbComputePostProcessStatus()"
                        <<std::endl);   
 
     IOStatus new_output_status = UPTODATE;
@@ -932,16 +931,16 @@ 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(); 
@@ -950,9 +949,8 @@ namespace bbtk
        o->second->SetStatus(new_output_status);
       }
 
-    bbtkDebugMessageInc("process",4,
-                       "<= BlackBox::bbComputePostProcessStatus() ["
-                       <<bbGetFullName()<<"]"
+    bbtkBlackBoxDebugMessage("process",4,
+                       "<= BlackBox::bbComputePostProcessStatus()"
                        <<std::endl);   
 
   }
@@ -962,10 +960,9 @@ namespace bbtk
   /// 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);       
 
 
@@ -978,10 +975,9 @@ namespace bbtk
     // The input *MUST* be set OUTOFDATE to update its input on next execution
     bbSetStatusAndPropagate(i->second,OUTOFDATE);
     
-    bbtkDebugMessage("connection",2,
+    bbtkBlackBoxDebugMessage("connection",2,
                        "<== BlackBox::bbConnectInput(\""
-                       <<name<<"\","<<c->GetFullName()<<") ["
-                       <<bbGetFullName()<<"]"
+                       <<name<<"\","<<c->GetFullName()<<")"
                        <<std::endl);       
 
   }
@@ -992,10 +988,10 @@ namespace bbtk
   /// 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())
@@ -1004,10 +1000,10 @@ 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);       
 
   }
   //=========================================================================
@@ -1018,16 +1014,15 @@ namespace bbtk
   void BlackBox::bbDisconnectInput( const std::string& name, Connection* c)
   {
 
-    bbtkDebugMessage("connection",2,
+    bbtkBlackBoxDebugMessage("connection",2,
                     "==> BlackBox::bbDisconnectInput(\""<<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;
       }
 
@@ -1038,10 +1033,9 @@ namespace bbtk
       }
     i->second->UnsetConnection(c);
 
-    bbtkDebugMessage("connection",2,
+    bbtkBlackBoxDebugMessage("connection",2,
                     "<== BlackBox::bbDisconnectInput(\""<<name
-                    <<"\","<<c->GetFullName()<<") ["
-                    <<bbGetFullName()<<"]"
+                    <<"\","<<c->GetFullName()<<")"
                     <<std::endl);      
 
   }
@@ -1052,15 +1046,14 @@ namespace bbtk
   /// Disconnects the output <name> from the 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;
       }
 
@@ -1071,10 +1064,9 @@ namespace bbtk
       }
     i->second->UnsetConnection(c);
 
-    bbtkDebugMessage("connection",2,
+    bbtkBlackBoxDebugMessage("connection",2,
                     "<== BlackBox::bbDisconnectOutput(\""<<name
-                    <<"\","<<c->GetFullName()<<") ["
-                    <<bbGetFullName()<<"]"
+                    <<"\","<<c->GetFullName()<<")"
                     <<std::endl);       
   } 
   //=========================================================================
@@ -1345,28 +1337,28 @@ namespace bbtk
      
     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;
@@ -1421,9 +1413,9 @@ namespace bbtk
       }
 
     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();
@@ -1437,17 +1429,17 @@ namespace bbtk
        value += "'";
        value.append(1+valuelmax-value.size(),' ');
        if (i3->size()) 
-         bbtkMessage("Help",1,"    '"<<name<<" = '"<<value<<" <-- '"
+         bbtkBlackBoxMessage("Help",1,"    '"<<name<<" = '"<<value<<" <-- '"
                      <<*i3<<"'");
        else 
-         bbtkMessage("Help",1,"    '"<<name<<" = '"<<value);
-       bbtkMessage("Help",1," ["<<*i4<<"]"<<std::endl);
+         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;
 
@@ -1462,17 +1454,17 @@ namespace bbtk
        value += "'";
        value.append(1+valuelmax-value.size(),' ');
        if (!(*i5).size())
-         bbtkMessage("Help",1,"    '"<<name<<" = '"<<value);
+         bbtkBlackBoxMessage("Help",1,"    '"<<name<<" = '"<<value);
        else 
          {
            std::string pref = "    '"+name+" = '"+value;
            for (i3=i5->begin();i3!=i5->end();++i3)
              {
-               bbtkMessage("Help",1,pref<<" --> '"<<*i3<<"'");
+               bbtkBlackBoxMessage("Help",1,pref<<" --> '"<<*i3<<"'");
                pref.replace(0,pref.size(),pref.size(),' ');
              }
          }
-       bbtkMessage("Help",1," ["<<*i4<<"]"<<std::endl);
+       bbtkBlackBoxMessage("Help",1," ["<<*i4<<"]"<<std::endl);
       }
 
    }
@@ -1483,9 +1475,9 @@ namespace bbtk
   //=========================================================================
    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 !");
@@ -1502,8 +1494,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 
@@ -1513,7 +1505,7 @@ namespace bbtk
        }
      
      bbmgExecutionList.clear();
-     bbtkDebugMessageDec("process",3,
+     bbtkDebugMessage("process",3,
                         "<= BlackBox::bbGlobalProcessExecutionList()"
                         <<std::endl);     
      
@@ -1544,7 +1536,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 !");
@@ -1558,20 +1550,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();
-         }
-  }