namespace bbtk
{
+ static bool bbmgInConstruction = false;
static bool bbmgSomeBoxExecuting = false;
static bool bbmgFreezeExecution = false;
static std::set<BlackBox::WeakPointer> bbmgExecutionList;
"=> BlackBox::bbSignalOutputModification("
<<reaction<<")"
<<"]"<<std::endl);
-
- OutputConnectorMapType::iterator i;
- for ( i = bbGetOutputConnectorMap().begin();
- i != bbGetOutputConnectorMap().end(); ++i)
- {
- // std::cout << "Stat = "
- //<<GetIOStatusString(i->second->GetStatus())
- // <<std::endl;
- // LG : CANNOT SIGNAL ONLY WHEN UPTODATE
- // See bbtkSampleOutputObserver
- // if (i->second->GetStatus()==UPTODATE)
- // {
- i->second->SignalChange(GetThisPointer<BlackBox>(),i->first);
- // }
- } // for
-
- if (reaction) bbGlobalProcessExecutionList();
-
+ if (bbGlobalGetInConstruction()==false)
+ {
+ OutputConnectorMapType::iterator i;
+ for ( i = bbGetOutputConnectorMap().begin();
+ i != bbGetOutputConnectorMap().end(); ++i)
+ {
+ // std::cout << "Stat = "
+ //<<GetIOStatusString(i->second->GetStatus())
+ // <<std::endl;
+ // LG : CANNOT SIGNAL ONLY WHEN UPTODATE
+ // See bbtkSampleOutputObserver
+ // if (i->second->GetStatus()==UPTODATE)
+ // {
+ i->second->SignalChange(GetThisPointer<BlackBox>(),i->first);
+ // }
+ } // for
+
+ if (reaction = true)
+ {
+ bbGlobalProcessExecutionList();
+ } // if reaction
+ } // if inCosntruction
bbtkBlackBoxDebugMessage("change",5,
"<= BlackBox::bbSignalOutputModification()"
<<std::endl);
"=> BlackBox::bbSignalOutputModification("
<<output<<","<<reaction<<")"
<<std::endl);
-
- OutputConnectorMapType::iterator i =
- bbGetOutputConnectorMap().find(output);
-
-
- if ( i == bbGetOutputConnectorMap().end() )
- {
- bbtkError("BlackBox["<<bbGetFullName()<<"]::bbSignalOutputModification("<<output<<") : unknown output");
- }
-
- // if (i->second->GetStatus()==UPTODATE)
- // {
- i->second->SignalChange(GetThisPointer<BlackBox>(),i->first);
- // Has to notify the output "BoxChange" also
- if (output != "BoxChange")
- {
- i = bbGetOutputConnectorMap().find("BoxChange");
- if ( i != bbGetOutputConnectorMap().end() )
- {
- i->second->SignalChange(GetThisPointer<BlackBox>(),i->first);
- }
- }
- if (reaction) bbGlobalProcessExecutionList();
- // }
-
+ if (bbGlobalGetInConstruction()==false)
+ {
+
+ OutputConnectorMapType::iterator i =
+ bbGetOutputConnectorMap().find(output);
+
+
+ if ( i == bbGetOutputConnectorMap().end() )
+ {
+ bbtkError("BlackBox["<<bbGetFullName()<<"]::bbSignalOutputModification("<<output<<") : unknown output");
+ }
+
+ // if (i->second->GetStatus()==UPTODATE)
+ // {
+ i->second->SignalChange(GetThisPointer<BlackBox>(),i->first);
+ // Has to notify the output "BoxChange" also
+ if (output != "BoxChange")
+ {
+ i = bbGetOutputConnectorMap().find("BoxChange");
+ if ( i != bbGetOutputConnectorMap().end() )
+ {
+ i->second->SignalChange(GetThisPointer<BlackBox>(),i->first);
+ }
+ }
+ if (reaction=true)
+ {
+ bbGlobalProcessExecutionList();
+ } // if reaction
+ // }
+
+ } // if inConstruction
+
bbtkBlackBoxDebugMessage("change",5,
"<= BlackBox::bbSignalOutputModification("
<<output<<")"
<<std::endl);
}
- //=========================================================================
- //=========================================================================
+ //=========================================================================
+
+ //=========================================================================
void BlackBox::bbSignalOutputModification(const std::vector<std::string>& output,
bool reaction)
{
bbtkBlackBoxDebugMessage("change",5,
"=> BlackBox::bbSignalOutputModification(vector of outputs)"
<<std::endl);
- OutputConnectorMapType::iterator i;
- std::vector<std::string>::const_iterator o;
- bool changed = false;
- for (o=output.begin();o!=output.end();++o)
- {
- // the output "BoxChange" must be signaled **AFTER** all others
- if (*o == "BoxChange") continue;
- // Look for the connector
- i = bbGetOutputConnectorMap().find(*o);
- if ( i == bbGetOutputConnectorMap().end() )
- {
- bbtkError("BlackBox["<<bbGetFullName()<<"]::bbSignalOutputModification("<<*o<<") : unknown output");
- }
-
- // if (i->second->GetStatus()==UPTODATE)
- // {
- i->second->SignalChange(GetThisPointer<BlackBox>(),i->first);
- changed = true;
- // }
- }
- // Has to notify the output "BoxChange" also
- i = bbGetOutputConnectorMap().find("BoxChange");
- if ( changed && (i != bbGetOutputConnectorMap().end()))
+
+ if (bbGlobalGetInConstruction()==false)
{
- // if (i->second->GetStatus()==UPTODATE)
- // {
- i->second->SignalChange(GetThisPointer<BlackBox>(),i->first);
- if (reaction) bbGlobalProcessExecutionList();
- // }
- }
-
+
+ OutputConnectorMapType::iterator i;
+ std::vector<std::string>::const_iterator o;
+ bool changed = false;
+ for (o=output.begin();o!=output.end();++o)
+ {
+ // the output "BoxChange" must be signaled **AFTER** all others
+ if (*o == "BoxChange") continue;
+ // Look for the connector
+ i = bbGetOutputConnectorMap().find(*o);
+ if ( i == bbGetOutputConnectorMap().end() )
+ {
+ bbtkError("BlackBox["<<bbGetFullName()<<"]::bbSignalOutputModification("<<*o<<") : unknown output");
+ }
+
+ // if (i->second->GetStatus()==UPTODATE)
+ // {
+ i->second->SignalChange(GetThisPointer<BlackBox>(),i->first);
+ changed = true;
+ // }
+ }
+ // Has to notify the output "BoxChange" also
+ i = bbGetOutputConnectorMap().find("BoxChange");
+ if ( changed && (i != bbGetOutputConnectorMap().end()))
+ {
+ // if (i->second->GetStatus()==UPTODATE)
+ // {
+ i->second->SignalChange(GetThisPointer<BlackBox>(),i->first);
+ if (reaction) bbGlobalProcessExecutionList();
+ // }
+ } // if changed
+ } // if inConstruction
bbtkBlackBoxDebugMessage("change",5,
"<= BlackBox::bbSignalOutputModification(vector of outputs)"
<<std::endl);
)
{
-printf("EED BlackBox::bbRecursiveExecute bbProcess start %s \n", bbGetFullName().c_str() );
+//printf("EED BlackBox::bbRecursiveExecute bbProcess start %s \n", bbGetFullName().c_str() );
//auto start = std::chrono::high_resolution_clock::now();
this->bbProcess();
//auto duration = std::chrono::duration_cast<std::chrono::microseconds>(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() );
+//printf("EED BlackBox::bbRecursiveExecute bbProcess end %s \n", bbGetFullName().c_str() );
} // Manual analysis
//=========================================================================
+bool BlackBox::bbGlobalGetInConstruction()
+{
+ return bbmgInConstruction;
+}
+
+void BlackBox::bbGlobalSetInConstruction(bool b)
+{
+ bbmgInConstruction = b;
+}
} // EO namespace bbtk