X-Git-Url: https://git.creatis.insa-lyon.fr/pubgit/?a=blobdiff_plain;f=kernel%2Fsrc%2FbbtkBlackBox.cxx;h=6fb1fb83a9c749dfce3cc545269c3f0773ad71bf;hb=1588a95ff236c187f3c6cdec14a5d1e899d230c9;hp=805dd6f98a14d912a8d95b7a7e04b878d8dd9530;hpb=1688b52778caa9985ecea38aad38341817e0401a;p=bbtk.git
diff --git a/kernel/src/bbtkBlackBox.cxx b/kernel/src/bbtkBlackBox.cxx
index 805dd6f..6fb1fb8 100644
--- a/kernel/src/bbtkBlackBox.cxx
+++ b/kernel/src/bbtkBlackBox.cxx
@@ -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: 2011/03/03 14:37:57 $
- Version: $Revision: 1.52 $
+ 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
@@ -109,6 +116,7 @@ namespace bbtk
bbmExecuting(false),
bbmName(name),
bbmBoxProcessMode("Pipeline"),
+ bbLetRecursiveExecuteManualMode(false),
bbmParent()
{
@@ -135,6 +143,7 @@ namespace bbtk
bbmExecuting(false),
bbmName(name),
bbmBoxProcessMode(from.bbmBoxProcessMode),
+ bbLetRecursiveExecuteManualMode(false),
bbmParent()
{
@@ -378,13 +387,19 @@ namespace bbtk
(p == "F") || (p == "f") ||
(p == "Flash") || (p == "flash") ) return Flash;
*/
- bbtkError(bbGetFullName()<<" : BoxProcessMode value '"<
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(),o->first);
- }
- }
+ } // if
+ } // for
- if ( ( bbBoxProcessModeIsReactive() ||
- (c==bbGetInputConnectorMap().find("BoxExecute")->second))
- && (bbCanReact() ) )
+
+ if ( ( bbBoxProcessModeIsReactive()
+ || (c==bbGetInputConnectorMap().find("BoxExecute")->second))
+ && (bbCanReact() ) )
{
bbtkBlackBoxDebugMessage("change",2,
"-> Execution triggered by Reactive mode or BoxExecute input change"<() );
- }
+ } // if
bbtkBlackBoxDebugMessage("change",5,
"<= BlackBox::bbSetStatusAndPropagate(input)"
<second->SignalChange(GetThisPointer(),i->first);
// }
- }
+ } // for
if (reaction) bbGlobalProcessExecutionList();
@@ -498,6 +534,8 @@ namespace bbtk
< BlackBox::bbRecursiveExecute("
<<(caller?caller->GetFullName():"0")<<")"
@@ -680,20 +732,40 @@ namespace bbtk
this->bbCreateWindow();
// Updates its inputs
- IOStatus s = bbUpdateInputs();
-
- if ( (s != UPTODATE) ||
- bbBoxProcessModeIsAlways() )
+
+// 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
{
@@ -725,6 +797,7 @@ namespace bbtk
bbSetExecuting(false);
bbGlobalSetSomeBoxExecuting(wasExecuting);
+
return;
}
//=========================================================================
@@ -807,7 +880,19 @@ namespace bbtk
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
+
}
bbtkBlackBoxDebugMessage("process",4,
@@ -1148,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+ " } }" ;
@@ -1209,23 +1294,23 @@ namespace bbtk
if (this->bbGetDescriptor()->GetPackage())
{
- bbtkBlackBoxMessage("help",1,"Black Box '"<bbGetDescriptor()->GetPackage()->GetName()
<<"::"<bbGetDescriptor()->GetTypeName()<<">"<bbGetDescriptor()->GetTypeName()<<">"<bbGetDescriptor()->GetTypeName()<<">"<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 oname;
std::vector ovalue;
std::vector > oconn;
std::vector 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 ss;
- const std::vector& con
- = o->second->GetConnectionVector();
- std::vector::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 ss;
+ const std::vector& con
+ = o->second->GetConnectionVector();
+ std::vector::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())
bbtkBlackBoxMessage("help",1," * Inputs : "<::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())
- bbtkBlackBoxMessage("help",1," '"<size())
+ bbtkBlackBoxMessage("help",1," '"< >::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())
- bbtkBlackBoxMessage("help",1," '"<begin();i3!=i5->end();++i3)
- {
- bbtkBlackBoxMessage("help",1,pref<<" --> '"<<*i3<<"'");
- pref.replace(0,pref.size(),pref.size(),' ');
- }
- }
- bbtkBlackBoxMessage("help",1," ["<<*i4<<"]"<begin();i3!=i5->end();++i3)
+ {
+ bbtkBlackBoxMessage("help",1,pref<<" --> '"<<*i3<<"'");
+ pref.replace(0,pref.size(),pref.size(),' ');
+ }
+ }
+ bbtkBlackBoxMessage("help",1," ["<<*i4<<"]"<