X-Git-Url: https://git.creatis.insa-lyon.fr/pubgit/?a=blobdiff_plain;f=kernel%2Fsrc%2FbbtkBlackBox.cxx;h=dfdf6e5df63861b3c353e71d6e289b6e20ffdedd;hb=731d9ee262e286a24e3ea2776d8e914950840a2c;hp=c74b2e9e1cf4a53a87ab398660813ffadc5d580a;hpb=664e5cdbbcaf3dafa5fc9f206a7094248c289d5a;p=bbtk.git diff --git a/kernel/src/bbtkBlackBox.cxx b/kernel/src/bbtkBlackBox.cxx index c74b2e9..dfdf6e5 100644 --- a/kernel/src/bbtkBlackBox.cxx +++ b/kernel/src/bbtkBlackBox.cxx @@ -2,8 +2,8 @@ Program: bbtk Module: $RCSfile: bbtkBlackBox.cxx,v $ Language: C++ - Date: $Date: 2009/06/08 14:50:02 $ - Version: $Revision: 1.48 $ + Date: $Date: 2011/07/22 17:42:50 $ + Version: $Revision: 1.54 $ =========================================================================*/ /* --------------------------------------------------------------------- @@ -48,8 +48,6 @@ namespace bbtk { - - static bool bbmgSomeBoxExecuting = false; static bool bbmgFreezeExecution = false; static std::set bbmgExecutionList; @@ -114,6 +112,10 @@ namespace bbtk bbmParent() { + //JCP 02-11-09 + // bbmBoxProcessMode = "Pipeline"; +//std::cout<<"JCP BlackBox::BlackBox(const std::string &name) name=" < BlackBox::BlackBox(\"" < BlackBox::BlackBox(" <second->GetName()] = new BlackBoxOutputConnector(GetThisPointer()); } - } //========================================================================= @@ -300,8 +305,7 @@ namespace bbtk delete (o->second); } - bbtkDebugDecTab("kernel",8); - + bbtkDebugDecTab("kernel",8); } //========================================================================= @@ -337,7 +341,6 @@ namespace bbtk } bbtkDebugDecTab("kernel",9); - } //========================================================================= @@ -350,7 +353,7 @@ namespace bbtk #ifdef USE_WXWIDGETS || Wx::IsSomeWindowAlive() #endif - ); + ); } //========================================================================= @@ -362,13 +365,14 @@ namespace bbtk const std::string& p = bbmBoxProcessMode; if ( (p == "0") || (p == "P") || (p == "p") || - (p == "Pipeline") || (p == "pipeline") ) return Pipeline; + (p == "Pipeline") || (p == "pipeline") ) return bbPipeline; if ( (p == "1") || (p == "A") || (p == "a") || - (p == "Always") || (p == "always") ) return Always; + (p == "Always") || (p == "always") ) return bbAlways; if ( (p == "2") || (p == "R") || (p == "r") || - (p == "Reactive") || (p == "reactive") ) return Reactive; + (p == "Reactive") || (p == "reactive") ) + return bbReactive; /* if ( (p == "3") || (p == "F") || (p == "f") || @@ -387,14 +391,14 @@ namespace bbtk //========================================================================= bool BlackBox::bbBoxProcessModeIsReactive() const { - return (bbGetBoxProcessModeValue() == Reactive); + return (bbGetBoxProcessModeValue() == bbReactive); } //========================================================================= //========================================================================= bool BlackBox::bbBoxProcessModeIsAlways() const { - return (bbGetBoxProcessModeValue() == Always); + return (bbGetBoxProcessModeValue() == bbAlways); } //========================================================================= @@ -447,11 +451,11 @@ namespace bbtk o->second->SetStatus(OUTOFDATE); o->second->SignalChange(GetThisPointer(),o->first); } - } + } - 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"< BlackBox::bbSignalOutputModification(" <second->SignalChange(GetThisPointer(),i->first); // } - } + } // for if (reaction) bbGlobalProcessExecutionList(); bbtkBlackBoxDebugMessage("change",5, "<= BlackBox::bbSignalOutputModification()" <GetFullName()<<")" <second->SetConnection(c); // The input *MUST* be set OUTOFDATE to update its input on next execution bbSetStatusAndPropagate(i->second,OUTOFDATE); - + bbtkBlackBoxDebugMessage("connection",2, "<== BlackBox::bbConnectInput(\"" <GetFullName()<<")" - < BlackBox::bbConnectOutput(\""<GetFullName()<<")" <GetFullName()<<")" - < BlackBox::bbDisconnectInput(\""<GetFullName()<<")" - <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+ " } }" ; @@ -1216,23 +1211,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," '"<