Program: bbtk
Module: $RCSfile: bbtkBlackBox.cxx,v $
Language: C++
-Date: $Date: 2008/04/21 12:43:05 $
-Version: $Revision: 1.11 $
+Date: $Date: 2008/04/23 14:49:27 $
+Version: $Revision: 1.15 $
Copyright (c) CREATIS (Centre de Recherche et d'Applications en Traitement de
l'Image). All rights reserved. See doc/license.txt or
/// Signals that the BlackBox has been modified
void BlackBox::bbSetModifiedStatus(BlackBoxInputConnector* c)
{
- bbtkDebugMessageInc("Process",5,
- "=> BlackBox::bbSetModifiedStatus("<<c<<") ["
- <<bbGetFullName()<<"]"<<std::endl);
-
+ bbtkDebugMessage("modified",1,
+ "==> BlackBox::bbSetModifiedStatus("<<c<<") ["
+ <<bbGetFullName()<<"]"<<std::endl);
+
if ( (c==bbGetInputConnectorMap().find("WinHide")->second) )
- // && (bbCanReact()))
+ // && (bbCanReact()))
{
- bbtkDebugMessage("Process",9,
+ bbtkDebugMessage("modified",2,
"-> Hide triggered by WinHide input change"
<<std::endl);
this->bbHideWindow();
this->bbSetStatus(MODIFIED);
return;
}
-
+
if ( ( bbBoxProcessModeIsReactive() ||
(c==bbGetInputConnectorMap().find("BoxExecute")->second))
&& (bbCanReact() ) )
{
- bbtkDebugMessage("Process",9,
+ bbtkDebugMessage("modified",2,
"-> Execution triggered by Reactive mode or BoxExecute input change"<<std::endl);
this->bbSetStatus(MODIFIED);
bbGlobalAddToExecutionList( GetThisPointer<BlackBox>() );
}
else if ( bbGetStatus() == MODIFIED ) //! this->bbIsUptodate())
{
- bbtkDebugMessage("Process",5,"-> Already modified"<<std::endl);
- bbtkDebugDecTab("Process",5);
+ bbtkDebugMessage("modified",2,"-> Already modified"<<std::endl);
return;
}
else
{
- bbtkDebugMessage("Process",5,"-> Status set to modified"<<std::endl);
- bbtkDebugDecTab("Process",5);
+ bbtkDebugMessage("modified",2,"-> Status set to modified"<<std::endl);
this->bbSetStatus(MODIFIED);
}
this->bbSignalOutputModification(false);
- bbtkDebugMessageDec("Process",5,
+ /*
+ bbtkDebugMessageDec("Process",5,
"<= BlackBox::bbSetModifiedStatus("<<c<<") ["
<<bbGetFullName()<<"]"<<std::endl);
+ */
}
//=========================================================================
//=========================================================================
/// Connects the input <name> to the connection c
- void BlackBox::bbConnectInput( const std::string& name, Connection::Pointer c)
+ void BlackBox::bbConnectInput( const std::string& name, Connection* c)
{
- bbtkDebugMessageInc("Kernel",7,
- "BlackBox::bbConnectInput(\""<<name<<"\","<<c<<") ["
+ bbtkDebugMessage("connection",2,
+ "==> BlackBox::bbConnectInput(\""
+ <<name<<"\","<<c->GetFullName()<<") ["
<<bbGetFullName()<<"]"
<<std::endl);
+
+
InputConnectorMapType::iterator i = bbGetInputConnectorMap().find(name);
if (i==bbGetInputConnectorMap().end())
{
}
i->second->SetConnection(c);
+ bbtkDebugMessage("connection",2,
+ "<== BlackBox::bbConnectInput(\""
+ <<name<<"\","<<c->GetFullName()<<") ["
+ <<bbGetFullName()<<"]"
+ <<std::endl);
// bbSetModifiedStatus();
- bbtkDebugDecTab("Kernel",7);
}
//=========================================================================
//=========================================================================
/// Connects the output <name> to the connection c
- void BlackBox::bbConnectOutput( const std::string& name, Connection::Pointer c)
+ void BlackBox::bbConnectOutput( const std::string& name, Connection* c)
{
- bbtkDebugMessageInc("Kernel",7,
- "BlackBox::bbConnectOutput(\""<<name<<"\","<<c<<") ["
- <<bbGetFullName()<<"]"<<std::endl);
-
+ bbtkDebugMessage("connection",2,
+ "==> BlackBox::bbConnectOutput(\""<<name<<"\","
+ <<c->GetFullName()<<") ["
+ <<bbGetFullName()<<"]"<<std::endl);
+
OutputConnectorMapType::iterator i = bbGetOutputConnectorMap().find(name);
if (i==bbGetOutputConnectorMap().end())
{
}
i->second->SetConnection(c);
- bbtkDebugDecTab("Kernel",7);
+ bbtkDebugMessage("connection",2,
+ "<== BlackBox::bbConnectOutput(\""<<name<<"\","
+ <<c->GetFullName()<<") ["
+ <<bbGetFullName()<<"]"<<std::endl);
+
}
//=========================================================================
//=========================================================================
/// Disconnects the input <name> from the connection c
- void BlackBox::bbDisconnectInput( const std::string& name, Connection::Pointer c)
+ void BlackBox::bbDisconnectInput( const std::string& name, Connection* c)
{
- if (!c) return;
- bbtkDebugMessageInc("Kernel",7,
- "BlackBox::bbDisconnectInput(\""<<name
- <<"\","<<c<<") ["
- <<bbGetFullName()<<"]"
- <<std::endl);
+
+ bbtkDebugMessage("connection",2,
+ "==> BlackBox::bbDisconnectInput(\""<<name
+ <<"\","<<c->GetFullName()<<") ["
+ <<bbGetFullName()<<"]"
+ <<std::endl);
+
+ if (!c)
+ {
+
+ bbtkDebugMessage("connection",2,"c==0"<<std::endl);
+ return;
+ }
InputConnectorMapType::iterator i = bbGetInputConnectorMap().find(name);
if (i==bbGetInputConnectorMap().end())
}
i->second->UnsetConnection(c);
- bbtkDebugDecTab("Kernel",7);
+ bbtkDebugMessage("connection",2,
+ "<== BlackBox::bbDisconnectInput(\""<<name
+ <<"\","<<c->GetFullName()<<") ["
+ <<bbGetFullName()<<"]"
+ <<std::endl);
+
}
//=========================================================================
//=========================================================================
/// Disconnects the output <name> from the connection c
- void BlackBox::bbDisconnectOutput( const std::string& name, Connection::Pointer c)
+ void BlackBox::bbDisconnectOutput( const std::string& name, Connection* c)
{
- if (!c) return;
- bbtkDebugMessageInc("Kernel",7,
- "BlackBox::bbDisconnectOutput(\""<<name
- <<"\","<<c<<") ["
- <<bbGetFullName()<<"]"
- <<std::endl);
+ bbtkDebugMessage("connection",2,
+ "==> BlackBox::bbDisconnectOutput(\""<<name
+ <<"\","<<c->GetFullName()<<") ["
+ <<bbGetFullName()<<"]"
+ <<std::endl);
+ if (!c)
+ {
+
+ bbtkDebugMessage("connection",2,"c==0"<<std::endl);
+ return;
+ }
OutputConnectorMapType::iterator i = bbGetOutputConnectorMap().find(name);
if (i==bbGetOutputConnectorMap().end())
}
i->second->UnsetConnection(c);
- bbtkDebugDecTab("Kernel",7);
+ bbtkDebugMessage("connection",2,
+ "<== BlackBox::bbDisconnectOutput(\""<<name
+ <<"\","<<c->GetFullName()<<") ["
+ <<bbGetFullName()<<"]"
+ <<std::endl);
}
//=========================================================================
{
if (i->second)
{
- Connection::Pointer con = i->second->GetConnection();
+ Connection* con = i->second->GetConnection();
if (con!=NULL){
- BlackBox::Pointer a=con->GetBlackBoxFrom();
- BlackBox::Pointer b=con->GetBlackBoxTo();
+ BlackBox::Pointer a=con->GetOriginalBlackBoxFrom();
+ BlackBox::Pointer b=con->GetOriginalBlackBoxTo();
fprintf(ff," ");
a->bbWriteDotInputOutputName(ff,false,detail,level);
if (detail==1)
{
- fprintf(ff,":%s",con->GetBlackBoxFromOutput().c_str());
+ fprintf(ff,":%s",con->GetOriginalBlackBoxFromOutput().c_str());
}
fprintf(ff,"->");
b->bbWriteDotInputOutputName(ff,true,detail,level);
if (detail==1)
{
- fprintf(ff,":%s",con->GetBlackBoxToInput().c_str());
+ fprintf(ff,":%s",con->GetOriginalBlackBoxToInput().c_str());
}
fprintf(ff,"%s\n",";");
} // if con
ivalue.push_back(bbGetInputAsString(i->first));
if (ivalue.back().size()>valuelmax) valuelmax = ivalue.back().size();
std::string s("");
- Connection::Pointer con = i->second->GetConnection();
+ Connection* con = i->second->GetConnection();
if (con!=0){
- s = con->GetBlackBoxFrom()->bbGetName();
+ s = con->GetOriginalBlackBoxFrom()->bbGetName();
s += ".";
- s += con->GetBlackBoxFromOutput();
+ s += con->GetOriginalBlackBoxFromOutput();
} // if con
iconn.push_back(s);
}
ovalue.push_back(bbGetOutputAsString(o->first));
if (ovalue.back().size()>valuelmax) valuelmax = ovalue.back().size();
std::vector<std::string> ss;
- const std::vector<Connection::WeakPointer>& con
+ const std::vector<Connection*>& con
= o->second->GetConnectionVector();
- std::vector<Connection::WeakPointer>::const_iterator c;
+ std::vector<Connection*>::const_iterator c;
for (c=con.begin();c!=con.end();++c)
{
std::string s;
- s = (*c).lock()->GetBlackBoxTo()->bbGetName();
+ s = (*c)->GetOriginalBlackBoxTo()->bbGetName();
s += ".";
- s += (*c).lock()->GetBlackBoxToInput();
+ s += (*c)->GetOriginalBlackBoxToInput();
ss.push_back(s);
} // if con
oconn.push_back(ss);
//=========================================================================
void BlackBox::Check(bool recursive)
{
- bbtkMessage("Debug",1,"*** Checking Black Box "<<(void*)this<<" ["<<bbGetFullName()
+ bbtkMessage("debug",1,"*** Checking Black Box "<<(void*)this<<" ["<<bbGetFullName()
<<"] ... OK"<<std::endl);
}
//=========================================================================