From: Eduardo DAVILA Date: Thu, 10 Aug 2023 16:28:32 +0000 (+0200) Subject: #3508 ConcatString_tool Reactivity 2 X-Git-Url: https://git.creatis.insa-lyon.fr/pubgit/?a=commitdiff_plain;h=2129cd54808003c1ff7a3da8d714e02cc3ef1045;p=bbtk.git #3508 ConcatString_tool Reactivity 2 --- diff --git a/kernel/src/bbtkAtomicBlackBoxDescriptor.cxx b/kernel/src/bbtkAtomicBlackBoxDescriptor.cxx index aafb10d..5d33daa 100644 --- a/kernel/src/bbtkAtomicBlackBoxDescriptor.cxx +++ b/kernel/src/bbtkAtomicBlackBoxDescriptor.cxx @@ -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::bbGetInputBoxProcessMode), new bbtk::AtomicBlackBoxTSetFunctor(&BlackBox::bbSetInputBoxProcessMode) ) ); diff --git a/kernel/src/bbtkBlackBox.cxx b/kernel/src/bbtkBlackBox.cxx index 03a2054..3bd38f7 100644 --- a/kernel/src/bbtkBlackBox.cxx +++ b/kernel/src/bbtkBlackBox.cxx @@ -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(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)) diff --git a/kernel/src/bbtkComplexBlackBox.cxx b/kernel/src/bbtkComplexBlackBox.cxx index 195b53a..0e823e0 100644 --- a/kernel/src/bbtkComplexBlackBox.cxx +++ b/kernel/src/bbtkComplexBlackBox.cxx @@ -570,14 +570,12 @@ namespace bbtk { bbtkBlackBoxDebugMessage("kernel",9, "ComplexBlackBox::GetBlackBox(\""<second; } //================================================================== diff --git a/kernel/src/bbtkComplexBlackBoxDescriptor.cxx b/kernel/src/bbtkComplexBlackBoxDescriptor.cxx index b79fed3..5f445e2 100644 --- a/kernel/src/bbtkComplexBlackBoxDescriptor.cxx +++ b/kernel/src/bbtkComplexBlackBoxDescriptor.cxx @@ -202,29 +202,23 @@ namespace bbtk <bbGetBlackBox( from ); if ( !bbfrom ) - { - bbtkError("the black box \""<bbGetBlackBox( to ); if ( !bbto ) - { - bbtkError("the black box \""<NewConnection( bbfrom, output, bbto, input ); - + { + bbtkError("the black box \""<NewConnection( bbfrom, output, bbto, input ); mPrototype->bbAddConnection(c); - - } //======================================================================= diff --git a/packages/std/src/bbstdConcatStrings_tool.cxx b/packages/std/src/bbstdConcatStrings_tool.cxx index baf010b..3b09910 100644 --- a/packages/std/src/bbstdConcatStrings_tool.cxx +++ b/packages/std/src/bbstdConcatStrings_tool.cxx @@ -28,13 +28,21 @@ void ConcatStrings_tool::Process() // bbSetOutputOut( bbGetInputIn() ); // std::cout << "Output value = " <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); } diff --git a/packages/std/src/bbstdConcatStrings_tool.h b/packages/std/src/bbstdConcatStrings_tool.h index bb035f8..e997de2 100644 --- a/packages/std/src/bbstdConcatStrings_tool.h +++ b/packages/std/src/bbstdConcatStrings_tool.h @@ -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,""); diff --git a/packages/std/src/bbstdExecBbiCommand.cxx b/packages/std/src/bbstdExecBbiCommand.cxx index b220540..730ef39 100755 --- a/packages/std/src/bbstdExecBbiCommand.cxx +++ b/packages/std/src/bbstdExecBbiCommand.cxx @@ -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 diff --git a/packages/std/src/bbstdMagicBox.cxx b/packages/std/src/bbstdMagicBox.cxx index 1a66b5c..6ed1ba6 100644 --- a/packages/std/src/bbstdMagicBox.cxx +++ b/packages/std/src/bbstdMagicBox.cxx @@ -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 diff --git a/packages/vtk/src/bbvtkSurfaceTexture.cxx b/packages/vtk/src/bbvtkSurfaceTexture.cxx index ef9d87e..4106706 100644 --- a/packages/vtk/src/bbvtkSurfaceTexture.cxx +++ b/packages/vtk/src/bbvtkSurfaceTexture.cxx @@ -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); diff --git a/packages/vtk/src/bbvtkUpdateRender.cxx b/packages/vtk/src/bbvtkUpdateRender.cxx index 640aada..ad773c2 100644 --- a/packages/vtk/src/bbvtkUpdateRender.cxx +++ b/packages/vtk/src/bbvtkUpdateRender.cxx @@ -30,36 +30,39 @@ #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 diff --git a/packages/wx/src/bbwxOutputText.xml b/packages/wx/src/bbwxOutputText.xml index da97350..ea5e5d9 100644 --- a/packages/wx/src/bbwxOutputText.xml +++ b/packages/wx/src/bbwxOutputText.xml @@ -22,9 +22,7 @@ if (bbGetInputTitle()!="") { msg = bbGetInputTitle()+": " + bbGetInputIn(); - } - else - { + } else { msg = bbGetInputIn(); } w->SetLabel( bbtk::std2wx( msg ) );