]> Creatis software - bbtk.git/blobdiff - kernel/src/bbtkExecuter.cxx
*** empty log message ***
[bbtk.git] / kernel / src / bbtkExecuter.cxx
index ee60d2e992e98ea035c9615581be167c7e39777b..9fa297fef97255169453154daae0800cf02c359c 100644 (file)
@@ -3,8 +3,8 @@
   Program:   bbtk
   Module:    $RCSfile: bbtkExecuter.cxx,v $ $
   Language:  C++
-  Date:      $Date: 2008/04/22 06:59:31 $
-  Version:   $Revision: 1.19 $
+  Date:      $Date: 2008/04/22 09:40:10 $
+  Version:   $Revision: 1.20 $
 
   Copyright (c) CREATIS (Centre de Recherche et d'Applications en Traitement de
   l'Image). All rights reserved. See Doc/License.txt or
@@ -206,7 +206,7 @@ namespace bbtk
   void Executer::EndDefine ()
   {
     bbtkDebugMessageInc("Kernel",9,"Executer::EndDefine(\""
-                        <<Current()->GetTypeName()<<"\")" 
+                        <<GetCurrentDescriptor()->GetTypeName()<<"\")" 
                         <<std::endl);
     // Does current package exist ?
     Package::Pointer p;
@@ -231,7 +231,7 @@ namespace bbtk
       {
        p = mOpenPackage.back().lock();
       }
-    p->RegisterBlackBox(Current());
+    p->RegisterBlackBox(GetCurrentDescriptor());
     
     mOpenDefinition.pop_back();
   }
@@ -242,23 +242,23 @@ namespace bbtk
   {
     if (kind=="ADAPTOR")
       {
-       Current()->AddToCategory("adaptor");
-       Current()->SetKind(bbtk::BlackBoxDescriptor::ADAPTOR);
+       GetCurrentDescriptor()->AddToCategory("adaptor");
+       GetCurrentDescriptor()->SetKind(bbtk::BlackBoxDescriptor::ADAPTOR);
       }
     else if (kind=="DEFAULT_ADAPTOR")
       {
-       Current()->AddToCategory("adaptor");
-       Current()->SetKind(bbtk::BlackBoxDescriptor::DEFAULT_ADAPTOR);
+       GetCurrentDescriptor()->AddToCategory("adaptor");
+       GetCurrentDescriptor()->SetKind(bbtk::BlackBoxDescriptor::DEFAULT_ADAPTOR);
       }
     if (kind=="GUI")
       {
-       Current()->AddToCategory("gui");
-       Current()->SetKind(bbtk::BlackBoxDescriptor::GUI);
+       GetCurrentDescriptor()->AddToCategory("gui");
+       GetCurrentDescriptor()->SetKind(bbtk::BlackBoxDescriptor::GUI);
       }
     else if (kind=="DEFAULT_GUI")
       {
-       Current()->AddToCategory("gui");
-       Current()->SetKind(bbtk::BlackBoxDescriptor::DEFAULT_GUI);
+       GetCurrentDescriptor()->AddToCategory("gui");
+       GetCurrentDescriptor()->SetKind(bbtk::BlackBoxDescriptor::DEFAULT_GUI);
       }
     else
       {
@@ -273,14 +273,14 @@ namespace bbtk
   void Executer::Create ( const std::string& nodeType, 
                           const std::string& nodeName)
   {
-     Current()->Add(nodeType,nodeName);
+     GetCurrentDescriptor()->Add(nodeType,nodeName);
   }
   //=======================================================================
 
   //=======================================================================
   void Executer::Destroy(const std::string &boxName)
   {
-    Current()->Remove(boxName,true);
+    GetCurrentDescriptor()->Remove(boxName,true);
   }
   //=======================================================================
 
@@ -290,7 +290,7 @@ namespace bbtk
                           const std::string &nodeTo, 
                           const std::string &inputLabel)
   {
-    Current()->Connect(nodeFrom, outputLabel, nodeTo, inputLabel);
+    GetCurrentDescriptor()->Connect(nodeFrom, outputLabel, nodeTo, inputLabel);
   }
   //=======================================================================
 
@@ -298,16 +298,16 @@ namespace bbtk
   void Executer::Execute (const std::string &nodeName) 
   {
     // if in root
-    if (Current()==GetWorkspace()) 
+    if (GetCurrentDescriptor()==GetWorkspace()) 
      {
         if (!mNoExecMode) 
         {
-           Current()->GetPrototype()->bbGetBlackBox(nodeName)->bbExecute(true);
+           GetCurrentDescriptor()->GetPrototype()->bbGetBlackBox(nodeName)->bbExecute(true);
         }
      }
      else 
      {
-        Current()->AddToExecutionList(nodeName) ;
+        GetCurrentDescriptor()->AddToExecutionList(nodeName) ;
      }
   }
   //=======================================================================
@@ -319,7 +319,7 @@ namespace bbtk
                                const std::string& help)
   {
     // If the input is defined in the Root box
-    if (Current()==GetWorkspace()) 
+    if (GetCurrentDescriptor()==GetWorkspace()) 
       {
       // If the dialog mode is set to NoDialog
       // and the user passed the name in the Inputs map 
@@ -361,7 +361,7 @@ namespace bbtk
 #endif
     }
 
-    Current()->DefineInput(name,box,input,help);
+    GetCurrentDescriptor()->DefineInput(name,box,input,help);
 
   }
   //=======================================================================
@@ -372,7 +372,7 @@ namespace bbtk
                                  const std::string &output,
                                  const std::string& help)
   {
-    Current()->DefineOutput(name,box,output,help);
+    GetCurrentDescriptor()->DefineOutput(name,box,output,help);
   }
   //=======================================================================
 
