Program: bbtk
Module: $RCSfile: bbtkBlackBox.cxx,v $
Language: C++
- Date: $Date: 2010/01/21 16:03:17 $
- Version: $Revision: 1.49 $
+ Date: $Date: 2011/03/01 14:50:28 $
+ Version: $Revision: 1.50 $
=========================================================================*/
/* ---------------------------------------------------------------------
namespace bbtk
{
-
-
static bool bbmgSomeBoxExecuting = false;
static bool bbmgFreezeExecution = false;
static std::set<BlackBox::WeakPointer> bbmgExecutionList;
bbGetOutputConnectorMap()[o->second->GetName()]
= new BlackBoxOutputConnector(GetThisPointer<BlackBox>());
}
-
}
//=========================================================================
delete (o->second);
}
- bbtkDebugDecTab("kernel",8);
-
+ bbtkDebugDecTab("kernel",8);
}
//=========================================================================
}
bbtkDebugDecTab("kernel",9);
-
}
//=========================================================================
#ifdef USE_WXWIDGETS
|| Wx::IsSomeWindowAlive()
#endif
- );
+ );
}
//=========================================================================
const std::string& p = bbmBoxProcessMode;
if ( (p == "0") ||
(p == "P") || (p == "p") ||
- (p == "Pipeline") || (p == "pipeline") ) return Pipeline;
+ (p == "Pipeline") || (p == "pipeline") ) return BlackBox::Pipeline;
if ( (p == "1") ||
(p == "A") || (p == "a") ||
- (p == "Always") || (p == "always") ) return Always;
+ (p == "Always") || (p == "always") ) return BlackBox::Always;
if ( (p == "2") ||
(p == "R") || (p == "r") ||
(p == "Reactive") || (p == "reactive") )
- return Reactive;
+ return BlackBox::Reactive;
/*
if ( (p == "3") ||
(p == "F") || (p == "f") ||
//=========================================================================
bool BlackBox::bbBoxProcessModeIsReactive() const
{
- return (bbGetBoxProcessModeValue() == Reactive);
+ return (bbGetBoxProcessModeValue() == BlackBox::Reactive);
}
//=========================================================================
//=========================================================================
bool BlackBox::bbBoxProcessModeIsAlways() const
{
- return (bbGetBoxProcessModeValue() == Always);
+ return (bbGetBoxProcessModeValue() == BlackBox::Always);
}
//=========================================================================
"=> BlackBox::bbSignalOutputModification("
<<reaction<<")"
<<"]"<<std::endl);
-
+
OutputConnectorMapType::iterator i;
for ( i = bbGetOutputConnectorMap().begin();
i != bbGetOutputConnectorMap().end(); ++i)
bbtkBlackBoxDebugMessage("change",5,
"<= BlackBox::bbSignalOutputModification()"
<<std::endl);
-
}
//=========================================================================
//=========================================================================
"<= BlackBox::bbSignalOutputModification("
<<output<<")"
<<std::endl);
-
}
//=========================================================================
//=========================================================================
bbtkBlackBoxDebugMessage("change",5,
"<= BlackBox::bbSignalOutputModification(vector of outputs)"
<<std::endl);
-
}
//=========================================================================
bbSetExecuting(false);
bbGlobalSetSomeBoxExecuting(wasExecuting);
- return;
-
+ return;
}
//=========================================================================
bbtkBlackBoxDebugMessage("process",4,
"<= BlackBox::bbUpdateInputs()"
- <<std::endl);
-
-
+ <<std::endl);
return s;
}
//=========================================================================
bbtkBlackBoxDebugMessage("process",4,
"<= BlackBox::bbComputePostProcessStatus()"
- <<std::endl);
-
+ <<std::endl);
}
//==================================================================
<<name<<"\","<<c->GetFullName()<<")"
<<std::endl);
-
InputConnectorMapType::iterator i = bbGetInputConnectorMap().find(name);
if (i==bbGetInputConnectorMap().end())
{
i->second->SetConnection(c);
// The input *MUST* be set OUTOFDATE to update its input on next execution
bbSetStatusAndPropagate(i->second,OUTOFDATE);
-
+
bbtkBlackBoxDebugMessage("connection",2,
"<== BlackBox::bbConnectInput(\""
<<name<<"\","<<c->GetFullName()<<")"
- <<std::endl);
-
+ <<std::endl);
}
//=========================================================================
"==> BlackBox::bbConnectOutput(\""<<name<<"\","
<<c->GetFullName()<<")"
<<std::endl);
-
+
OutputConnectorMapType::iterator i = bbGetOutputConnectorMap().find(name);
if (i==bbGetOutputConnectorMap().end())
{
bbtkBlackBoxDebugMessage("connection",2,
"<== BlackBox::bbConnectOutput(\""<<name<<"\","
<<c->GetFullName()<<")"
- <<std::endl);
-
+ <<std::endl);
}
//=========================================================================
bbtkBlackBoxDebugMessage("connection",2,
"==> BlackBox::bbDisconnectInput(\""<<name
<<"\","<<c->GetFullName()<<")"
- <<std::endl);
-
+ <<std::endl);
if (!c)
{
Program: bbtk
Module: $RCSfile: bbtkBlackBox.h,v $
Language: C++
- Date: $Date: 2009/10/13 17:39:21 $
- Version: $Revision: 1.30 $
+ Date: $Date: 2011/03/01 14:50:28 $
+ Version: $Revision: 1.31 $
=========================================================================*/
/* ---------------------------------------------------------------------
namespace bbtk
{
-
struct Void { Void(int = 0) {} };
class Factory;
class Connection;
class BlackBoxOutputConnector;
-
-
class BBTK_EXPORT BlackBox : public Object
{
BBTK_ABSTRACT_OBJECT_INTERFACE(BlackBox);
/// Sets the value of the input 'BoxProcessMode'
void bbSetInputBoxProcessMode(std::string a) { bbmBoxProcessMode = a; }
/// The possible values of the input 'BoxProcessMode'
- typedef enum
- {
- Pipeline,
- Always,
- Reactive
- }
+
+ typedef enum
+ {
+ Pipeline,
+ Always,
+ Reactive
+ }
BoxProcessModeValue;
+
/// Returns the "decoded" value of the input "BoxProcessMode"
BoxProcessModeValue bbGetBoxProcessModeValue() const;
/// Returns true iff the input 'BoxProcessMode' is set to 'Reactive' (or a synonym)
//@}
//==================================================================
-
-
-
virtual void bbPrintHelp(BlackBox::Pointer parentblackbox,
int detail, int level
);
protected:
-
-
//==================================================================
/// @name User redefinable methods
/// Virtual methods which can be redefined by inherited classes
//@{
-
//==================================================================
/// User can redefine this method to set
/// the default values of the box inputs and outputs
//==================================================================
-
-
//==================================================================
/// Write Graphviz-dot description in file.
bool inputoutput,
int detail, int level);
-
-
virtual BlackBox::Pointer bbFindBlackBox(const std::string &blackboxname)
- { return BlackBox::Pointer();}
+ { return BlackBox::Pointer();}
virtual void Check(bool recursive = true);
-
-
-
//==================================================================
// PROTECTED PART : ACCESSIBLE TO THE BlackBox DEVELOPER
// (IN INHERITED CLASSES)
//@}
//==================================================================
-
-
private:
//==================================================================
friend class Connection;
/// which means execute in response to an input change
virtual bool bbCanReact() const;
-
-
-
-
/// Returns true iff the box is executing
bool bbGetExecuting() const { return bbmExecuting; }
/// Sets the bbmExecuting bool returned by bbGetExecuting
void bbSetExecuting(bool b) { bbmExecuting = b; }
-
-
protected:
//==================================================================
//JCP 21-09-20 09 delete this throws and exception change due to compiler version changing and boost version
virtual int bbDelete() { delete this;
- return 0; }
+ return 0; }
//==================================================================
/// Map that contains the input connectors of the black box
InputConnectorMapType mInputConnectorMap;
//==================================================================
-
-
};
// Class BlackBox
-
/// Convenient macro to create output observer callbacks (freehand functions) from object and method pointer (see samples/SampleOutputObserver)
#define BBTK_MAKE_OUTPUT_OBSERVER(OBJECT,METHOD) \
boost::bind( METHOD, OBJECT, _1, _2, _3)
-
-
-
-
}
// namespace bbtk
#endif
-