]> Creatis software - bbtk.git/commitdiff
#3508 ConcatString_tool Reactivity 2
authorEduardo DAVILA <davila@creatis.insa-lyon.fr>
Thu, 10 Aug 2023 16:28:32 +0000 (18:28 +0200)
committerEduardo DAVILA <davila@creatis.insa-lyon.fr>
Thu, 10 Aug 2023 16:28:32 +0000 (18:28 +0200)
kernel/src/bbtkAtomicBlackBoxDescriptor.cxx
kernel/src/bbtkBlackBox.cxx
kernel/src/bbtkComplexBlackBox.cxx
kernel/src/bbtkComplexBlackBoxDescriptor.cxx
packages/std/src/bbstdConcatStrings_tool.cxx
packages/std/src/bbstdConcatStrings_tool.h
packages/std/src/bbstdExecBbiCommand.cxx
packages/std/src/bbstdMagicBox.cxx
packages/vtk/src/bbvtkSurfaceTexture.cxx
packages/vtk/src/bbvtkUpdateRender.cxx
packages/wx/src/bbwxOutputText.xml

index aafb10de89ee218cb0d80db3a641ec309c4127d0..5d33daaedf3b0d6e5ec50108bcde6781d47c3c6f 100644 (file)
@@ -52,7 +52,7 @@ namespace bbtk
        bbtk::AtomicBlackBoxInputDescriptor
        (typeid(AtomicBlackBoxDescriptor),
        "BoxProcessMode",
-       "Sets the processing mode of the box (Pipeline | Always | Reactive | Manual)",
+       "(Default Pipeline) -  Sets the processing mode of the box (Pipeline | Always | Reactive | Manual)",
        "",
        new bbtk::AtomicBlackBoxTGetFunctor<BlackBox,std::string,std::string>(&BlackBox::bbGetInputBoxProcessMode), 
        new bbtk::AtomicBlackBoxTSetFunctor<BlackBox,std::string,std::string>(&BlackBox::bbSetInputBoxProcessMode) ) );
index 03a2054a4c35053b4adf5b2ac539c40a2f5abb58..3bd38f7bb40276dd126a9067e15f816f7b889708 100644 (file)
@@ -731,7 +731,6 @@ namespace bbtk
 //       IOStatus s=OUTOFDATE;
 //       IOStatus s=MODIFIED;
                  
-
          if ( ( bbBoxProcessModeIsManual()==false )  || 
                   ( (bbBoxProcessModeIsManual()==true) && (bbLetRecursiveExecuteManualMode==true) ) )
          {
@@ -748,9 +747,17 @@ namespace bbtk
                           ( (bbBoxProcessModeIsManual()==true)&&(bbLetRecursiveExecuteManualMode==true) ) 
                         )
                        {
-//   printf("EED BlackBox::bbRecursiveExecute bbProcess start %s \n", bbGetFullName().c_str() );
+                
+//auto start = std::chrono::high_resolution_clock::now();
+//printf("EED BlackBox::bbRecursiveExecute bbProcess start %s \n", bbGetFullName().c_str() );
+                
                                this->bbProcess();              
-//   printf("EED BlackBox::bbRecursiveExecute bbProcess end %s \n", bbGetFullName().c_str() );
+                
+//auto stop       = std::chrono::high_resolution_clock::now();
+//auto duration   = duration_cast<std::chrono::microseconds>(stop - start);
+//printf("EED BlackBox::bbRecursiveExecute bbProcess time= %ld  %s \n", duration.count() , bbGetFullName().c_str() );
+//printf("EED BlackBox::bbRecursiveExecute bbProcess end %s \n", bbGetFullName().c_str() );
+
                    } // Manual analysis
                  
 //EED ups                      if ((bbBoxProcessModeIsManual()==true) && (bbLetRecursiveExecuteManualMode==false))
index 195b53a222040423bd4389139ebaf3fde5e904ef..0e823e0360a5011bc763203e732aa3b3ef813329 100644 (file)
@@ -570,14 +570,12 @@ namespace bbtk
   {
     bbtkBlackBoxDebugMessage("kernel",9,
                        "ComplexBlackBox::GetBlackBox(\""<<name<<"\")"
-                            <<std::endl);  
-
+                            <<std::endl);
     BlackBoxMapType::iterator i = mBlackBoxMap.find(name);
     if ( i == mBlackBoxMap.end() ) 
-      {
-       bbtkError("the black box \""<<name<<"\" does not exist");
-      }
-
+    {
+        bbtkError("the black box \""<<name<<"\" does not exist");
+    }
     return i->second;
   }
   //==================================================================
index b79fed3e10f1a81d3f5456a91313da7bd09651d2..5f445e23582210373e7d849ab57069541662a56d 100644 (file)
@@ -202,29 +202,23 @@ namespace bbtk
                        <<std::endl);
   // 
     if (!GetFactory()) 
