X-Git-Url: https://git.creatis.insa-lyon.fr/pubgit/?a=blobdiff_plain;f=kernel%2Fsrc%2FbbtkBlackBox.cxx;h=35bda120cdf1aebc80a2d43cdc83e8dcecc1e9cf;hb=e542f5cdbfc165e80003d21b2fbf0e6a69344bb0;hp=316f8cb8142a711f57eed716f3e2486b00a17b82;hpb=c333db268f8b73bcf7fe7ff9eeed8394252f1c94;p=bbtk.git diff --git a/kernel/src/bbtkBlackBox.cxx b/kernel/src/bbtkBlackBox.cxx index 316f8cb..35bda12 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/05/28 14:22:09 $ - Version: $Revision: 1.47 $ + Date: $Date: 2011/03/03 14:33:13 $ + Version: $Revision: 1.51 $ =========================================================================*/ /* --------------------------------------------------------------------- @@ -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(" <GetHelp(full); @@ -193,7 +197,6 @@ namespace bbtk //========================================================================= - /// Returns true if the UserBlackBox has an input of name name bool BlackBox::bbHasInput(const std::string& name) const { bbtkBlackBoxDebugMessage("kernel",8, @@ -209,7 +212,6 @@ namespace bbtk //========================================================================= - /// Returns true if the UserBlackBox has an output of name name bool BlackBox::bbHasOutput(const std::string& name) const { bbtkBlackBoxDebugMessage("kernel",8,"BlackBox::bbHasOutput(\"" @@ -224,7 +226,6 @@ namespace bbtk //========================================================================= - /// Gets the output type of a given name TypeInfo BlackBox::bbGetOutputType( const std::string &name ) const { bbtkBlackBoxDebugMessage("kernel",8, @@ -238,7 +239,6 @@ namespace bbtk //========================================================================= //========================================================================= - /// Gets the input type of a given name TypeInfo BlackBox::bbGetInputType( const std::string &name ) const { bbtkBlackBoxDebugMessage("kernel",8, @@ -253,7 +253,6 @@ namespace bbtk //========================================================================= - /// Allocates the i/o connectors of the black box void BlackBox::bbAllocateConnectors() { bbtkBlackBoxDebugMessage("kernel",8, @@ -280,13 +279,11 @@ namespace bbtk bbGetOutputConnectorMap()[o->second->GetName()] = new BlackBoxOutputConnector(GetThisPointer()); } - } //========================================================================= //========================================================================= - /// Desallocates the i/o connectors of the black box void BlackBox::bbDesallocateConnectors() { bbtkBlackBoxDebugMessage("kernel",8, @@ -308,14 +305,12 @@ namespace bbtk delete (o->second); } - bbtkDebugDecTab("kernel",8); - + bbtkDebugDecTab("kernel",8); } //========================================================================= //========================================================================= - /// Copies the input / output values from another box void BlackBox::bbCopyIOValues(BlackBox& from) { bbtkBlackBoxDebugMessage("kernel",1, @@ -346,7 +341,6 @@ namespace bbtk } bbtkDebugDecTab("kernel",9); - } //========================================================================= @@ -359,38 +353,26 @@ namespace bbtk #ifdef USE_WXWIDGETS || Wx::IsSomeWindowAlive() #endif - ); + ); } //========================================================================= - //========================================================================= - /// User overloadable destruction method of a black box - void BlackBox::bbUserDelete() - { - bbtkBlackBoxDebugMessage("process",5, - "=> BlackBox::bbUserDelete()" - <<" : not overloaded; using standard deletion" - < BlackBox::bbSetInputChangeTime("<SetChangeTime(t) ) - { - bool was_up_to_date = bbIsUpToDate(); - // If new time is greater than the old max time of inputs - if ( mMaxInputChangeTime.Set(t) ) - { - // If the box turned out-of-date - if ( was_up_to_date && bbIsOutOfDate() ) - { - // - if ( ( bbBoxProcessModeIsReactive() || - (c==bbGetInputConnectorMap().find("BoxExecute")->second)) - && (bbCanReact() ) ) - { - bbtkBlackBoxDebugMessage("change",2, - "an input of " - <() ); - } - // Have to propagate the modification to aval boxes - OutputConnectorMapType::iterator i; - for (i = bbGetOutputConnectorMap().begin(); - i != bbGetOutputConnectorMap().end(); - ++i) - { - i->second->SetChangeTime(t); - } - // update the MinOutputChangeTime - mMinOutputChangeTime.Set(t); - } - } - } - } - //========================================================================= - - //========================================================================= - /// Sets the ChangeTime of output - void BlackBox::bbSetOutputChangeTime(BlackBoxOutputConnector* c, - const ChangeTime& t) - { - bbtkBlackBoxDebugMessage("change",1, - "==> BlackBox::bbSetOutputChangeTime("<SetChangeTime(t); - // c->GetChangeTime() = t; - // bbUpdateMinOutputChangeTime(t); - // propagate - - } - //========================================================================= - */ - - /* - //========================================================================= - void BlackBox::bbUpdateMaxInputChangeTime(const ChangeTime& t) - { - - - if ( t > mMaxInputChangeTime ) - { - mMaxInputChangeTime = t; - if ( mMinOutputChangeTime > mMaxInputChangeTime ) - { - - } - } - - } - //========================================================================= - - //========================================================================= - void bbUpdateMinOutputChangeTime(const ChangeTime& t) - { - ChangeTime old = mMinOutputChangeTime; - mMinOutputChangeTime = MAXLONG; - OutputConnectorMapType::iterator i; - for (i = bbGetOutputConnectorMap.begin(); - i != bbGetOutputConnectorMap.end(); - ++i) - { - if (i->second->GetChangeTime() < mMinOutputChangeTime) - mMinOutputChangeTime = i->second->GetChangeTime(); - } - if ( mMinOutputChangeTime < old ) - { - } - - } - //========================================================================= - */ - - //========================================================================= - /// Signals that the BlackBox has been modified through - /// the input connector c - /// and propagates it downward - /// ** NOT USER INTENDED ** void BlackBox::bbSetStatusAndPropagate(BlackBoxInputConnector* c, IOStatus s) { @@ -579,7 +451,7 @@ namespace bbtk o->second->SetStatus(OUTOFDATE); o->second->SignalChange(GetThisPointer(),o->first); } - } + } if ( ( bbBoxProcessModeIsReactive() || (c==bbGetInputConnectorMap().find("BoxExecute")->second)) @@ -603,7 +475,7 @@ namespace bbtk "=> BlackBox::bbSignalOutputModification(" < BlackBox::bbComputePostProcessStatus()" @@ -951,13 +812,11 @@ namespace bbtk bbtkBlackBoxDebugMessage("process",4, "<= BlackBox::bbComputePostProcessStatus()" - < to the connection c void BlackBox::bbConnectInput( const std::string& name, Connection* c) { bbtkBlackBoxDebugMessage("connection",2, @@ -965,7 +824,6 @@ namespace bbtk <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()<<")" - < to the connection c void BlackBox::bbConnectOutput( const std::string& name, Connection* c) { bbtkBlackBoxDebugMessage("connection",2, "==> BlackBox::bbConnectOutput(\""<GetFullName()<<")" <GetFullName()<<")" - < from the connection c - void BlackBox::bbDisconnectInput( const std::string& name, Connection* c) + void BlackBox::bbDisconnectInput( const std::string& name, Connection* c) { bbtkBlackBoxDebugMessage("connection",2, "==> BlackBox::bbDisconnectInput(\""<GetFullName()<<")" - < from the connection c - void BlackBox::bbDisconnectOutput( const std::string& name, Connection* c) + void BlackBox::bbDisconnectOutput( const std::string& name, Connection* c) { bbtkBlackBoxDebugMessage("connection",2, "==> BlackBox::bbDisconnectOutput(\""<