@@ -381,7 +381,7 @@ namespace bbtk
                       const std::string &input,
                       const std::string &value)
   {
-    BlackBox::Pointer b = Current()->GetPrototype()->bbGetBlackBox(box);
+    BlackBox::Pointer b = GetCurrentDescriptor()->GetPrototype()->bbGetBlackBox(box);
     // Looks for the adaptor
 
     if ( b->bbGetInputType(input) !=  typeid(std::string) ) 
@@ -414,7 +414,7 @@ namespace bbtk
   std::string Executer::Get(const std::string &box,
                             const std::string &output)
   {
-    BlackBox::Pointer b = Current()->GetPrototype()->bbGetBlackBox(box);
+    BlackBox::Pointer b = GetCurrentDescriptor()->GetPrototype()->bbGetBlackBox(box);
     // Looks for the adaptor
     if (b->bbGetOutputType(output) != typeid(std::string)) 
       {
@@ -457,21 +457,21 @@ namespace bbtk
   //=======================================================================
   void Executer::Author(const std::string &authorName)
   {
-    Current()->AddToAuthor(authorName,Current()==GetWorkspace());
+    GetCurrentDescriptor()->AddToAuthor(authorName,GetCurrentDescriptor()==GetWorkspace());
   }
   //=======================================================================
 
   //=======================================================================
   void Executer::Category(const std::string &category)
   {
-    Current()->AddToCategory(category,Current()==GetWorkspace());
+    GetCurrentDescriptor()->AddToCategory(category,GetCurrentDescriptor()==GetWorkspace());
   }
   //=======================================================================
 
   //=======================================================================
   void Executer::Description(const std::string &d)
   {
-    Current()->AddToDescription(d,Current()==GetWorkspace());
+    GetCurrentDescriptor()->AddToDescription(d,GetCurrentDescriptor()==GetWorkspace());
   }
   //=======================================================================
 
@@ -480,8 +480,8 @@ namespace bbtk
   void Executer::PrintBoxes()
   {
     bbtkMessageInc("Help",1,"The black box descriptor \""
-                   <<Current()->GetTypeName()<<"\" contains : "<<std::endl);
-    Current()->PrintBlackBoxes();
+                   <<GetCurrentDescriptor()->GetTypeName()<<"\" contains : "<<std::endl);
+    GetCurrentDescriptor()->PrintBlackBoxes();
     bbtkDecTab("Help",1);
  }
   //=======================================================================
@@ -565,11 +565,11 @@ namespace bbtk
     BlackBox::Pointer blackbox;
     if (nameblackbox==".")
     {
-       blackbox = Current()->GetPrototype();
+       blackbox = GetCurrentDescriptor()->GetPrototype();
     }
     else
     {
-       blackbox = Current()->GetPrototype()->bbFindBlackBox(nameblackbox);
+       blackbox = GetCurrentDescriptor()->GetPrototype()->bbFindBlackBox(nameblackbox);
     }
     
     std::string page;
@@ -640,11 +640,11 @@ namespace bbtk
     BlackBox::Pointer blackbox;
     if (nameblackbox.compare(".")==0)
       {
-       blackbox=Current()->GetPrototype();
+       blackbox=GetCurrentDescriptor()->GetPrototype();
       } 
     else 
       {
-       blackbox = Current()->GetPrototype()->bbFindBlackBox(nameblackbox);
+       blackbox = GetCurrentDescriptor()->GetPrototype()->bbFindBlackBox(nameblackbox);
       }
     
     if (blackbox)
@@ -681,8 +681,8 @@ namespace bbtk
   ///
   void Executer::Print(const std::string &str)
   {  
-    if (GetNoExecMode() &&  (Current()==GetWorkspace()) ) return;
-    if (Current()!=GetWorkspace()) return;
+    if (GetNoExecMode() &&  (GetCurrentDescriptor()==GetWorkspace()) ) return;
+    if (GetCurrentDescriptor()!=GetWorkspace()) return;
 
     bbtkDebugMessageInc("Interpreter",9,"Interpreter::Print(\""<<str<<"\")"<<std::endl);
 
@@ -741,7 +741,6 @@ namespace bbtk
     std::vector<std::string>::iterator i;
     for (i= chains.begin(); i!=chains.end(); ++i) 
       {
-       //  bbtkMessage("Echo",1,*i);
        Utilities::SubsBackslashN(*i);
        bbtkMessage("Output",1,*i);
       }