-      { 
-       bbtkError("ComplexBlackBoxDescriptor::Connect : no factory set");
-      }
+    {
+        bbtkError("ComplexBlackBoxDescriptor::Connect : no factory set");
+    }
     
-
   // Verify that a box with the same name does not exist already
     BlackBox::Pointer bbfrom = mPrototype->bbGetBlackBox( from );
     if ( !bbfrom ) 
-      {
-       bbtkError("the black box \""<<from<<"\" does not exist");
-      }
+    {
+        bbtkError("the black box \""<<from<<"\" does not exist");
+    }
     BlackBox::Pointer bbto = mPrototype->bbGetBlackBox( to );
     if ( !bbto ) 
-      {
-       bbtkError("the black box \""<<to<<"\" does not exist");
-      }
-    
-    Connection::Pointer c 
-      = GetFactory()->NewConnection( bbfrom, output, bbto, input );
-
+    {
+        bbtkError("the black box \""<<to<<"\" does not exist");
+    }
+    Connection::Pointer c = GetFactory()->NewConnection( bbfrom, output, bbto, input );
     mPrototype->bbAddConnection(c);
-
-
   }
   //=======================================================================
 
index baf010b95bae75ba17dee2577758464ab4b07482..3b099101e1441dd4a5b2d5345b56365ff20c02cc 100644 (file)
@@ -28,13 +28,21 @@ void ConcatStrings_tool::Process()
 //    bbSetOutputOut( bbGetInputIn() );
 //    std::cout << "Output value = " <<bbGetOutputOut() << std::endl;
   
-    if ((bbGetInputType()==1) && ( bbGetInputBox_ConcatString()!=NULL) )
+    if ( bbGetInputBox_ConcatString()!=NULL )
     {
-        bbGetInputBox_ConcatString()->bbSetOutputOut( bbGetInputIn1() );
-        bbGetInputBox_ConcatString()->bbSignalOutputModification(std::string("Out"));
-//        bbGetInputBox_ConcatString()->bbSignalOutputModification();
-    } // if Type == 1   &&  Box
+        if ( (bbGetInputType()==1) )
+        {
+            bbGetInputBox_ConcatString()->bbSetOutputOut( bbGetInputIn1() );
+          bbGetInputBox_ConcatString()->bbSignalOutputModification(std::string("Out"),true);
+//                bbGetInputBox_ConcatString()->bbSignalOutputModification();
+        } // if Type == 1
 
+        if ( (bbGetInputType()==2) )
+        {
+            bbGetInputBox_ConcatString()->bbSetOutputOut( bbGetInputIn1() );
+            bbGetInputBox_ConcatString()->bbSignalOutputModification(std::string("Out"),false);
+        } // if Type == 2
+    } // if bbGetInputBox_ConcatString!NULL
     
 }
 
@@ -46,6 +54,7 @@ void ConcatStrings_tool::bbUserSetDefaultValues()
 //  SET HERE THE DEFAULT INPUT/OUTPUT VALUES OF YOUR BOX 
 //    Here we initialize the input 'In' to 0
     bbSetInputIn1("");
+    bbSetInputType(0);
     bbSetInputBox_ConcatString(NULL);
 }
 
index bb035f8620ca559084c0781fb0388fc9d6e26723..e997de2cf53939b0ba827b363feb754cf4d163e1 100644 (file)
@@ -39,7 +39,7 @@ BBTK_DESCRIPTION("No Description.");
 BBTK_CATEGORY("empty");
 
   BBTK_INPUT(ConcatStrings_tool,In1,"String input",std::string,"");
-  BBTK_INPUT(ConcatStrings_tool,Type,"(default 0) 0:Nothing  1:Set Out",int,"");
+  BBTK_INPUT(ConcatStrings_tool,Type,"(default 0) 0:Nothing  1:Set Out with reactivity 2:Set Out witout reactivity",int,"");
   BBTK_INPUT(ConcatStrings_tool,Box_ConcatString,"bbtk Box ConcatString",ConcatStrings*,"");
 
 //  BBTK_OUTPUT(ConcatStrings_tool,Out,"First output",double,"");
index b22054016d21ac229053c26679eae8d75f072630..730ef392bcd6c29fd78ed3e955ee59453d23c944 100755 (executable)
@@ -57,59 +57,61 @@ namespace bbstd
   {
   }
   
