Program: bbtk
Module: $RCSfile: bbtkBlackBox.cxx,v $
Language: C++
- Date: $Date: 2011/07/02 08:00:34 $
- Version: $Revision: 1.53 $
+ Date: $Date: 2011/07/22 17:42:50 $
+ Version: $Revision: 1.54 $
=========================================================================*/
/* ---------------------------------------------------------------------
//=========================================================================
bool BlackBox::bbCanReact() const
{
-
return ( bbGlobalGetSomeBoxExecuting()
#ifdef USE_WXWIDGETS
|| Wx::IsSomeWindowAlive()
}
}
-
- 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"<<std::endl);
<<reaction<<")"
<<"]"<<std::endl);
-
OutputConnectorMapType::iterator i;
for ( i = bbGetOutputConnectorMap().begin();
i != bbGetOutputConnectorMap().end(); ++i)
// }
} // for
- if (reaction)
- {
- bbGlobalProcessExecutionList();
- }
+ if (reaction) bbGlobalProcessExecutionList();
bbtkBlackBoxDebugMessage("change",5,
"<= BlackBox::bbSignalOutputModification()"
<<std::endl);
}
//=========================================================================
-
-
-
+
+
//=========================================================================
void BlackBox::bbSignalOutputModification(const std::string& output,
bool reaction)
const BlackBoxOutputDescriptor* id = bbGetDescriptor()->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+ " } }" ;
if (this->bbGetDescriptor()->GetPackage())
{
- bbtkBlackBoxMessage("help",1,"Black Box '"<<bbGetName()<<"' <"<<
+ bbtkBlackBoxMessage("help",1,"Black Box '"<<bbGetName()<<"' <"<<
this->bbGetDescriptor()->GetPackage()->GetName()
<<"::"<<this->bbGetDescriptor()->GetTypeName()<<">"<<std::endl);
}
else
{
- bbtkBlackBoxMessage("help",1,"Black Box <::"<<this->bbGetDescriptor()->GetTypeName()<<">"<<std::endl);
+ bbtkBlackBoxMessage("help",1,"Black Box <::"<<this->bbGetDescriptor()->GetTypeName()<<">"<<std::endl);
}
/*
if (bbIsUpToDate())
{
- bbtkBlackBoxMessage("help",1,"Up-to-date ["<<mMaxInputChangeTime<<","
+ bbtkBlackBoxMessage("help",1,"Up-to-date ["<<mMaxInputChangeTime<<","
<<mMinOutputChangeTime<<"]"<<std::endl);
}
else
{
- bbtkBlackBoxMessage("help",1,"Out-of-date ["<<mMaxInputChangeTime<<","
+ bbtkBlackBoxMessage("help",1,"Out-of-date ["<<mMaxInputChangeTime<<","
<<mMinOutputChangeTime<<"]"<<std::endl);
}
*/
unsigned int valuelmax = 0;
// unsigned int connlmax = 0;
for ( i = mInputConnectorMap.begin(); i != mInputConnectorMap.end(); ++i )
- {
- 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()));
- }
+ {
+ 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<std::string> oname;
std::vector<std::string> ovalue;
std::vector<std::vector<std::string> > oconn;
std::vector<std::string> 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<std::string> ss;
- const std::vector<Connection*>& con
- = o->second->GetConnectionVector();
- std::vector<Connection*>::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<std::string> ss;
+ const std::vector<Connection*>& con
+ = o->second->GetConnectionVector();
+ std::vector<Connection*>::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 : "<<std::endl);
std::vector<std::string>::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," '"<<name<<" = '"<<value<<" <-- '"
- <<*i3<<"'");
- else
- bbtkBlackBoxMessage("help",1," '"<<name<<" = '"<<value);
- bbtkBlackBoxMessage("help",1," ["<<*i4<<"]"<<std::endl);
- }
+ 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," '"<<name<<" = '"<<value<<" <-- '" <<*i3<<"'");
+ else
+ bbtkBlackBoxMessage("help",1," '"<<name<<" = '"<<value);
+ bbtkBlackBoxMessage("help",1," ["<<*i4<<"]"<<std::endl);
+ }
if (oname.size())
- bbtkBlackBoxMessage("help",1," * Outputs : "<<std::endl);
+ bbtkBlackBoxMessage("help",1," * Outputs : "<<std::endl);
else
- bbtkBlackBoxMessage("help",1," * No outputs"<<std::endl);
+ bbtkBlackBoxMessage("help",1," * No outputs"<<std::endl);
std::vector<std::vector<std::string> >::iterator i5;
for (i1=oname.begin(),i2=ovalue.begin(),i5=oconn.begin(),i4=ostatus.begin();
- i1!=oname.end(),i2!=ovalue.end(),i5!=oconn.end(),i4!=ostatus.end();
- ++i1,++i2,++i4,++i5)
- {
- std::string name(*i1);
- name += "'";
- name.append(1+namelmax-name.size(),' ');
- std::string value(*i2);
- value += "'";
- value.append(1+valuelmax-value.size(),' ');
- if (!(*i5).size())
- bbtkBlackBoxMessage("help",1," '"<<name<<" = '"<<value);
- else
- {
- std::string pref = " '"+name+" = '"+value;
- for (i3=i5->begin();i3!=i5->end();++i3)
- {
- bbtkBlackBoxMessage("help",1,pref<<" --> '"<<*i3<<"'");
- pref.replace(0,pref.size(),pref.size(),' ');
- }
- }
- bbtkBlackBoxMessage("help",1," ["<<*i4<<"]"<<std::endl);
- }
+ i1!=oname.end(),i2!=ovalue.end(),i5!=oconn.end(),i4!=ostatus.end();
+ ++i1,++i2,++i4,++i5)
+ {
+ std::string name(*i1);
+ name += "'";
+ name.append(1+namelmax-name.size(),' ');
+ std::string value(*i2);
+ value += "'";
+ value.append(1+valuelmax-value.size(),' ');
+ if (!(*i5).size())
+ bbtkBlackBoxMessage("help",1," '"<<name<<" = '"<<value);
+ else
+ {
+ std::string pref = " '"+name+" = '"+value;
+ for (i3=i5->begin();i3!=i5->end();++i3)
+ {
+ bbtkBlackBoxMessage("help",1,pref<<" --> '"<<*i3<<"'");
+ pref.replace(0,pref.size(),pref.size(),' ');
+ }
+ }
+ bbtkBlackBoxMessage("help",1," ["<<*i4<<"]"<<std::endl);
+ }
}
//=========================================================================
Program: bbtk
Module: $RCSfile: bbstdGetVectorElement.h,v $
Language: C++
- Date: $Date: 2011/07/02 08:00:35 $
- Version: $Revision: 1.7 $
+ Date: $Date: 2011/07/22 17:42:51 $
+ Version: $Revision: 1.8 $
=========================================================================*/
/* ---------------------------------------------------------------------
// BlackBox declaration
template <class T>
class bbstd_EXPORT GetVectorElement : public bbtk::AtomicBlackBox
- {
+ {
BBTK_TEMPLATE_BLACK_BOX_INTERFACE(GetVectorElement,bbtk::AtomicBlackBox,T);
BBTK_DECLARE_INPUT(In,std::vector<T>);
- BBTK_DECLARE_INPUT(I,int);
- BBTK_DECLARE_INPUT(ErrorValue,T);
+ BBTK_DECLARE_INPUT(I,int);
+ BBTK_DECLARE_INPUT(ErrorValue,T);
BBTK_DECLARE_OUTPUT(Out,T);
BBTK_PROCESS(DoIt);
- void DoIt();
+ void DoIt();
};
//=================================================================
typedef std::vector<T> Tvector;
BBTK_TEMPLATE_INPUT(GetVectorElement, In,"Input",Tvector);
BBTK_TEMPLATE_INPUT(GetVectorElement, I, "Input",int);
- BBTK_TEMPLATE_INPUT(GetVectorElement, ErrorValue, "ErrorValue",T);
+ BBTK_TEMPLATE_INPUT(GetVectorElement, ErrorValue, "ErrorValue",T);
BBTK_TEMPLATE_OUTPUT(GetVectorElement,Out,"Output",T);
BBTK_END_DESCRIBE_TEMPLATE_BLACK_BOX(GetVectorElement);
//=================================================================
bbSetOutputOut( bbGetInputIn()[bbGetInputI()] );
} else {
bbSetOutputOut( bbGetInputErrorValue() );
- }
+ }
}
//=================================================================