+
+
+
+ //=========================================================================
+ void BlackBox::AddChangeObserver(const std::string& output_name,
+ OutputChangeCallbackType f)
+ {
+ }
+ //=========================================================================
+
+ //=========================================================================
+ void BlackBox::RemoveChangeObserver(const std::string& output_name,
+ OutputChangeCallbackType f)
+ {
+ }
+ //=========================================================================
+
+
+ /*
+ //=========================================================================
+ /// Sets the ChangeTime of input
+ void BlackBox::bbSetInputChangeTime(BlackBoxInputConnector* c,
+ const ChangeTime& t)
+ {
+ bbtkDebugMessage("change",1,
+ "==> BlackBox::bbSetInputChangeTime("<<c<<","<<t<<") ["
+ <<bbGetFullName()<<"]"<<std::endl);
+
+ // If new time is greater than old one
+ if ( c->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() ) )
+ {
+ bbtkDebugMessage("change",2,
+ "an input of "
+ <<bbGetFullName()
+ <<" changed and box is in Reactive mode or BoxExecute input changed : adding it to the global execution list"
+ <<std::endl);
+ bbGlobalAddToExecutionList( GetThisPointer<BlackBox>() );
+ }
+ // 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)
+ {
+ bbtkDebugMessage("change",1,
+ "==> BlackBox::bbSetOutputChangeTime("<<c<<","<<t<<") ["
+ <<bbGetFullName()<<"]"<<std::endl);
+
+ //ChangeTime old =
+ c->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)
+ {
+ if (s==UPTODATE) bbtkError("bbSetStatusAndPropagate with status UPTODATE!");
+ c->SetStatus(s);
+ OutputConnectorMapType::const_iterator o;
+ for ( o = bbGetOutputConnectorMap().begin();
+ o != bbGetOutputConnectorMap().end(); ++o )
+ {
+ // bbSetStatusAndPropagate(o->second, OUTOFDATE);
+ if (o->second->GetStatus()==UPTODATE)
+ {
+ o->second->SetStatus(OUTOFDATE);
+ o->second->SignalChange(GetThisPointer<BlackBox>(),o->first);
+ }
+ }
+
+ if ( ( bbBoxProcessModeIsReactive() ||
+ (c==bbGetInputConnectorMap().find("BoxExecute")->second))
+ && (bbCanReact() ) )
+ {
+ bbtkDebugMessage("modified",2,
+ "-> Execution triggered by Reactive mode or BoxExecute input change"<<std::endl);
+ bbGlobalAddToExecutionList( GetThisPointer<BlackBox>() );
+ }
+ }