-  void ExecBbiCommand::DoProcess()
+void ExecBbiCommand::DoProcess()
+{
+    printf("EED ExecBbiCommand::DoProcess Start \n");
+    // Look for the interpreter
+    bbtk::Interpreter::Pointer I;
+    bool delete_inter = false;
+    if (bbGetParent() != 0)
     {
-
-      // Look for the interpreter
-      bbtk::Interpreter::Pointer I;
-         bool delete_inter = false;
-         if (bbGetParent() != 0)
-         {
-         bbtk::Factory::Pointer f
-               = ((bbtk::ComplexBlackBoxDescriptor*)bbGetParent()
-                 ->bbGetDescriptor().get())->GetFactory();
-         if ((f != 0)&&
-             (f->GetExecuter()))
-           {
-             I = f->GetExecuter()->GetInterpreter();
-           }
-         }
-      if (I==0)
-         {
-         //      bbtkError("ExecBbiCommand::DoProcess() : could not find interpreter");
-         I = bbtk::Interpreter::New();
-         delete_inter = true;
-         }
-
-      unsigned int i;
-
-      bool ok=true;
-      int pos1=0,pos2;
-      pos2 = bbGetInputIn().find(";",pos1);
-      std::string ccommand;
-      while (ok==true)
+        printf("EED ExecBbiCommand::DoProcess 1 \n");
+        bbtk::Factory::Pointer f = ((bbtk::ComplexBlackBoxDescriptor*)bbGetParent()->bbGetDescriptor().get())->GetFactory();
+        if ( (f != 0) && (f->GetExecuter()) )
            {
-         if (pos2==-1) 
-          {
-           ok=false;
-           ccommand=bbGetInputIn().substr(pos1,bbGetInputIn().length()-pos1 );
-          } else {
-           ccommand=bbGetInputIn().substr(pos1,pos2-pos1);
-         }
-         for ( i=0 ; i < ccommand.length() ; i++)
-         {
-           if (ccommand[i]==39)
-           {
-                 ccommand[i]=34;
+            printf("EED ExecBbiCommand::DoProcess 2 \n");
+            I = f->GetExecuter()->GetInterpreter();
+           } // if f
+    } // if Parent
+    if (I==NULL)
+    {
+        printf("EED ExecBbiCommand::DoProcess 3 \n");
+        //       bbtkError("ExecBbiCommand::DoProcess() : could not find interpreter");
+        I = bbtk::Interpreter::New();
+        delete_inter = true;
+    } // if I
+    unsigned int i;
+    bool ok=true;
+    int pos1=0,pos2;
+    pos2 = bbGetInputIn().find(";",pos1);
+    std::string ccommand;
+    printf("EED ExecBbiCommand::DoProcess 4 \n");
+    while (ok==true)
+    {
+        if (pos2==-1)
+        {
+            ok=false;
+            ccommand=bbGetInputIn().substr(pos1,bbGetInputIn().length()-pos1 );
+        } else {
+            ccommand=bbGetInputIn().substr(pos1,pos2-pos1);
         }
-     }
-
-         I->InterpretLine( ccommand );
-         pos1=pos2+1;
-         pos2 = bbGetInputIn().find(";",pos2+1);
-
-       }
-      
+        for ( i=0 ; i < ccommand.length() ; i++)
+        {
+            if (ccommand[i]==39)
+            {
+                ccommand[i]=34;
+            } // if 39
+        } // for i
+        printf("EED ExecBbiCommand::DoProcess 5 \n");
+        printf("EED ExecBbiCommand::DoProcess command=%s \n", ccommand.c_str() );
+        I->InterpretLine( ccommand );
+        pos1=pos2+1;
+        pos2 = bbGetInputIn().find(";",pos2+1);
+       } // while
+
+    printf("EED ExecBbiCommand::DoProcess 6 \n");
+
+    
 //      if (delete_inter) delete I;
 
    /*  Grrr  not works in windows
@@ -132,7 +134,12 @@ namespace bbstd
        pch = strtok (NULL, ";");
        }
   */
-  }
+    
+    printf("EED ExecBbiCommand::DoProcess End\n");
+
+    
+}
+
 } // EO namespace bbstd
 
 
index 1a66b5cab35cd605d5813b498bd14fd6b0136083..6ed1ba6d9db690c0f1ee00fd3ba80b7c9ff9ca2c 100644 (file)
@@ -41,10 +41,9 @@ using namespace bbtk;
 namespace bbstd
 {
 
-       void MagicBox::bbComputePostProcessStatus()
-       {
-       AtomicBlackBox::bbComputePostProcessStatus();
-
+void MagicBox::bbComputePostProcessStatus()  // Virtual
+{
+    AtomicBlackBox::bbComputePostProcessStatus();
        if (bbGetInputActive()==false)
        {
                // Update the output statuses
@@ -52,36 +51,33 @@ namespace bbstd
                OutputConnectorMapType::iterator o;
                for ( o = bbGetOutputConnectorMap().begin(); o!= bbGetOutputConnectorMap().end(); ++o) 
                {
-                       o->second->SetStatus(new_output_status);
+                       o->second->SetStatus( new_output_status );
                } // for o
        } // if
+}
 
-  }
-
-
-  void MagicBox::bbUserSetDefaultValues()
-  {
-       bbSetInputActive(true);
-  }
+void MagicBox::bbUserSetDefaultValues()
+{
+    bbSetInputActive(true);
+}
 
-  void MagicBox::bbUserInitializeProcessing() 
-  { 
-  }
+void MagicBox::bbUserInitializeProcessing()
+{
+}
 
-  void  MagicBox::bbUserFinalizeProcessing() 
-  {
-  }
+void  MagicBox::bbUserFinalizeProcessing()
+{
+}
 
-  void MagicBox::DoProcess()
-  { 
-       if (bbGetInputActive()==true)
+void MagicBox::DoProcess()
+{
+    if (bbGetInputActive()==true)
        {
                bbSetOutputOut( bbGetInputIn() );
-       } // Active
-  }
+       } // if Active
+}
 
