Program: bbtk
Module: $RCSfile: bbtkBlackBox.cxx,v $
Language: C++
- Date: $Date: 2011/03/03 14:37:57 $
- Version: $Revision: 1.52 $
+ Date: $Date: 2011/07/02 08:00:34 $
+ Version: $Revision: 1.53 $
=========================================================================*/
/* ---------------------------------------------------------------------
//=========================================================================
bool BlackBox::bbCanReact() const
{
+
return ( bbGlobalGetSomeBoxExecuting()
#ifdef USE_WXWIDGETS
|| Wx::IsSomeWindowAlive()
}
}
- if ( ( bbBoxProcessModeIsReactive() ||
- (c==bbGetInputConnectorMap().find("BoxExecute")->second))
+
+ if ( ( bbBoxProcessModeIsReactive() || (c==bbGetInputConnectorMap().find("BoxExecute")->second))
&& (bbCanReact() ) )
{
bbtkBlackBoxDebugMessage("change",2,
<<reaction<<")"
<<"]"<<std::endl);
+
OutputConnectorMapType::iterator i;
for ( i = bbGetOutputConnectorMap().begin();
i != bbGetOutputConnectorMap().end(); ++i)
// {
i->second->SignalChange(GetThisPointer<BlackBox>(),i->first);
// }
- }
+ } // for
- if (reaction) bbGlobalProcessExecutionList();
+ if (reaction)
+ {
+ bbGlobalProcessExecutionList();
+ }
bbtkBlackBoxDebugMessage("change",5,
"<= BlackBox::bbSignalOutputModification()"
<<std::endl);
}
//=========================================================================
+
+
+
//=========================================================================
void BlackBox::bbSignalOutputModification(const std::string& output,
bool reaction)
std::string upath;
pkgname = Utilities::ExtractScriptName(name,upath);
+
bbtkMessage("interpreter",3,
"package name:[" << pkgname
<< "] path:[" << upath << "]" << std::endl);
Filenames.clear();
//int nbFiles =
Utilities::Explore(*i, false, Filenames);
-
+
for (std::vector<std::string>::iterator j = Filenames.begin();
j!= Filenames.end(); ++j)
{
tcsetattr(0,TCSANOW,&ter);
#endif
+
mCommandLine = true;
bool again = true;
// bool insideComment = false; // for multiline comment
Program: bbtk
Module: $RCSfile: bbstdGetVectorElement.h,v $
Language: C++
- Date: $Date: 2009/07/23 12:27:36 $
- Version: $Revision: 1.6 $
+ Date: $Date: 2011/07/02 08:00:35 $
+ Version: $Revision: 1.7 $
=========================================================================*/
/* ---------------------------------------------------------------------
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_OUTPUT(Out,T);
BBTK_PROCESS(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_OUTPUT(GetVectorElement,Out,"Output",T);
BBTK_END_DESCRIBE_TEMPLATE_BLACK_BOX(GetVectorElement);
//=================================================================
template <class T>
void GetVectorElement<T>::DoIt()
{
- // unsigned int i = bbGetInputI();
- bbSetOutputOut(bbGetInputIn()[bbGetInputI()]);
+ if (( bbGetInputI() < bbGetInputIn().size() ) && ( bbGetInputI() >= 0 ) )
+ {
+ bbSetOutputOut( bbGetInputIn()[bbGetInputI()] );
+ } else {
+ bbSetOutputOut( bbGetInputErrorValue() );
+ }
}
//=================================================================
Program: bbtk
Module: $RCSfile: bbvtkGetVectorElement.h,v $
Language: C++
- Date: $Date: 2010/04/01 15:46:54 $
- Version: $Revision: 1.1 $
+ Date: $Date: 2011/07/02 08:00:36 $
+ Version: $Revision: 1.2 $
=========================================================================*/
/* ---------------------------------------------------------------------
{
BBTK_TEMPLATE_BLACK_BOX_INTERFACE(GetVectorElement,bbtk::AtomicBlackBox,T);
BBTK_DECLARE_INPUT(In,std::vector<T>);
- BBTK_DECLARE_INPUT(I,int);
+ BBTK_DECLARE_INPUT(I,int);
+ BBTK_DECLARE_INPUT(ErrorValue,T);
BBTK_DECLARE_OUTPUT(Out,T);
BBTK_PROCESS(DoIt);
void DoIt();
BBTK_DESCRIPTION("Gets the i-th element from the input vector ("+bbtk::TypeName<std::vector<T> >());
typedef std::vector<T> Tvector;
BBTK_TEMPLATE_INPUT(GetVectorElement, In,"Input",Tvector);
- BBTK_TEMPLATE_INPUT(GetVectorElement, I, "Input",int);
+ BBTK_TEMPLATE_INPUT(GetVectorElement, I, "Input",int);
+ BBTK_TEMPLATE_INPUT(GetVectorElement, ErrorValue, "ErrorValue",T);
BBTK_TEMPLATE_OUTPUT(GetVectorElement,Out,"Output",T);
BBTK_END_DESCRIBE_TEMPLATE_BLACK_BOX(GetVectorElement);
//=================================================================
template <class T>
void GetVectorElement<T>::DoIt()
{
- // unsigned int i = bbGetInputI();
- bbSetOutputOut(bbGetInputIn()[bbGetInputI()]);
+ if (( bbGetInputI() < bbGetInputIn().size() ) && ( bbGetInputI() >= 0 ) )
+ {
+ bbSetOutputOut( bbGetInputIn()[bbGetInputI()] );
+ } else
+ {
+ bbSetOutputOut( bbGetInputErrorValue() );
+ }
}
//=================================================================
// * TYPE is the C++ type of the input/output
// (the one provided in the attribute 'type' of the tag 'input')
-// ----------
+
+ // ----------
+ if (bbGetInputIn()!=NULL) {
vGreenToRedLut->SetHueRange(0.6667,0.0);
vGreenToRedLut->Build();
//temp->GetData( vMultipleContourMapper->GetOutput() );
//bbSetOutputOutTest( temp );
-// ---------- ]
-}
+
+ } // if
+
+} // process
+
+
+
//=====
// Before editing this file, make sure it's a file of your own (i.e.: it wasn't generated from xml description; if so : your modifications will be lost)
//=====
// * TYPE is the C++ type of the input/output
// (the one provided in the attribute 'type' of the tag 'input')
-
- spr -> SetFileName( bbGetInputIn().c_str() );
- sp = spr->GetOutput();
- sp -> Update();
- bbSetOutputOut( sp );
+ if ( bbGetInputIn().c_str()!="")
+ {
+ spr -> SetFileName( bbGetInputIn().c_str() );
+ sp = spr->GetOutput();
+ sp -> Update();
+ bbSetOutputOut( sp );
+ } else {
+ bbSetOutputOut( NULL );
+ }
}
//=====
// SET HERE THE DEFAULT INPUT/OUTPUT VALUES OF YOUR BOX
// Here we initialize the input 'In' to 0
bbSetInputIn("");
-
+ bbSetOutputOut( NULL );
+
}
//=====
// Before editing this file, make sure it's a file of your own (i.e.: it wasn't generated from xml description; if so : your modifications will be lost)