-  BBTK_ADD_BLACK_BOX_TO_PACKAGE(std,MagicBox);
-  BBTK_BLACK_BOX_IMPLEMENTATION(MagicBox,bbtk::AtomicBlackBox);
+BBTK_ADD_BLACK_BOX_TO_PACKAGE(std,MagicBox);
+BBTK_BLACK_BOX_IMPLEMENTATION(MagicBox,bbtk::AtomicBlackBox);
   
-}
-// EO namespace bbstd
+} // EO namespace bbstd
index ef9d87ed0dcc7d076a21e568c6cb5301bb4755cd..4106706fd7324e4b6e78751f7d4111b52b01d3c9 100644 (file)
@@ -36,7 +36,7 @@ void SurfaceTexture::Process()
        double  spc[3];
        double  range[2];
        int     ext[6];
-       if ((bbGetInputImage()!=NULL) && (bbGetInputMesh()!=NULL))
+       if ((bbGetInputImage()!=NULL) && (bbGetInputMesh()!=NULL) && ( bbGetInputColorType()>=0 ))
        {
                bbGetInputImage()->GetSpacing(spc);
                bbGetInputImage()->GetScalarRange(range);
index 640aada1ef91fa945d5a3c5c0720e2f78a27b0c1..ad773c2ff97e0210cf317177051093413ec263aa 100644 (file)
 #include "bbvtkPackage.h"
 namespace bbvtk {
 
-    BBTK_ADD_BLACK_BOX_TO_PACKAGE(vtk, UpdateRender)
-    BBTK_BLACK_BOX_IMPLEMENTATION(UpdateRender, bbtk::AtomicBlackBox);
+BBTK_ADD_BLACK_BOX_TO_PACKAGE(vtk, UpdateRender)
+BBTK_BLACK_BOX_IMPLEMENTATION(UpdateRender, bbtk::AtomicBlackBox);
 
-    void UpdateRender::Process() 
+void UpdateRender::Process()
+{
+    if(bbGetInputActive())
     {
-       if(bbGetInputActive())
-               {
-               if (bbGetInputRenderer()!=NULL)
-               {
-                       bbGetInputRenderer()->GetRenderWindow()->Render();
+        if (bbGetInputRenderer()!=NULL)
+        {
+printf("EED UpdateRender::Process  Ojo -----------\n");
+            bbGetInputRenderer()->GetRenderWindow()->Render();
+            
 //EED 4 nov 2015 Estelle
 //                     bbGetInputRenderer()->GradientBackgroundOff();
 //                     bbGetInputRenderer()->SetBackground( 0 , 0 , 0 );
-               } // Renderer
-               } // Active
-    }
-
-    void UpdateRender::bbUserSetDefaultValues() {
-        bbSetInputActive(false);
-       bbSetInputRenderer(NULL);
-    }
-
-    void UpdateRender::bbUserInitializeProcessing() {
+        } // Renderer
+    } // if Active
+}
 
-    }
+void UpdateRender::bbUserSetDefaultValues()
+{
+    bbSetInputActive(false);
+    bbSetInputRenderer(NULL);
+}
 
-    void UpdateRender::bbUserFinalizeProcessing() {
+void UpdateRender::bbUserInitializeProcessing()
+{
+}
 
-    }
+void UpdateRender::bbUserFinalizeProcessing()
+{
 }
-// EO namespace bbvtk
+
+} // EO namespace bbvtk
 
 
index da9735029acc40a50bd9a7089e38043f2951821e..ea5e5d9427e02e2f869f6b13642f5006666e33c7 100644 (file)
@@ -22,9 +22,7 @@
                if (bbGetInputTitle()!="")
                {
                        msg = bbGetInputTitle()+": " + bbGetInputIn();
-               }  
-               else 
-               {
+               } else {
                        msg = bbGetInputIn();
                }
                w->SetLabel( bbtk::std2wx( msg ) );