#include <bbtkBlackBox.h>
Common inputs / outputs to all boxes | |
enum | BoxProcessModeValue { bbPipeline, bbAlways, bbReactive } |
The possible values of the input 'BoxProcessMode'. More... | |
std::string | bbGetInputBoxProcessMode () |
Returns the value of the input 'BoxProcessMode'. | |
void | bbSetInputBoxProcessMode (std::string a) |
Sets the value of the input 'BoxProcessMode'. | |
BoxProcessModeValue | bbGetBoxProcessModeValue () const |
Returns the "decoded" value of the input "BoxProcessMode". | |
virtual bool | bbBoxProcessModeIsReactive () const |
Returns true iff the input 'BoxProcessMode' is set to 'Reactive' (or a synonym). | |
virtual bool | bbBoxProcessModeIsAlways () const |
Returns true iff the input 'BoxProcessMode' is set to 'Always' (or a synonym). | |
Void | bbGetInputBoxExecute () |
Returns the value of the input 'BoxExecute'. | |
void | bbSetInputBoxExecute (Void=0) |
Sets the value of the input 'BoxExecute'. | |
Void | bbGetOutputBoxChange () |
Returns the value of the output 'BoxChange'. | |
void | bbSetOutputBoxChange (Void=0) |
Sets the value of the output 'BoxChange'. | |
Classes | |
struct | Deleter |
Public Types | |
typedef BlackBox | Self |
typedef boost::shared_ptr< Self > | Pointer |
typedef boost::weak_ptr< Self > | WeakPointer |
typedef boost::signals::trackable | OutputChangeObserverType |
typedef boost::signal< void(bbtk::BlackBox::Pointer, const std::string &, IOStatus)> | OutputChangeSignalType |
typedef OutputChangeSignalType::slot_function_type | OutputChangeCallbackType |
typedef std::map< std::string, BlackBoxOutputConnector * > | OutputConnectorMapType |
The type of map of output connector pointers. | |
typedef std::map< std::string, BlackBoxInputConnector * > | InputConnectorMapType |
The type of map of input connector pointers. | |
Public Member Functions | |
virtual BlackBox::Pointer | bbClone (const std::string &name)=0 |
Returns a pointer on a clone of the box with name <name>. | |
virtual void | bbGetHelp (bool full=true) const |
Prints the Help on the BlackBox type. | |
virtual void | bbPrintHelp (BlackBox::Pointer parentblackbox, int detail, int level) |
void | bbInsertHTMLGraph (std::ofstream &s, int detail, int level, bool instanceOrtype, const std::string &output_dir, bool relative_link) |
Does nothing here : overloaded in ComplexBlackBox. | |
virtual std::string | GetObjectName () const |
virtual std::string | GetObjectInfo () const |
virtual size_t | GetObjectSize () const |
virtual size_t | GetObjectInternalSize () const |
virtual size_t | GetObjectRecursiveSize () const |
long | GetUseCount () |
Pipeline processing methods | |
Methods which participate to pipeline processing. | |
virtual void | bbExecute (bool force=false) |
Main processing method of the box. | |
General accessors | |
Methods which give access to general informations on the box | |
virtual BlackBoxDescriptor::Pointer | bbGetDescriptor () const =0 |
Returns the pointer on the descriptor of the box. | |
const std::string & | bbGetTypeName () const |
Returns the Name of the Type of the BlackBox. | |
const std::string & | bbGetName () const |
Returns the name of the BlackBox (instance). | |
virtual std::string | bbGetFullName () const |
Returns the full name of the BlackBox (instance+type). | |
virtual std::string | bbGetNameWithParent () const |
Returns the name with the name of the parent prepended if any. | |
BlackBox::Pointer | bbGetParent () const |
Returns the parent of the BlackBox, i.e the BlackBox that contains it (0 if none). | |
Inputs/Outputs related methods | |
Methods related to the box inputs and outputs | |
virtual bool | bbHasInput (const std::string &label) const |
Returns true iff the BlackBox has an input of name label. | |
virtual TypeInfo | bbGetInputType (const std::string &label) const |
Gets the input type of a given label. | |
IOStatus | bbGetInputStatus (const std::string &name) const |
Gets the status of the input called <name>. | |
virtual Data | bbGetInput (const std::string &name)=0 |
Gets the data of the input called <name>. | |
std::string | bbGetInputAsString (const std::string &input) |
Gets the data of the input called <name> as a string using an Adaptor if possible (else returns empty string). | |
virtual void | bbSetInput (const std::string &name, Data data, bool update_time=true)=0 |
If update_time is false then does not update ChangeTime of input. | |
virtual void | bbBruteForceSetInputPointer (const std::string &name, void *data, bool update_time=true)=0 |
[SYSTEM]: Sets the data of the input called <name> which **MUST* be a pointer | |
virtual bool | bbHasOutput (const std::string &label) const |
Returns true iff the BlackBox has an output of name label. | |
virtual TypeInfo | bbGetOutputType (const std::string &label) const |
Gets the output type of a given label. | |
virtual Data | bbGetOutput (const std::string &name)=0 |
Gets the data of the output called <name>. | |
std::string | bbGetOutputAsString (const std::string &output) |
Gets the data of the output called <name> as a string using an Adaptor if possible (else returns empty string). | |
virtual void | bbSetOutput (const std::string &name, Data data)=0 |
Sets the data of the output called <name>. | |
InputConnectorMapType & | bbGetInputConnectorMap () |
Returns the input connectors map. | |
const InputConnectorMapType & | bbGetInputConnectorMap () const |
Returns the input connectors map (const). | |
BlackBoxInputConnector & | bbGetInputConnector (const std::string &n) |
Returns the input connector. | |
const BlackBoxInputConnector & | bbGetInputConnector (const std::string &n) const |
Returns the input connector (const). | |
OutputConnectorMapType & | bbGetOutputConnectorMap () |
Returns the output connectors map. | |
const OutputConnectorMapType & | bbGetOutputConnectorMap () const |
Returns the output connectors map (const). | |
BlackBoxOutputConnector & | bbGetOutputConnector (const std::string &n) |
Returns the output connector. | |
const BlackBoxOutputConnector & | bbGetOutputConnector (const std::string &n) const |
Returns the output connector (const). | |
Output signals / observers related methods | |
Methods related to signals emitted by outputs and the | |
void | bbAddOutputObserver (const std::string &output_name, OutputChangeCallbackType f) |
void | bbRemoveOutputObserver (const std::string &output_name, OutputChangeCallbackType f) |
virtual void | bbSignalOutputModification (bool reaction=true) |
virtual void | bbSignalOutputModification (const std::string &output_name, bool reaction=true) |
virtual void | bbSignalOutputModification (const std::vector< std::string > &output_name, bool reaction=true) |
Window related methods | |
virtual void | bbSetShown (bool) |
virtual bool | bbIsShown () |
Static Public Member Functions | |
static void | InsertInObjectList (Pointer) |
static void | RemoveFromObjectList (WeakPointer) |
static void | InsertInPackageList (Pointer) |
static void | ReleasePackages () |
static void | PrintObjectListInfo (const std::string &name) |
static void | PrintObjectInfo (const Pointer &o) |
static long | GetObjectsCount () |
Manage the execution | |
static bool | bbGlobalGetSomeBoxExecuting () |
static void | bbGlobalSetSomeBoxExecuting (bool b) |
static void | bbGlobalSetFreezeExecution (bool b) |
static bool | bbGlobalGetFreezeExecution () |
static void | bbGlobalAddToExecutionList (BlackBox::Pointer b) |
static void | bbGlobalProcessExecutionList () |
Protected Member Functions | |
BlackBox () | |
BlackBox (const BlackBox &) | |
virtual | ~BlackBox () |
virtual void | bbWriteDotFileBlackBox (FILE *ff, BlackBox::Pointer parentblackbox, int detail, int level, bool instanceOrtype, bool relative_link) |
Write Graphviz-dot description in file. | |
virtual void | bbWriteDotInputOutputName (FILE *ff, bool inputoutput, int detail, int level) |
Auxiliary method for bbWriteDotFileBlackBox. | |
virtual BlackBox::Pointer | bbFindBlackBox (const std::string &blackboxname) |
virtual void | Check (bool recursive=true) |
BlackBox (const std::string &name) | |
Constructor that take the BlackBox's name. | |
BlackBox (BlackBox &from, const std::string &name) | |
Constructor from an existing box (copy) with a new name. | |
virtual void | bbSetStatusAndPropagate (BlackBoxInputConnector *c, IOStatus s) |
virtual int | bbDelete () |
void | LockThis () |
void | UnLockThis () |
template<class U > | |
boost::shared_ptr< U > | GetThisPointer () const |
User redefinable methods | |
Virtual methods which can be redefined by inherited classes | |
virtual void | bbUserSetDefaultValues () |
virtual void | bbUserInitializeProcessing () |
virtual void | bbUserFinalizeProcessing () |
virtual void | bbUserOnShow () |
Pipeline processing methods | |
Methods which participate to pipeline processing. | |
virtual void | bbRecursiveExecute (Connection::Pointer caller) |
IOStatus | bbUpdateInputs () |
virtual void | bbCreateWindow () |
virtual void | bbShowWindow () |
virtual void | bbProcess () |
void | bbComputePostProcessStatus () |
Computes the final IOStatus of inputs and outputs after processing. | |
Box con(des)struction / initi(fin)alization methods | |
virtual void | bbAllocateConnectors () |
Allocates the i/o connectors of the black box. | |
virtual void | bbDesallocateConnectors () |
Desallocates the i/o connectors of the black box. | |
virtual void | bbCopyIOValues (BlackBox &from) |
Copies the values of the inputs/output from the BlackBox from. | |
void | bbInitializeProcessing () |
void | bbFinalizeProcessing () |
virtual void | bbRecursiveInitializeProcessing () |
virtual void | bbRecursiveFinalizeProcessing () |
Static Protected Member Functions | |
template<class U > | |
static boost::shared_ptr< U > | MakeBlackBoxPointer (U *s, bool lock=false) |
Like Object::MakePointer but returns a boost::shared_pointer which uses a BlackBox::Deleter to delete the object instead of the default Object::Deleter. | |
template<class U > | |
static boost::shared_ptr< U > | MakePointer (U *s, bool lock=false) |
template<class U , class D > | |
static boost::shared_ptr< U > | MakePointer (U *s, const D &del, bool lock=false) |
Private Member Functions | |
void | bbSetParent (BlackBox::Pointer p) |
Sets the parent of the BlackBox. | |
virtual bool | bbCanReact () const |
bool | bbGetExecuting () const |
Returns true iff the box is executing. | |
void | bbSetExecuting (bool b) |
Sets the bbmExecuting bool returned by bbGetExecuting. | |
Input/output connection/disconnection | |
virtual void | bbConnectInput (const std::string &name, Connection *c) |
Connects the input <name> to the connection c. | |
virtual void | bbConnectOutput (const std::string &name, Connection *c) |
Connects the output <name> to the connection c. | |
virtual void | bbDisconnectInput (const std::string &name, Connection *c) |
Disconnects the input <name> from the connection c. | |
virtual void | bbDisconnectOutput (const std::string &name, Connection *c) |
Disconnects the output <name> from the connection c. | |
Private Attributes | |
bool | bbmInitialized |
Is the box initialized ? | |
bool | bbmExecuting |
Is the box executing ? | |
std::string | bbmName |
The name of the black-box. | |
std::string | bbmPackageName |
The name of the package to which it belongs. | |
std::string | bbmBoxProcessMode |
BlackBox::WeakPointer | bbmParent |
The parent of the black box in the ComplexBlackBox hierarchy. | |
OutputConnectorMapType | mOutputConnectorMap |
Map that contains the output connectors of the black box. | |
InputConnectorMapType | mInputConnectorMap |
Map that contains the input connectors of the black box. | |
Friends | |
struct | Object::Deleter |
class | Connection |
class | ComplexBlackBox |
Definition at line 72 of file bbtkBlackBox.h.
typedef std::map<std::string, BlackBoxInputConnector*> bbtk::BlackBox::InputConnectorMapType |
typedef OutputChangeSignalType::slot_function_type bbtk::BlackBox::OutputChangeCallbackType |
Definition at line 87 of file bbtkBlackBox.h.
typedef boost::signals::trackable bbtk::BlackBox::OutputChangeObserverType |
Definition at line 74 of file bbtkBlackBox.h.
typedef boost::signal<void (bbtk::BlackBox::Pointer, const std::string&, IOStatus)> bbtk::BlackBox::OutputChangeSignalType |
Definition at line 85 of file bbtkBlackBox.h.
typedef std::map<std::string, BlackBoxOutputConnector*> bbtk::BlackBox::OutputConnectorMapType |
typedef boost::shared_ptr<Self> bbtk::BlackBox::Pointer |
Reimplemented from bbtk::Object.
Reimplemented in bbtk::ComplexBlackBox, bbtk::QtBlackBox, bbtk::WidgetBlackBox< W >, bbtk::WxBlackBox, bbtk::WidgetBlackBox< QWidget >, and bbtk::WidgetBlackBox< wxWindow >.
Definition at line 74 of file bbtkBlackBox.h.
typedef BlackBox bbtk::BlackBox::Self |
Reimplemented in bbtk::ComplexBlackBox, bbtk::QtBlackBox, bbtk::WidgetBlackBox< W >, bbtk::WxBlackBox, bbtk::WidgetBlackBox< QWidget >, and bbtk::WidgetBlackBox< wxWindow >.
Definition at line 74 of file bbtkBlackBox.h.
typedef boost::weak_ptr<Self> bbtk::BlackBox::WeakPointer |
Reimplemented from bbtk::Object.
Reimplemented in bbtk::ComplexBlackBox, bbtk::QtBlackBox, bbtk::WidgetBlackBox< W >, bbtk::WxBlackBox, bbtk::WidgetBlackBox< QWidget >, and bbtk::WidgetBlackBox< wxWindow >.
Definition at line 74 of file bbtkBlackBox.h.
The possible values of the input 'BoxProcessMode'.
Definition at line 297 of file bbtkBlackBox.h.
00298 { 00299 bbPipeline, 00300 bbAlways, 00301 bbReactive 00302 }
bbtk::BlackBox::BlackBox | ( | ) | [protected] |
bbtk::BlackBox::BlackBox | ( | const BlackBox & | ) | [protected] |
bbtk::BlackBox::~BlackBox | ( | ) | [protected, virtual] |
Definition at line 156 of file bbtkBlackBox.cxx.
References bbDesallocateConnectors(), bbmName, and bbtkBlackBoxDebugMessage.
00157 { 00158 bbtkBlackBoxDebugMessage("object",4,"==> BlackBox::~BlackBox() ["<<bbmName 00159 <<"]"<<std::endl); 00160 this->bbDesallocateConnectors(); 00161 bbtkBlackBoxDebugMessage("object",4,"<== BlackBox::~BlackBox() ["<<bbmName 00162 <<"]"<<std::endl); 00163 }
bbtk::BlackBox::BlackBox | ( | const std::string & | name | ) | [protected] |
Constructor that take the BlackBox's name.
Definition at line 105 of file bbtkBlackBox.cxx.
References bbtkBlackBoxDebugMessage.
00106 : 00107 // bbmStatus(MODIFIED), 00108 bbmInitialized(false), 00109 bbmExecuting(false), 00110 bbmName(name), 00111 bbmBoxProcessMode("Pipeline"), 00112 bbmParent() 00113 00114 { 00115 //JCP 02-11-09 00116 // bbmBoxProcessMode = "Pipeline"; 00117 //std::cout<<"JCP BlackBox::BlackBox(const std::string &name) name=" <<name 00118 // <<"bbmBoxProcessMode="<<bbmBoxProcessMode<<std::endl; 00119 bbtkBlackBoxDebugMessage("object",4,"==> BlackBox::BlackBox(\"" 00120 <<name<<"\")"<<std::endl); 00121 bbtkBlackBoxDebugMessage("object",4,"<== BlackBox::BlackBox(\"" 00122 <<name<<"\")"<<std::endl); 00123 }
bbtk::BlackBox::BlackBox | ( | BlackBox & | from, | |
const std::string & | name | |||
) | [protected] |
Constructor from an existing box (copy) with a new name.
Definition at line 131 of file bbtkBlackBox.cxx.
References bbGetFullName(), and bbtkBlackBoxDebugMessage.
00132 : 00133 // bbmStatus(from.bbmStatus), 00134 bbmInitialized(false), 00135 bbmExecuting(false), 00136 bbmName(name), 00137 bbmBoxProcessMode(from.bbmBoxProcessMode), 00138 bbmParent() 00139 00140 { 00141 //JCP 02-11-09 00142 //bbmBoxProcessMode = from.bbmBoxProcessMode; 00143 //std::cout<<"JCP BlackBox::BlackBox(const std::string &name) name=" <<name 00144 // <<"bbmBoxProcessMode="<<bbmBoxProcessMode<<std::endl; 00145 bbtkBlackBoxDebugMessage("object",4,"==> BlackBox::BlackBox(" 00146 <<from.bbGetFullName()<<",\"" 00147 <<name<<"\")"<<std::endl); 00148 bbtkBlackBoxDebugMessage("object",4,"<== BlackBox::BlackBox(" 00149 <<from.bbGetFullName()<<",\"" 00150 <<name<<"\")"<<std::endl); 00151 } //=========================================================================
void bbtk::BlackBox::bbAddOutputObserver | ( | const std::string & | output_name, | |
OutputChangeCallbackType | f | |||
) |
Adds the function f to the list of functions to call when the output changes. f is of type ChangeCallbackType which is basically: void (*ChangeCallbackType)(bbtk::BlackBox::Pointer, const std::string&, bbtk::IOStatus) To pass a member function 'f' of an instance 'c' of a class 'C' as callback you have to 'bind' it, i.e. call: bbAddOutputObserver ( "Out", boost::bind( &C::f , c, _1, _2, _3 ) ); The convenience macro BBTK_BIND_OUTPUT_OBSERVER ( c, C::f ) does it for you
Definition at line 409 of file bbtkBlackBox.cxx.
References bbtk::BlackBoxOutputConnector::AddChangeObserver(), and bbGetOutputConnector().
00411 { 00412 bbGetOutputConnector(output).AddChangeObserver(f); 00413 }
void bbtk::BlackBox::bbAllocateConnectors | ( | ) | [protected, virtual] |
Allocates the i/o connectors of the black box.
Reimplemented in bbtk::ComplexBlackBox.
Definition at line 256 of file bbtkBlackBox.cxx.
References bbGetDescriptor(), bbGetInputConnectorMap(), bbGetOutputConnectorMap(), bbtkBlackBoxDebugMessage, bbtk::i, and MakeBlackBoxPointer().
00257 { 00258 bbtkBlackBoxDebugMessage("kernel",8, 00259 "BlackBox::bbAllocateConnectors()" 00260 <<std::endl); 00261 00262 MakeBlackBoxPointer(this,true); 00263 00264 const BlackBoxDescriptor::InputDescriptorMapType& imap 00265 = bbGetDescriptor()->GetInputDescriptorMap(); 00266 BlackBoxDescriptor::InputDescriptorMapType::const_iterator i; 00267 for ( i = imap.begin(); i != imap.end(); ++i ) 00268 { 00269 bbtkBlackBoxDebugMessage("kernel",8,"* Allocate \""<<i->first<<"\""<<std::endl); 00270 bbGetInputConnectorMap()[i->second->GetName()] 00271 = new BlackBoxInputConnector(GetThisPointer<BlackBox>()); 00272 } 00273 const BlackBoxDescriptor::OutputDescriptorMapType& omap 00274 = bbGetDescriptor()->GetOutputDescriptorMap(); 00275 BlackBoxDescriptor::OutputDescriptorMapType::const_iterator o; 00276 for ( o = omap.begin(); o != omap.end(); ++o ) 00277 { 00278 bbtkBlackBoxDebugMessage("kernel",8,"* Allocate \""<<o->first<<"\""<<std::endl); 00279 bbGetOutputConnectorMap()[o->second->GetName()] 00280 = new BlackBoxOutputConnector(GetThisPointer<BlackBox>()); 00281 } 00282 }
bool bbtk::BlackBox::bbBoxProcessModeIsAlways | ( | ) | const [virtual] |
Returns true iff the input 'BoxProcessMode' is set to 'Always' (or a synonym).
Definition at line 399 of file bbtkBlackBox.cxx.
References bbAlways, and bbGetBoxProcessModeValue().
Referenced by bbComputePostProcessStatus(), and bbRecursiveExecute().
00400 { 00401 return (bbGetBoxProcessModeValue() == bbAlways); 00402 }
bool bbtk::BlackBox::bbBoxProcessModeIsReactive | ( | ) | const [virtual] |
Returns true iff the input 'BoxProcessMode' is set to 'Reactive' (or a synonym).
Definition at line 392 of file bbtkBlackBox.cxx.
References bbGetBoxProcessModeValue(), and bbReactive.
Referenced by bbSetStatusAndPropagate().
00393 { 00394 return (bbGetBoxProcessModeValue() == bbReactive); 00395 }
virtual void bbtk::BlackBox::bbBruteForceSetInputPointer | ( | const std::string & | name, | |
void * | data, | |||
bool | update_time = true | |||
) | [pure virtual] |
[SYSTEM]: Sets the data of the input called <name> which **MUST* be a pointer
Implemented in bbtk::AtomicBlackBox, and bbtk::ComplexBlackBox.
bool bbtk::BlackBox::bbCanReact | ( | ) | const [private, virtual] |
Returns true if the box can "react", which means execute in response to an input change
Definition at line 350 of file bbtkBlackBox.cxx.
References bbGlobalGetSomeBoxExecuting(), and bbtk::Wx::IsSomeWindowAlive().
Referenced by bbSetStatusAndPropagate().
00351 { 00352 return ( bbGlobalGetSomeBoxExecuting() 00353 #ifdef USE_WXWIDGETS 00354 || Wx::IsSomeWindowAlive() 00355 #endif 00356 ); 00357 }
virtual BlackBox::Pointer bbtk::BlackBox::bbClone | ( | const std::string & | name | ) | [pure virtual] |
Returns a pointer on a clone of the box with name <name>.
Implemented in bbtk::ComplexBlackBox, bbtk::QtBlackBox, bbtk::WidgetBlackBox< W >, bbtk::WxBlackBox, bbtk::WidgetBlackBox< QWidget >, and bbtk::WidgetBlackBox< wxWindow >.
void bbtk::BlackBox::bbComputePostProcessStatus | ( | ) | [protected] |
Computes the final IOStatus of inputs and outputs after processing.
Definition at line 779 of file bbtkBlackBox.cxx.
References bbBoxProcessModeIsAlways(), bbGetInputConnectorMap(), bbGetOutputConnectorMap(), bbtkBlackBoxDebugMessage, bbtk::GetIOStatusString(), bbtk::i, bbtk::MODIFIED, bbtk::OUTOFDATE, and bbtk::UPTODATE.
Referenced by bbRecursiveExecute().
00780 { 00781 bbtkBlackBoxDebugMessage("process",4, 00782 "=> BlackBox::bbComputePostProcessStatus()" 00783 <<std::endl); 00784 00785 IOStatus new_output_status = UPTODATE; 00786 if (bbBoxProcessModeIsAlways()) new_output_status = OUTOFDATE; 00787 00788 // Update the input statuses 00789 InputConnectorMapType::iterator i; 00790 for ( i = bbGetInputConnectorMap().begin(); 00791 i!= bbGetInputConnectorMap().end(); ++i) 00792 { 00793 IOStatus t = i->second->GetStatus(); 00794 if (t == OUTOFDATE) new_output_status = OUTOFDATE; 00795 // A previously MODIFIED status turns to UPTODATE 00796 if (t==MODIFIED) i->second->SetStatus(UPTODATE); 00797 bbtkBlackBoxDebugMessage("change",2, 00798 "Input '"<<i->first<<"' : " 00799 << GetIOStatusString(t) << " -> " 00800 << GetIOStatusString(i->second->GetStatus()) 00801 << std::endl); 00802 } 00803 bbtkBlackBoxDebugMessage("change",2, 00804 "New output status : " 00805 << GetIOStatusString(new_output_status) 00806 <<std::endl); 00807 // Update the output statuses 00808 OutputConnectorMapType::iterator o; 00809 for ( o = bbGetOutputConnectorMap().begin(); 00810 o!= bbGetOutputConnectorMap().end(); ++o) 00811 { 00812 o->second->SetStatus(new_output_status); 00813 } 00814 00815 bbtkBlackBoxDebugMessage("process",4, 00816 "<= BlackBox::bbComputePostProcessStatus()" 00817 <<std::endl); 00818 }
void bbtk::BlackBox::bbConnectInput | ( | const std::string & | name, | |
Connection * | c | |||
) | [private, virtual] |
Connects the input <name> to the connection c.
Reimplemented in bbtk::ComplexBlackBox.
Definition at line 822 of file bbtkBlackBox.cxx.
References bbGetInputConnectorMap(), bbSetStatusAndPropagate(), bbtkBlackBoxDebugMessage, bbtkError, bbtk::Connection::GetFullName(), bbtk::i, and bbtk::OUTOFDATE.
00823 { 00824 bbtkBlackBoxDebugMessage("connection",2, 00825 "==> BlackBox::bbConnectInput(\"" 00826 <<name<<"\","<<c->GetFullName()<<")" 00827 <<std::endl); 00828 00829 InputConnectorMapType::iterator i = bbGetInputConnectorMap().find(name); 00830 if (i==bbGetInputConnectorMap().end()) 00831 { 00832 bbtkError("no input called '"<<name<<"'"); 00833 } 00834 i->second->SetConnection(c); 00835 // The input *MUST* be set OUTOFDATE to update its input on next execution 00836 bbSetStatusAndPropagate(i->second,OUTOFDATE); 00837 00838 bbtkBlackBoxDebugMessage("connection",2, 00839 "<== BlackBox::bbConnectInput(\"" 00840 <<name<<"\","<<c->GetFullName()<<")" 00841 <<std::endl); 00842 }
void bbtk::BlackBox::bbConnectOutput | ( | const std::string & | name, | |
Connection * | c | |||
) | [private, virtual] |
Connects the output <name> to the connection c.
Reimplemented in bbtk::ComplexBlackBox.
Definition at line 847 of file bbtkBlackBox.cxx.
References bbGetOutputConnectorMap(), bbtkBlackBoxDebugMessage, bbtkError, bbtk::Connection::GetFullName(), and bbtk::i.
00848 { 00849 bbtkBlackBoxDebugMessage("connection",2, 00850 "==> BlackBox::bbConnectOutput(\""<<name<<"\"," 00851 <<c->GetFullName()<<")" 00852 <<std::endl); 00853 00854 OutputConnectorMapType::iterator i = bbGetOutputConnectorMap().find(name); 00855 if (i==bbGetOutputConnectorMap().end()) 00856 { 00857 bbtkError("no output called '"<<name<<"'"); 00858 } 00859 i->second->SetConnection(c); 00860 00861 bbtkBlackBoxDebugMessage("connection",2, 00862 "<== BlackBox::bbConnectOutput(\""<<name<<"\"," 00863 <<c->GetFullName()<<")" 00864 <<std::endl); 00865 }
void bbtk::BlackBox::bbCopyIOValues | ( | BlackBox & | from | ) | [protected, virtual] |
Copies the values of the inputs/output from the BlackBox from.
Definition at line 314 of file bbtkBlackBox.cxx.
References bbGetDescriptor(), bbGetFullName(), bbGetInput(), bbGetOutput(), bbSetInput(), bbSetOutput(), bbtkBlackBoxDebugMessage, bbtkDebugDecTab, and bbtk::i.
00315 { 00316 bbtkBlackBoxDebugMessage("kernel",1, 00317 "BlackBox::bbCopyIOValues(" 00318 <<from.bbGetFullName()<<")" 00319 <<std::endl); 00320 // copies the input values 00321 const BlackBoxDescriptor::InputDescriptorMapType& imap 00322 = bbGetDescriptor()->GetInputDescriptorMap(); 00323 BlackBoxDescriptor::InputDescriptorMapType::const_iterator i; 00324 for ( i = imap.begin(); i != imap.end(); ++i ) 00325 { 00326 if (! i->second->GetCopyConstruct() ) continue; 00327 std::string input = i->second->GetName(); 00328 bbtkBlackBoxDebugMessage("kernel",2,"* Copying input "<<input<<std::endl); 00329 this->bbSetInput(input, from.bbGetInput(input) ); 00330 } 00331 // copies the output values 00332 const BlackBoxDescriptor::OutputDescriptorMapType& omap 00333 = bbGetDescriptor()->GetOutputDescriptorMap(); 00334 BlackBoxDescriptor::OutputDescriptorMapType::const_iterator o; 00335 for ( o = omap.begin(); o != omap.end(); ++o ) 00336 { 00337 if (! o->second->GetCopyConstruct() ) continue; 00338 std::string output = o->second->GetName(); 00339 bbtkBlackBoxDebugMessage("kernel",2,"* Copying output "<<output<<std::endl); 00340 this->bbSetOutput(output, from.bbGetOutput(output) ); 00341 } 00342 00343 bbtkDebugDecTab("kernel",9); 00344 }
virtual void bbtk::BlackBox::bbCreateWindow | ( | ) | [inline, protected, virtual] |
Actual CreateWindow method (vitual) Overloaded in AtomicBlacBox and descendants
Reimplemented in bbtk::WidgetBlackBox< W >, bbtk::WidgetBlackBox< QWidget >, and bbtk::WidgetBlackBox< wxWindow >.
Definition at line 455 of file bbtkBlackBox.h.
Referenced by bbRecursiveExecute().
virtual int bbtk::BlackBox::bbDelete | ( | ) | [inline, protected, virtual] |
Effective deletion method called by the Deleter. The default implementation is to issue 'delete this' but it can be redefined in inherited classes to handle special deletion mechanisms (e.g. ref counting, private destructors, such as vtk objects deletion with method Delete, etc.).
Definition at line 622 of file bbtkBlackBox.h.
Referenced by bbtk::BlackBox::Deleter::Delete().
void bbtk::BlackBox::bbDesallocateConnectors | ( | ) | [protected, virtual] |
Desallocates the i/o connectors of the black box.
Reimplemented in bbtk::ComplexBlackBox.
Definition at line 287 of file bbtkBlackBox.cxx.
References bbGetInputConnectorMap(), bbGetOutputConnectorMap(), bbtkBlackBoxDebugMessage, bbtkDebugDecTab, and bbtk::i.
Referenced by ~BlackBox().
00288 { 00289 bbtkBlackBoxDebugMessage("kernel",8, 00290 "BlackBox::bbDesallocateConnectors()" 00291 <<std::endl); 00292 00293 InputConnectorMapType::const_iterator i; 00294 for ( i = bbGetInputConnectorMap().begin(); 00295 i != bbGetInputConnectorMap().end(); ++i ) 00296 { 00297 bbtkBlackBoxDebugMessage("kernel",8,"* Delete \""<<i->first<<"\""<<std::endl); 00298 delete (i->second); 00299 } 00300 OutputConnectorMapType::const_iterator o; 00301 for ( o = bbGetOutputConnectorMap().begin(); 00302 o != bbGetOutputConnectorMap().end(); ++o ) 00303 { 00304 bbtkBlackBoxDebugMessage("kernel",8,"* Delete \""<<o->first<<"\""<<std::endl); 00305 delete (o->second); 00306 } 00307 00308 bbtkDebugDecTab("kernel",8); 00309 }
void bbtk::BlackBox::bbDisconnectInput | ( | const std::string & | name, | |
Connection * | c | |||
) | [private, virtual] |
Disconnects the input <name> from the connection c.
Definition at line 870 of file bbtkBlackBox.cxx.
References bbGetInputConnectorMap(), bbtkBlackBoxDebugMessage, bbtkError, bbtk::Connection::GetFullName(), and bbtk::i.
00871 { 00872 00873 bbtkBlackBoxDebugMessage("connection",2, 00874 "==> BlackBox::bbDisconnectInput(\""<<name 00875 <<"\","<<c->GetFullName()<<")" 00876 <<std::endl); 00877 if (!c) 00878 { 00879 00880 bbtkBlackBoxDebugMessage("connection",2,"c==0"<<std::endl); 00881 return; 00882 } 00883 00884 InputConnectorMapType::iterator i = bbGetInputConnectorMap().find(name); 00885 if (i==bbGetInputConnectorMap().end()) 00886 { 00887 bbtkError("no input called '"<<name<<"'"); 00888 } 00889 i->second->UnsetConnection(c); 00890 00891 bbtkBlackBoxDebugMessage("connection",2, 00892 "<== BlackBox::bbDisconnectInput(\""<<name 00893 <<"\","<<c->GetFullName()<<")" 00894 <<std::endl); 00895 00896 }
void bbtk::BlackBox::bbDisconnectOutput | ( | const std::string & | name, | |
Connection * | c | |||
) | [private, virtual] |
Disconnects the output <name> from the connection c.
Definition at line 901 of file bbtkBlackBox.cxx.
References bbGetOutputConnectorMap(), bbtkBlackBoxDebugMessage, bbtkError, bbtk::Connection::GetFullName(), and bbtk::i.
00902 { 00903 bbtkBlackBoxDebugMessage("connection",2, 00904 "==> BlackBox::bbDisconnectOutput(\""<<name 00905 <<"\","<<c->GetFullName()<<")" 00906 <<std::endl); 00907 if (!c) 00908 { 00909 00910 bbtkBlackBoxDebugMessage("connection",2,"c==0"<<std::endl); 00911 return; 00912 } 00913 00914 OutputConnectorMapType::iterator i = bbGetOutputConnectorMap().find(name); 00915 if (i==bbGetOutputConnectorMap().end()) 00916 { 00917 bbtkError("no output called '"<<name<<"'"); 00918 } 00919 i->second->UnsetConnection(c); 00920 00921 bbtkBlackBoxDebugMessage("connection",2, 00922 "<== BlackBox::bbDisconnectOutput(\""<<name 00923 <<"\","<<c->GetFullName()<<")" 00924 <<std::endl); 00925 }
void bbtk::BlackBox::bbExecute | ( | bool | force = false |
) | [virtual] |
Main processing method of the box.
Reimplemented in bbtk::ComplexBlackBox.
Definition at line 594 of file bbtkBlackBox.cxx.
References bbGlobalGetFreezeExecution(), bbRecursiveExecute(), BBTK_BUSY_CURSOR, and bbtkBlackBoxDebugMessage.
00595 { 00596 bbtkBlackBoxDebugMessage("process",2, 00597 "=> BlackBox::bbExecute("<<(int)force<<")" 00598 <<std::endl); 00599 00600 // If already executing : return 00601 /* 00602 if (bbGetExecuting()) 00603 { 00604 bbtkBlackBoxDebugMessage("process",2, 00605 " -> already executing : abort"<<std::endl); 00606 return; 00607 } 00608 */ 00609 00610 // If execution frozen : return 00611 if (bbGlobalGetFreezeExecution()) 00612 { 00613 bbtkBlackBoxDebugMessage("process",2, 00614 " -> FreezeExecution global flag is 'true' : abort execution"<<std::endl); 00615 } 00616 00617 BBTK_BUSY_CURSOR; 00618 00619 // If force is true then update is triggered even if the box is UPTODATE 00620 // if (force) bbSetModifiedStatus(); 00621 00622 // Calls the main recursive execution method 00623 bbRecursiveExecute(Connection::Pointer()); 00624 00625 bbtkBlackBoxDebugMessage("process",2, 00626 "<= BlackBox::bbExecute()" 00627 <<std::endl); 00628 }
void bbtk::BlackBox::bbFinalizeProcessing | ( | ) | [protected] |
Finalizes processing IF NEEDED. Calls bbRecursiveFinalizeProcessing if the box is in "initialized" state and put it in "uninitialized" state. On construction, boxes are "uninitialized". See also bbInitializeProcessing
Definition at line 645 of file bbtkBlackBox.cxx.
References bbmInitialized, bbRecursiveFinalizeProcessing(), and bbtkBlackBoxDebugMessage.
00646 { 00647 if (bbmInitialized) 00648 { 00649 bbtkBlackBoxDebugMessage("process",2,"** Finalize processing" 00650 <<std::endl); 00651 this->bbRecursiveFinalizeProcessing(); 00652 bbmInitialized = false; 00653 } 00654 }
virtual BlackBox::Pointer bbtk::BlackBox::bbFindBlackBox | ( | const std::string & | blackboxname | ) | [inline, protected, virtual] |
Reimplemented in bbtk::ComplexBlackBox.
Definition at line 417 of file bbtkBlackBox.h.
00418 { return BlackBox::Pointer();}
BlackBox::BoxProcessModeValue bbtk::BlackBox::bbGetBoxProcessModeValue | ( | ) | const |
Returns the "decoded" value of the input "BoxProcessMode".
Definition at line 363 of file bbtkBlackBox.cxx.
References bbAlways, bbGetFullName(), bbmBoxProcessMode, bbPipeline, bbReactive, and bbtkError.
Referenced by bbBoxProcessModeIsAlways(), and bbBoxProcessModeIsReactive().
00364 { 00365 const std::string& p = bbmBoxProcessMode; 00366 if ( (p == "0") || 00367 (p == "P") || (p == "p") || 00368 (p == "Pipeline") || (p == "pipeline") ) return bbPipeline; 00369 if ( (p == "1") || 00370 (p == "A") || (p == "a") || 00371 (p == "Always") || (p == "always") ) return bbAlways; 00372 if ( (p == "2") || 00373 (p == "R") || (p == "r") || 00374 (p == "Reactive") || (p == "reactive") ) 00375 return bbReactive; 00376 /* 00377 if ( (p == "3") || 00378 (p == "F") || (p == "f") || 00379 (p == "Flash") || (p == "flash") ) return Flash; 00380 */ 00381 bbtkError(bbGetFullName()<<" : BoxProcessMode value '"<<p 00382 <<"' unknown. Possible values : " 00383 <<"'0'/'P'/'p'/'Pipeline'/'pipeline' | " 00384 <<"'1'/'A'/'a'/'Always'/'always' | " 00385 <<"'2'/'R'/'r'/'Reactive'/'reactive'" 00386 // <<"'3'/'F'/'f'/'Flash'/'flash'" 00387 <<std::endl); 00388 }
virtual BlackBoxDescriptor::Pointer bbtk::BlackBox::bbGetDescriptor | ( | ) | const [pure virtual] |
Returns the pointer on the descriptor of the box.
Implemented in bbtk::AtomicBlackBox, and bbtk::ComplexBlackBox.
Referenced by bbAllocateConnectors(), bbCopyIOValues(), bbGetFullName(), bbGetHelp(), bbGetInputAsString(), bbGetInputType(), bbGetOutputAsString(), bbGetOutputType(), bbHasInput(), bbHasOutput(), bbPrintHelp(), bbWriteDotFileBlackBox(), and bbtk::BlackBox::Deleter::Delete().
bool bbtk::BlackBox::bbGetExecuting | ( | ) | const [inline, private] |
Returns true iff the box is executing.
Definition at line 581 of file bbtkBlackBox.h.
Referenced by bbRecursiveExecute().
00581 { return bbmExecuting; }
std::string bbtk::BlackBox::bbGetFullName | ( | ) | const [virtual] |
Returns the full name of the BlackBox (instance+type).
Definition at line 169 of file bbtkBlackBox.cxx.
References bbGetDescriptor(), and bbGetNameWithParent().
Referenced by bbtk::AtomicBlackBox::AtomicBlackBox(), bbCopyIOValues(), bbGetBoxProcessModeValue(), bbSignalOutputModification(), BlackBox(), and bbtk::ComplexBlackBox::Check().
00170 { 00171 return this->bbGetNameWithParent()+"<"+this->bbGetDescriptor()->GetTypeName()+">"; 00172 }
void bbtk::BlackBox::bbGetHelp | ( | bool | full = true |
) | const [virtual] |
Prints the Help on the BlackBox type.
Definition at line 192 of file bbtkBlackBox.cxx.
References bbGetDescriptor().
00193 { 00194 bbGetDescriptor()->GetHelp(full); 00195 }
virtual Data bbtk::BlackBox::bbGetInput | ( | const std::string & | name | ) | [pure virtual] |
Gets the data of the input called <name>.
Implemented in bbtk::AtomicBlackBox, and bbtk::ComplexBlackBox.
Referenced by bbCopyIOValues(), and bbGetInputAsString().
std::string bbtk::BlackBox::bbGetInputAsString | ( | const std::string & | input | ) |
Gets the data of the input called <name> as a string using an Adaptor if possible (else returns empty string).
Definition at line 1004 of file bbtkBlackBox.cxx.
References bbGetDescriptor(), bbGetInput(), and bbGetInputType().
Referenced by bbPrintHelp(), bbtk::ComplexBlackBox::bbWriteDotFileBlackBox(), and bbWriteDotFileBlackBox().
01005 { 01006 std::string v; 01007 // Looks for the adaptor 01008 if (bbGetInputType(input) != typeid(std::string)) 01009 { 01010 // Look for factory 01011 Package::Pointer p = bbGetDescriptor()->GetPackage(); 01012 if ((p != 0) && ( ! p->GetFactorySet().empty() ) ) 01013 { 01014 Factory::Pointer f = p->GetFactorySet().begin()->lock(); 01015 BlackBox::Pointer a; 01016 try 01017 { 01018 a = f->NewAdaptor( 01019 bbGetInputType(input), 01020 typeid(std::string), 01021 ""); 01022 }catch (bbtk::Exception e) 01023 { 01024 } 01025 if (a) 01026 { 01027 // bbUpdate(); 01028 a->bbSetInput("In",bbGetInput(input)); 01029 a->bbExecute(); 01030 v = a->bbGetOutput("Out").unsafe_get<std::string>() ; 01031 } 01032 else 01033 { 01034 v="? (no adaptor found)"; 01035 } 01036 } 01037 else 01038 { 01039 v="? (no factory found)"; 01040 } 01041 } 01042 else 01043 { 01044 v = bbGetInput(input).unsafe_get<std::string>() ; 01045 } 01046 return v; 01047 }
Void bbtk::BlackBox::bbGetInputBoxExecute | ( | ) | [inline] |
Returns the value of the input 'BoxExecute'.
Definition at line 313 of file bbtkBlackBox.h.
Referenced by bbtk::AtomicBlackBoxDescriptor::AtomicBlackBoxDescriptor().
std::string bbtk::BlackBox::bbGetInputBoxProcessMode | ( | ) | [inline] |
Returns the value of the input 'BoxProcessMode'.
Definition at line 292 of file bbtkBlackBox.h.
Referenced by bbtk::AtomicBlackBoxDescriptor::AtomicBlackBoxDescriptor().
00292 { return bbmBoxProcessMode; }
const BlackBoxInputConnector& bbtk::BlackBox::bbGetInputConnector | ( | const std::string & | n | ) | const [inline] |
Returns the input connector (const).
Definition at line 198 of file bbtkBlackBox.h.
00199 { return *(mInputConnectorMap.find(n)->second); }
BlackBoxInputConnector& bbtk::BlackBox::bbGetInputConnector | ( | const std::string & | n | ) | [inline] |
Returns the input connector.
Definition at line 195 of file bbtkBlackBox.h.
00196 { return *(mInputConnectorMap.find(n)->second); }
const InputConnectorMapType& bbtk::BlackBox::bbGetInputConnectorMap | ( | ) | const [inline] |
Returns the input connectors map (const).
Definition at line 192 of file bbtkBlackBox.h.
00193 { return mInputConnectorMap; }
InputConnectorMapType& bbtk::BlackBox::bbGetInputConnectorMap | ( | ) | [inline] |
Returns the input connectors map.
Definition at line 189 of file bbtkBlackBox.h.
Referenced by bbtk::ComplexBlackBox::bbAllocateConnectors(), bbAllocateConnectors(), bbtk::AtomicBlackBox::bbBruteForceSetInputPointer(), bbComputePostProcessStatus(), bbConnectInput(), bbtk::ComplexBlackBox::bbDesallocateConnectors(), bbDesallocateConnectors(), bbDisconnectInput(), bbtk::AtomicBlackBox::bbSetInput(), bbSetStatusAndPropagate(), bbUpdateInputs(), and bbtk::ComplexBlackBox::bbWriteDotFileBlackBox().
00190 { return mInputConnectorMap; }
IOStatus bbtk::BlackBox::bbGetInputStatus | ( | const std::string & | name | ) | const [inline] |
Gets the status of the input called <name>.
Definition at line 157 of file bbtkBlackBox.h.
00158 { return mInputConnectorMap.find(name)->second->GetStatus(); }
TypeInfo bbtk::BlackBox::bbGetInputType | ( | const std::string & | label | ) | const [virtual] |
Gets the input type of a given label.
Definition at line 242 of file bbtkBlackBox.cxx.
References bbGetDescriptor(), bbtkBlackBoxDebugMessage, and bbtkDebugDecTab.
Referenced by bbGetInputAsString().
00243 { 00244 bbtkBlackBoxDebugMessage("kernel",8, 00245 "BlackBox::bbGetInputType(\"" 00246 <<name<<"\")" 00247 <<std::endl); 00248 TypeInfo r = bbGetDescriptor()->GetInputDescriptor(name)->GetTypeInfo(); 00249 bbtkDebugDecTab("kernel",8); 00250 return r; 00251 }
const std::string& bbtk::BlackBox::bbGetName | ( | ) | const [inline] |
Returns the name of the BlackBox (instance).
Definition at line 131 of file bbtkBlackBox.h.
Referenced by bbtk::ComplexBlackBox::bbGetNameWithParent(), bbtk::ComplexBlackBox::bbInsertHTMLGraph(), bbPrintHelp(), bbtk::WidgetBlackBox< W >::bbUserSetDefaultValues(), bbtk::ComplexBlackBox::bbWriteDotFileBlackBox(), bbWriteDotFileBlackBox(), and bbtk::ComplexBlackBox::ComplexBlackBox().
00131 { return bbmName; }
std::string bbtk::BlackBox::bbGetNameWithParent | ( | ) | const [virtual] |
Returns the name with the name of the parent prepended if any.
Reimplemented in bbtk::ComplexBlackBox.
Definition at line 178 of file bbtkBlackBox.cxx.
References bbmName, and bbmParent.
Referenced by bbGetFullName().
00179 { 00180 if (bbmParent.lock()) 00181 { 00182 return bbmParent.lock()->bbGetNameWithParent() + ":" + bbmName; 00183 } 00184 else 00185 { 00186 return bbmName; 00187 } 00188 }
virtual Data bbtk::BlackBox::bbGetOutput | ( | const std::string & | name | ) | [pure virtual] |
Gets the data of the output called <name>.
Implemented in bbtk::AtomicBlackBox, and bbtk::ComplexBlackBox.
Referenced by bbCopyIOValues(), and bbGetOutputAsString().
std::string bbtk::BlackBox::bbGetOutputAsString | ( | const std::string & | output | ) |
Gets the data of the output called <name> as a string using an Adaptor if possible (else returns empty string).
Definition at line 959 of file bbtkBlackBox.cxx.
References bbGetDescriptor(), bbGetOutput(), and bbGetOutputType().
Referenced by bbPrintHelp(), bbtk::ComplexBlackBox::bbWriteDotFileBlackBox(), and bbWriteDotFileBlackBox().
00960 { 00961 std::string v; 00962 // Looks for the adaptor 00963 if (bbGetOutputType(output).name() != typeid(std::string).name() ) 00964 { 00965 // Look for factory 00966 Package::Pointer p = bbGetDescriptor()->GetPackage(); 00967 if ((p != 0) && ( ! p->GetFactorySet().empty() ) ) 00968 { 00969 Factory::Pointer f = p->GetFactorySet().begin()->lock(); 00970 BlackBox::Pointer a; 00971 try 00972 { 00973 a = f->NewAdaptor( 00974 bbGetOutputType(output), 00975 typeid(std::string), 00976 ""); 00977 } catch (bbtk::Exception e) 00978 { 00979 } 00980 if (a){ 00981 // bbUpdate(); 00982 a->bbSetInput("In",bbGetOutput(output)); 00983 a->bbExecute(); 00984 v = a->bbGetOutput("Out").unsafe_get<std::string>() ; 00985 } else { 00986 v="? (no adaptor found)"; 00987 } 00988 } 00989 else 00990 { 00991 v="? (no factory found)"; 00992 } 00993 } 00994 else 00995 { 00996 // bbUpdate(); 00997 v = bbGetOutput(output).unsafe_get<std::string>() ; 00998 } 00999 return v; 01000 }
Void bbtk::BlackBox::bbGetOutputBoxChange | ( | ) | [inline] |
Returns the value of the output 'BoxChange'.
Definition at line 318 of file bbtkBlackBox.h.
Referenced by bbtk::AtomicBlackBoxDescriptor::AtomicBlackBoxDescriptor().
const BlackBoxOutputConnector& bbtk::BlackBox::bbGetOutputConnector | ( | const std::string & | n | ) | const [inline] |
Returns the output connector (const).
Definition at line 212 of file bbtkBlackBox.h.
00213 { return *(mOutputConnectorMap.find(n)->second); }
BlackBoxOutputConnector& bbtk::BlackBox::bbGetOutputConnector | ( | const std::string & | n | ) | [inline] |
Returns the output connector.
Definition at line 209 of file bbtkBlackBox.h.
Referenced by bbAddOutputObserver().
00210 { return *(mOutputConnectorMap.find(n)->second); }
const OutputConnectorMapType& bbtk::BlackBox::bbGetOutputConnectorMap | ( | ) | const [inline] |
Returns the output connectors map (const).
Definition at line 206 of file bbtkBlackBox.h.
00207 { return mOutputConnectorMap; }
OutputConnectorMapType& bbtk::BlackBox::bbGetOutputConnectorMap | ( | ) | [inline] |
Returns the output connectors map.
Definition at line 203 of file bbtkBlackBox.h.
Referenced by bbtk::ComplexBlackBox::bbAllocateConnectors(), bbAllocateConnectors(), bbComputePostProcessStatus(), bbConnectOutput(), bbtk::ComplexBlackBox::bbDesallocateConnectors(), bbDesallocateConnectors(), bbDisconnectOutput(), bbtk::WidgetBlackBox< W >::bbIsOutputWidgetConnected(), bbRecursiveExecute(), bbSetStatusAndPropagate(), and bbSignalOutputModification().
00204 { return mOutputConnectorMap; }
TypeInfo bbtk::BlackBox::bbGetOutputType | ( | const std::string & | label | ) | const [virtual] |
Gets the output type of a given label.
Definition at line 229 of file bbtkBlackBox.cxx.
References bbGetDescriptor(), bbtkBlackBoxDebugMessage, and bbtkDebugDecTab.
Referenced by bbGetOutputAsString().
00230 { 00231 bbtkBlackBoxDebugMessage("kernel",8, 00232 "BlackBox::bbGetOutputType(\"" 00233 <<name<<"\")" 00234 <<std::endl); 00235 TypeInfo r = bbGetDescriptor()->GetOutputDescriptor(name)->GetTypeInfo(); 00236 bbtkDebugDecTab("kernel",8); 00237 return r; 00238 }
BlackBox::Pointer bbtk::BlackBox::bbGetParent | ( | ) | const [inline] |
Returns the parent of the BlackBox, i.e the BlackBox that contains it (0 if none).
Definition at line 140 of file bbtkBlackBox.h.
00140 { return bbmParent.lock(); }
const std::string& bbtk::BlackBox::bbGetTypeName | ( | ) | const [inline] |
Returns the Name of the Type of the BlackBox.
Definition at line 126 of file bbtkBlackBox.h.
Referenced by bbtk::WidgetBlackBox< wxWindow >::bbCreateDialogWindow(), bbtk::WidgetBlackBox< wxWindow >::bbCreateFrameWindow(), bbtk::ComplexBlackBox::bbInsertHTMLGraph(), bbtk::WidgetBlackBox< wxWindow >::bbUserCreateWidget(), bbtk::ComplexBlackBox::bbWriteDotFileBlackBox(), bbWriteDotFileBlackBox(), bbtk::ComplexBlackBox::bbWriteDotInputOutputName(), and bbWriteDotInputOutputName().
00127 { return bbGetDescriptor()->GetTypeName(); }
void bbtk::BlackBox::bbGlobalAddToExecutionList | ( | BlackBox::Pointer | b | ) | [static] |
Definition at line 1429 of file bbtkBlackBox.cxx.
References bbtk::bbmgExecutionList, bbtk::bbmgGlobalProcessingExecutionList, and bbtkDebugMessage.
Referenced by bbSetStatusAndPropagate().
01430 { 01431 bbtkDebugMessage("process",3,"* bbGlobalAddToExecutionList("<<b->bbGetName()<<")"<<std::endl); 01432 if (bbmgGlobalProcessingExecutionList) 01433 { 01434 bbtkDebugMessage("process",3,"bbGlobalAddToExecutionList called inside bbGlobalProcessExecutionList !"); 01435 } 01436 bbmgExecutionList.insert(b); 01437 }
bool bbtk::BlackBox::bbGlobalGetFreezeExecution | ( | ) | [static] |
Definition at line 1424 of file bbtkBlackBox.cxx.
References bbtk::bbmgFreezeExecution.
Referenced by bbExecute().
01425 { 01426 return bbmgFreezeExecution; 01427 }
bool bbtk::BlackBox::bbGlobalGetSomeBoxExecuting | ( | ) | [static] |
Definition at line 1409 of file bbtkBlackBox.cxx.
References bbtk::bbmgSomeBoxExecuting.
Referenced by bbCanReact(), and bbRecursiveExecute().
01410 { 01411 return bbmgSomeBoxExecuting; 01412 }
void bbtk::BlackBox::bbGlobalProcessExecutionList | ( | ) | [static] |
Definition at line 1368 of file bbtkBlackBox.cxx.
References bbtk::bbmgExecutionList, bbtk::bbmgGlobalProcessingExecutionList, bbtkDebugMessage, bbtkGlobalError, and bbtk::i.
Referenced by bbSignalOutputModification().
01369 { 01370 bbtkDebugMessage("process",3, 01371 "=> BlackBox::bbGlobalProcessExecutionList()" 01372 <<std::endl); 01373 if (bbmgGlobalProcessingExecutionList) 01374 { 01375 bbtkDebugMessage("process",3,"BlackBox::bbGlobalProcessExecutionList() reentered !"); 01376 return; 01377 } 01378 bbmgGlobalProcessingExecutionList = true; 01379 01380 std::set<BlackBox::WeakPointer>::iterator i; 01381 while (bbmgExecutionList.size()>0) 01382 { 01383 i = bbmgExecutionList.begin(); 01384 BlackBox::WeakPointer p = *i; 01385 bbmgExecutionList.erase(i); 01386 if (p.lock()) 01387 { 01388 bbtkDebugMessage("process",4, 01389 " -> Executing '"<< 01390 p.lock()->bbGetName()<<"'"<<std::endl); 01391 p.lock()->bbExecute(true); 01392 } 01393 else 01394 { 01395 bbtkGlobalError("Strange error in BlackBox::bbGlobalProcessExecutionList() : Weak bb pointer in bbmgExecutionList is no more valid..."); 01396 } 01397 } 01398 01399 bbmgExecutionList.clear(); 01400 bbtkDebugMessage("process",3, 01401 "<= BlackBox::bbGlobalProcessExecutionList()" 01402 <<std::endl); 01403 01404 bbmgGlobalProcessingExecutionList = false; 01405 01406 }
void bbtk::BlackBox::bbGlobalSetFreezeExecution | ( | bool | b | ) | [static] |
Definition at line 1419 of file bbtkBlackBox.cxx.
References bbtk::bbmgFreezeExecution.
01420 { 01421 bbmgFreezeExecution = b; 01422 }
void bbtk::BlackBox::bbGlobalSetSomeBoxExecuting | ( | bool | b | ) | [static] |
Definition at line 1414 of file bbtkBlackBox.cxx.
References bbtk::bbmgSomeBoxExecuting.
Referenced by bbRecursiveExecute().
01415 { 01416 bbmgSomeBoxExecuting = b; 01417 }
bool bbtk::BlackBox::bbHasInput | ( | const std::string & | label | ) | const [virtual] |
Returns true iff the BlackBox has an input of name label.
Definition at line 200 of file bbtkBlackBox.cxx.
References bbGetDescriptor(), bbtkBlackBoxDebugMessage, and bbtkDebugDecTab.
00201 { 00202 bbtkBlackBoxDebugMessage("kernel",8, 00203 "BlackBox::bbHasInput(\"" 00204 <<name<<"\")" 00205 <<std::endl); 00206 bool r = ( bbGetDescriptor()->GetInputDescriptorMap().find(name) 00207 != bbGetDescriptor()->GetInputDescriptorMap().end()); 00208 bbtkDebugDecTab("kernel",8); 00209 return r; 00210 }
bool bbtk::BlackBox::bbHasOutput | ( | const std::string & | label | ) | const [virtual] |
Returns true iff the BlackBox has an output of name label.
Definition at line 215 of file bbtkBlackBox.cxx.
References bbGetDescriptor(), bbtkBlackBoxDebugMessage, and bbtkDebugDecTab.
00216 { 00217 bbtkBlackBoxDebugMessage("kernel",8,"BlackBox::bbHasOutput(\"" 00218 <<name<<"\")" 00219 <<std::endl); 00220 bool r = ( bbGetDescriptor()->GetOutputDescriptorMap().find(name) 00221 != bbGetDescriptor()->GetOutputDescriptorMap().end()); 00222 bbtkDebugDecTab("kernel",8); 00223 return r; 00224 }
void bbtk::BlackBox::bbInitializeProcessing | ( | ) | [protected] |
Initializes processing IF NEEDED. Calls bbRecursiveInitializeProcessing if the box is in "uninitialized" state and put it in "initialized" state. On construction, boxes are "uninitialized". See also bbFinalizeProcessing
Definition at line 632 of file bbtkBlackBox.cxx.
References bbmInitialized, bbRecursiveInitializeProcessing(), and bbtkBlackBoxDebugMessage.
Referenced by bbRecursiveExecute().
00633 { 00634 if (!bbmInitialized) 00635 { 00636 bbtkBlackBoxDebugMessage("process",2,"** Initialize processing" 00637 <<std::endl); 00638 this->bbRecursiveInitializeProcessing(); 00639 bbmInitialized = true; 00640 } 00641 }
void bbtk::BlackBox::bbInsertHTMLGraph | ( | std::ofstream & | s, | |
int | detail, | |||
int | level, | |||
bool | instanceOrtype, | |||
const std::string & | output_dir, | |||
bool | relative_link | |||
) | [inline] |
Does nothing here : overloaded in ComplexBlackBox.
Reimplemented in bbtk::ComplexBlackBox.
Definition at line 329 of file bbtkBlackBox.h.
virtual bool bbtk::BlackBox::bbIsShown | ( | ) | [inline, virtual] |
Reimplemented in bbtk::WidgetBlackBox< W >, bbtk::WidgetBlackBox< QWidget >, and bbtk::WidgetBlackBox< wxWindow >.
Definition at line 342 of file bbtkBlackBox.h.
void bbtk::BlackBox::bbPrintHelp | ( | BlackBox::Pointer | parentblackbox, | |
int | detail, | |||
int | level | |||
) | [virtual] |
Definition at line 1207 of file bbtkBlackBox.cxx.
References bbGetDescriptor(), bbGetInputAsString(), bbGetName(), bbGetOutputAsString(), bbtkBlackBoxMessage, bbtk::GetIOStatusString(), bbtk::Connection::GetOriginalBlackBoxFrom(), bbtk::Connection::GetOriginalBlackBoxFromOutput(), bbtk::i, mInputConnectorMap, and mOutputConnectorMap.
01210 { 01211 01212 if (this->bbGetDescriptor()->GetPackage()) 01213 { 01214 bbtkBlackBoxMessage("help",1,"Black Box '"<<bbGetName()<<"' <"<< 01215 this->bbGetDescriptor()->GetPackage()->GetName() 01216 <<"::"<<this->bbGetDescriptor()->GetTypeName()<<">"<<std::endl); 01217 } 01218 else 01219 { 01220 bbtkBlackBoxMessage("help",1,"Black Box <::"<<this->bbGetDescriptor()->GetTypeName()<<">"<<std::endl); 01221 } 01222 /* 01223 if (bbIsUpToDate()) 01224 { 01225 bbtkBlackBoxMessage("help",1,"Up-to-date ["<<mMaxInputChangeTime<<"," 01226 <<mMinOutputChangeTime<<"]"<<std::endl); 01227 } 01228 else 01229 { 01230 bbtkBlackBoxMessage("help",1,"Out-of-date ["<<mMaxInputChangeTime<<"," 01231 <<mMinOutputChangeTime<<"]"<<std::endl); 01232 } 01233 */ 01234 // bbtkBlackBoxMessage("help",1," "<<GetDescription()<<std::endl); 01235 // bbtkBlackBoxMessage("help",1," By : "<<GetAuthor()<<std::endl); 01236 01237 std::vector<std::string> iname; 01238 std::vector<std::string> ivalue; 01239 std::vector<std::string> iconn; 01240 std::vector<std::string> istatus; 01241 01242 InputConnectorMapType::iterator i; 01243 unsigned int namelmax = 0; 01244 unsigned int valuelmax = 0; 01245 // unsigned int connlmax = 0; 01246 for ( i = mInputConnectorMap.begin(); i != mInputConnectorMap.end(); ++i ) 01247 { 01248 iname.push_back(i->first); 01249 if (iname.back().size()>namelmax) namelmax = iname.back().size(); 01250 ivalue.push_back(bbGetInputAsString(i->first)); 01251 if (ivalue.back().size()>valuelmax) valuelmax = ivalue.back().size(); 01252 std::string s(""); 01253 Connection* con = i->second->GetConnection(); 01254 if (con!=0){ 01255 s = con->GetOriginalBlackBoxFrom()->bbGetName(); 01256 s += "."; 01257 s += con->GetOriginalBlackBoxFromOutput(); 01258 } // if con 01259 iconn.push_back(s); 01260 istatus.push_back(GetIOStatusString(i->second->GetStatus())); 01261 } 01262 OutputConnectorMapType::iterator o; 01263 std::vector<std::string> oname; 01264 std::vector<std::string> ovalue; 01265 std::vector<std::vector<std::string> > oconn; 01266 std::vector<std::string> ostatus; 01267 for ( o = mOutputConnectorMap.begin(); o != mOutputConnectorMap.end(); ++o ) 01268 { 01269 oname.push_back(o->first); 01270 if (oname.back().size()>namelmax) 01271 namelmax = oname.back().size(); 01272 ovalue.push_back(bbGetOutputAsString(o->first)); 01273 if (ovalue.back().size()>valuelmax) 01274 valuelmax = ovalue.back().size(); 01275 std::vector<std::string> ss; 01276 const std::vector<Connection*>& con 01277 = o->second->GetConnectionVector(); 01278 std::vector<Connection*>::const_iterator c; 01279 for (c=con.begin();c!=con.end();++c) 01280 { 01281 std::string s; 01282 s = (*c)->GetOriginalBlackBoxTo()->bbGetName(); 01283 s += "."; 01284 s += (*c)->GetOriginalBlackBoxToInput(); 01285 ss.push_back(s); 01286 } // if con 01287 oconn.push_back(ss); 01288 ostatus.push_back(GetIOStatusString(o->second->GetStatus())); 01289 } 01290 01291 if (iname.size()) 01292 bbtkBlackBoxMessage("help",1," * Inputs : "<<std::endl); 01293 else 01294 bbtkBlackBoxMessage("help",1," * No inputs"<<std::endl); 01295 01296 std::vector<std::string>::iterator i1,i2,i3,i4; 01297 for (i1=iname.begin(),i2=ivalue.begin(),i3=iconn.begin(),i4=istatus.begin(); 01298 i1!=iname.end(),i2!=ivalue.end(),i3!=iconn.end(),i4!=istatus.end(); 01299 ++i1,++i2,++i3,++i4) 01300 { 01301 std::string name(*i1); 01302 name += "'"; 01303 name.append(1+namelmax-name.size(),' '); 01304 std::string value(*i2); 01305 value += "'"; 01306 value.append(1+valuelmax-value.size(),' '); 01307 if (i3->size()) 01308 bbtkBlackBoxMessage("help",1," '"<<name<<" = '"<<value<<" <-- '" <<*i3<<"'"); 01309 else 01310 bbtkBlackBoxMessage("help",1," '"<<name<<" = '"<<value); 01311 bbtkBlackBoxMessage("help",1," ["<<*i4<<"]"<<std::endl); 01312 } 01313 01314 if (oname.size()) 01315 bbtkBlackBoxMessage("help",1," * Outputs : "<<std::endl); 01316 else 01317 bbtkBlackBoxMessage("help",1," * No outputs"<<std::endl); 01318 01319 std::vector<std::vector<std::string> >::iterator i5; 01320 01321 for (i1=oname.begin(),i2=ovalue.begin(),i5=oconn.begin(),i4=ostatus.begin(); 01322 i1!=oname.end(),i2!=ovalue.end(),i5!=oconn.end(),i4!=ostatus.end(); 01323 ++i1,++i2,++i4,++i5) 01324 { 01325 std::string name(*i1); 01326 name += "'"; 01327 name.append(1+namelmax-name.size(),' '); 01328 std::string value(*i2); 01329 value += "'"; 01330 value.append(1+valuelmax-value.size(),' '); 01331 if (!(*i5).size()) 01332 bbtkBlackBoxMessage("help",1," '"<<name<<" = '"<<value); 01333 else 01334 { 01335 std::string pref = " '"+name+" = '"+value; 01336 for (i3=i5->begin();i3!=i5->end();++i3) 01337 { 01338 bbtkBlackBoxMessage("help",1,pref<<" --> '"<<*i3<<"'"); 01339 pref.replace(0,pref.size(),pref.size(),' '); 01340 } 01341 } 01342 bbtkBlackBoxMessage("help",1," ["<<*i4<<"]"<<std::endl); 01343 } 01344 01345 }
virtual void bbtk::BlackBox::bbProcess | ( | ) | [inline, protected, virtual] |
Actual processing method (vitual) Overloaded in AtomicBlacBox and descendants
Reimplemented in bbtk::AtomicBlackBox, bbtk::WidgetBlackBox< W >, bbtk::WidgetBlackBox< QWidget >, and bbtk::WidgetBlackBox< wxWindow >.
Definition at line 474 of file bbtkBlackBox.h.
References bbtkError.
Referenced by bbRecursiveExecute().
00475 { 00476 bbtkError("BlackBox::bbProcess called : how can this happen ?"); 00477 // this->bbUserProcess(); 00478 }
void bbtk::BlackBox::bbRecursiveExecute | ( | Connection::Pointer | caller | ) | [protected, virtual] |
Recursive execution method
caller | : The connection which invoked the method; null if called by bbExecute |
Definition at line 659 of file bbtkBlackBox.cxx.
References bbBoxProcessModeIsAlways(), bbComputePostProcessStatus(), bbCreateWindow(), bbGetExecuting(), bbGetOutputConnectorMap(), bbGlobalGetSomeBoxExecuting(), bbGlobalSetSomeBoxExecuting(), bbInitializeProcessing(), bbProcess(), bbSetExecuting(), bbShowWindow(), bbtkBlackBoxDebugMessage, bbtkWarning, bbUpdateInputs(), and bbtk::UPTODATE.
Referenced by bbExecute().
00660 { 00661 bbtkBlackBoxDebugMessage("process",3, 00662 "=> BlackBox::bbRecursiveExecute(" 00663 <<(caller?caller->GetFullName():"0")<<")" 00664 <<std::endl); 00665 00666 // If already executing : return 00667 if (bbGetExecuting()) 00668 { 00669 bbtkBlackBoxDebugMessage("process",3, 00670 " -> already executing : abort"<<std::endl); 00671 return; 00672 } 00673 00674 // If not initialized do it 00675 bbInitializeProcessing(); 00676 00677 bbSetExecuting(true); 00678 bool wasExecuting = bbGlobalGetSomeBoxExecuting(); 00679 bbGlobalSetSomeBoxExecuting(true); 00680 00681 // Creates the window if the black box has one 00682 this->bbCreateWindow(); 00683 00684 // Updates its inputs 00685 IOStatus s = bbUpdateInputs(); 00686 00687 if ( (s != UPTODATE) || 00688 bbBoxProcessModeIsAlways() ) 00689 { 00690 // Displays the window (WxBlackbox) 00691 // bbShowWindow(caller); 00692 00693 // Actual processing (virtual) 00694 this->bbProcess(); 00695 00696 00697 // Update the I/O statuses 00698 bbComputePostProcessStatus(); 00699 } 00700 else 00701 { 00702 // Test output status... 00703 OutputConnectorMapType::iterator o; 00704 for ( o = bbGetOutputConnectorMap().begin(); 00705 o!= bbGetOutputConnectorMap().end(); ++o) 00706 { 00707 if (o->second->GetStatus() != UPTODATE) 00708 { 00709 bbtkWarning("BlackBox::bbRecursiveExecute: " 00710 <<"all inputs are Up-to-date but output '" 00711 <<o->first<<"' is Out-of-date ???"); 00712 } 00713 } 00714 00715 bbtkBlackBoxDebugMessage("process",3," -> Up-to-date : nothing to do" 00716 <<std::endl); 00717 } 00718 00719 // Shows the window if the black box has one 00720 this->bbShowWindow(); 00721 00722 00723 bbtkBlackBoxDebugMessage("process",3, 00724 "<= BlackBox::bbRecursiveExecute()" 00725 <<std::endl); 00726 00727 bbSetExecuting(false); 00728 bbGlobalSetSomeBoxExecuting(wasExecuting); 00729 00730 return; 00731 }
virtual void bbtk::BlackBox::bbRecursiveFinalizeProcessing | ( | ) | [inline, protected, virtual] |
Abstract prototype of the method which calls bbUserFinalizeProcessing for its own class and then recursively calls itself for the parent black box. It is redefined in each black box descendant. Allows to call bbUserFinalizeProcessing for all inherited classes (like a destructor does)
Reimplemented in bbtk::QtBlackBox, bbtk::WidgetBlackBox< W >, bbtk::WxBlackBox, bbtk::WidgetBlackBox< QWidget >, and bbtk::WidgetBlackBox< wxWindow >.
Definition at line 541 of file bbtkBlackBox.h.
Referenced by bbFinalizeProcessing().
virtual void bbtk::BlackBox::bbRecursiveInitializeProcessing | ( | ) | [inline, protected, virtual] |
Abstract prototype of the method which Recursively calls itself for the parent black box and then calls bbUserInitializeProcessing for its own class. It is redefined in each black box descendant. Allows to call bbUserInitializeProcessing for all inherited classes (like a constructor does)
Reimplemented in bbtk::QtBlackBox, bbtk::WidgetBlackBox< W >, bbtk::WxBlackBox, bbtk::WidgetBlackBox< QWidget >, and bbtk::WidgetBlackBox< wxWindow >.
Definition at line 532 of file bbtkBlackBox.h.
Referenced by bbInitializeProcessing().
void bbtk::BlackBox::bbRemoveOutputObserver | ( | const std::string & | output_name, | |
OutputChangeCallbackType | f | |||
) |
Removes the function f from the list of functions to call when the output changes (TO WRITE)
Definition at line 417 of file bbtkBlackBox.cxx.
References bbtkError.
00419 { 00420 bbtkError("BlackBox::RemoveChangeObserver NOT IMPLEMENTED"); 00421 }
void bbtk::BlackBox::bbSetExecuting | ( | bool | b | ) | [inline, private] |
Sets the bbmExecuting bool returned by bbGetExecuting.
Definition at line 583 of file bbtkBlackBox.h.
Referenced by bbRecursiveExecute().
00583 { bbmExecuting = b; }
virtual void bbtk::BlackBox::bbSetInput | ( | const std::string & | name, | |
Data | data, | |||
bool | update_time = true | |||
) | [pure virtual] |
If update_time is false then does not update ChangeTime of input.
Sets the data of the input called <name>.
Implemented in bbtk::AtomicBlackBox, and bbtk::ComplexBlackBox.
Referenced by bbCopyIOValues().
void bbtk::BlackBox::bbSetInputBoxExecute | ( | Void | = 0 |
) | [inline] |
Sets the value of the input 'BoxExecute'.
Definition at line 315 of file bbtkBlackBox.h.
Referenced by bbtk::AtomicBlackBoxDescriptor::AtomicBlackBoxDescriptor().
void bbtk::BlackBox::bbSetInputBoxProcessMode | ( | std::string | a | ) | [inline] |
Sets the value of the input 'BoxProcessMode'.
Definition at line 294 of file bbtkBlackBox.h.
Referenced by bbtk::AtomicBlackBoxDescriptor::AtomicBlackBoxDescriptor().
00294 { bbmBoxProcessMode = a; }
virtual void bbtk::BlackBox::bbSetOutput | ( | const std::string & | name, | |
Data | data | |||
) | [pure virtual] |
Sets the data of the output called <name>.
Implemented in bbtk::AtomicBlackBox, and bbtk::ComplexBlackBox.
Referenced by bbCopyIOValues().
void bbtk::BlackBox::bbSetOutputBoxChange | ( | Void | = 0 |
) | [inline] |
Sets the value of the output 'BoxChange'.
Definition at line 320 of file bbtkBlackBox.h.
Referenced by bbtk::AtomicBlackBoxDescriptor::AtomicBlackBoxDescriptor().
void bbtk::BlackBox::bbSetParent | ( | BlackBox::Pointer | p | ) | [inline, private] |
Sets the parent of the BlackBox.
Definition at line 553 of file bbtkBlackBox.h.
00553 { bbmParent = p; }
virtual void bbtk::BlackBox::bbSetShown | ( | bool | ) | [inline, virtual] |
Reimplemented in bbtk::WidgetBlackBox< W >, bbtk::WidgetBlackBox< QWidget >, and bbtk::WidgetBlackBox< wxWindow >.
Definition at line 341 of file bbtkBlackBox.h.
void bbtk::BlackBox::bbSetStatusAndPropagate | ( | BlackBoxInputConnector * | c, | |
IOStatus | s | |||
) | [protected, virtual] |
Signals that the input whose connector is c has changed and propagates the info downward NOT USER INTENDED **
Definition at line 426 of file bbtkBlackBox.cxx.
References bbBoxProcessModeIsReactive(), bbCanReact(), bbGetInputConnectorMap(), bbGetOutputConnectorMap(), bbGlobalAddToExecutionList(), bbtkBlackBoxDebugMessage, bbtkError, bbtk::GetIOStatusString(), bbtk::OUTOFDATE, bbtk::BlackBoxInputConnector::SetStatus(), and bbtk::UPTODATE.
Referenced by bbtk::AtomicBlackBox::bbBruteForceSetInputPointer(), bbConnectInput(), and bbtk::AtomicBlackBox::bbSetInput().
00428 { 00429 bbtkBlackBoxDebugMessage("change",5, 00430 "=> BlackBox::bbSetStatusAndPropagate(input," 00431 <<GetIOStatusString(s)<<")" 00432 <<std::endl); 00433 00434 if (s==UPTODATE) bbtkError("bbSetStatusAndPropagate with status UPTODATE!"); 00435 c->SetStatus(s); 00436 00437 // Flash reaction 00438 /* 00439 if (bbGetBoxProcessModeValue() == Flash) 00440 { 00441 this->bbExecute(); 00442 } 00443 */ 00444 00445 OutputConnectorMapType::const_iterator o; 00446 for ( o = bbGetOutputConnectorMap().begin(); 00447 o != bbGetOutputConnectorMap().end(); ++o ) 00448 { 00449 if (o->second->GetStatus()==UPTODATE) 00450 { 00451 o->second->SetStatus(OUTOFDATE); 00452 o->second->SignalChange(GetThisPointer<BlackBox>(),o->first); 00453 } 00454 } 00455 00456 if ( ( bbBoxProcessModeIsReactive() 00457 || (c==bbGetInputConnectorMap().find("BoxExecute")->second)) 00458 && (bbCanReact() ) ) 00459 { 00460 bbtkBlackBoxDebugMessage("change",2, 00461 "-> Execution triggered by Reactive mode or BoxExecute input change"<<std::endl); 00462 bbGlobalAddToExecutionList( GetThisPointer<BlackBox>() ); 00463 } 00464 bbtkBlackBoxDebugMessage("change",5, 00465 "<= BlackBox::bbSetStatusAndPropagate(input)" 00466 <<std::endl); 00467 }
virtual void bbtk::BlackBox::bbShowWindow | ( | ) | [inline, protected, virtual] |
Actual ShowWindow method (vitual) Overloaded in AtomicBlacBox and descendants
Reimplemented in bbtk::QtBlackBox, bbtk::WidgetBlackBox< W >, bbtk::WxBlackBox, bbtk::WidgetBlackBox< QWidget >, and bbtk::WidgetBlackBox< wxWindow >.
Definition at line 464 of file bbtkBlackBox.h.
Referenced by bbRecursiveExecute().
void bbtk::BlackBox::bbSignalOutputModification | ( | const std::vector< std::string > & | output_name, | |
bool | reaction = true | |||
) | [virtual] |
Signals that the BlackBox vector of outputs "output_name" have been modified. Should be used when more than ONE output is modified but not ALL (optimization issue). (without marking the box as MODIFIED because its output state is ok). This method should be used by widgets in response to user interaction When more than one output has been changed but not all (after the outputs have been updated of course!) DO NOT PASS reaction = false OR WILL NOT WORK PROPERLY USER INTENDED **
Definition at line 543 of file bbtkBlackBox.cxx.
References bbGetFullName(), bbGetOutputConnectorMap(), bbGlobalProcessExecutionList(), bbtkBlackBoxDebugMessage, bbtkError, and bbtk::i.
00545 { 00546 bbtkBlackBoxDebugMessage("change",5, 00547 "=> BlackBox::bbSignalOutputModification(vector of outputs)" 00548 <<std::endl); 00549 OutputConnectorMapType::iterator i; 00550 std::vector<std::string>::const_iterator o; 00551 bool changed = false; 00552 for (o=output.begin();o!=output.end();++o) 00553 { 00554 // the output "BoxChange" must be signaled **AFTER** all others 00555 if (*o == "BoxChange") continue; 00556 // Look for the connector 00557 i = bbGetOutputConnectorMap().find(*o); 00558 if ( i == bbGetOutputConnectorMap().end() ) 00559 { 00560 bbtkError("BlackBox["<<bbGetFullName()<<"]::bbSignalOutputModification("<<*o<<") : unknown output"); 00561 } 00562 00563 // if (i->second->GetStatus()==UPTODATE) 00564 // { 00565 i->second->SignalChange(GetThisPointer<BlackBox>(),i->first); 00566 changed = true; 00567 // } 00568 } 00569 // Has to notify the output "BoxChange" also 00570 i = bbGetOutputConnectorMap().find("BoxChange"); 00571 if ( changed && (i != bbGetOutputConnectorMap().end())) 00572 { 00573 // if (i->second->GetStatus()==UPTODATE) 00574 // { 00575 i->second->SignalChange(GetThisPointer<BlackBox>(),i->first); 00576 if (reaction) bbGlobalProcessExecutionList(); 00577 // } 00578 } 00579 00580 bbtkBlackBoxDebugMessage("change",5, 00581 "<= BlackBox::bbSignalOutputModification(vector of outputs)" 00582 <<std::endl); 00583 }
void bbtk::BlackBox::bbSignalOutputModification | ( | const std::string & | output_name, | |
bool | reaction = true | |||
) | [virtual] |
Signals that the BlackBox output "output_name" has been modified (without marking the box as MODIFIED because its output state is ok : don't care if you understand : use it !). This method should be used by widgets in response to user interaction only when **ONE** output has been modified (after the output has been updated !) DO NOT PASS reaction = false OR WILL NOT WORK PROPERLY USER INTENDED **
Definition at line 504 of file bbtkBlackBox.cxx.
References bbGetFullName(), bbGetOutputConnectorMap(), bbGlobalProcessExecutionList(), bbtkBlackBoxDebugMessage, bbtkError, and bbtk::i.
00506 { 00507 bbtkBlackBoxDebugMessage("change",5, 00508 "=> BlackBox::bbSignalOutputModification(" 00509 <<output<<","<<reaction<<")" 00510 <<std::endl); 00511 00512 OutputConnectorMapType::iterator i = 00513 bbGetOutputConnectorMap().find(output); 00514 00515 00516 if ( i == bbGetOutputConnectorMap().end() ) 00517 { 00518 bbtkError("BlackBox["<<bbGetFullName()<<"]::bbSignalOutputModification("<<output<<") : unknown output"); 00519 } 00520 00521 // if (i->second->GetStatus()==UPTODATE) 00522 // { 00523 i->second->SignalChange(GetThisPointer<BlackBox>(),i->first); 00524 // Has to notify the output "BoxChange" also 00525 if (output != "BoxChange") 00526 { 00527 i = bbGetOutputConnectorMap().find("BoxChange"); 00528 if ( i != bbGetOutputConnectorMap().end() ) 00529 { 00530 i->second->SignalChange(GetThisPointer<BlackBox>(),i->first); 00531 } 00532 } 00533 if (reaction) bbGlobalProcessExecutionList(); 00534 // } 00535 00536 bbtkBlackBoxDebugMessage("change",5, 00537 "<= BlackBox::bbSignalOutputModification(" 00538 <<output<<")" 00539 <<std::endl); 00540 }
void bbtk::BlackBox::bbSignalOutputModification | ( | bool | reaction = true |
) | [virtual] |
Signals that the BlackBox outputs have been modified (without marking the box as MODIFIED because its output state is ok : don't care if you understand : use it !). This method should be used by widgets in response to user interaction when **ALL** outputs have been modified (after the outputs has been updated !). DO NOT PASS reaction = false OR WILL NOT WORK PROPERLY USER INTENDED **
Definition at line 472 of file bbtkBlackBox.cxx.
References bbGetOutputConnectorMap(), bbGlobalProcessExecutionList(), bbtkBlackBoxDebugMessage, and bbtk::i.
00473 { 00474 bbtkBlackBoxDebugMessage("change",5, 00475 "=> BlackBox::bbSignalOutputModification(" 00476 <<reaction<<")" 00477 <<"]"<<std::endl); 00478 00479 OutputConnectorMapType::iterator i; 00480 for ( i = bbGetOutputConnectorMap().begin(); 00481 i != bbGetOutputConnectorMap().end(); ++i) 00482 { 00483 // std::cout << "Stat = " 00484 //<<GetIOStatusString(i->second->GetStatus()) 00485 // <<std::endl; 00486 // LG : CANNOT SIGNAL ONLY WHEN UPTODATE 00487 // See bbtkSampleOutputObserver 00488 // if (i->second->GetStatus()==UPTODATE) 00489 // { 00490 i->second->SignalChange(GetThisPointer<BlackBox>(),i->first); 00491 // } 00492 } // for 00493 00494 if (reaction) bbGlobalProcessExecutionList(); 00495 00496 bbtkBlackBoxDebugMessage("change",5, 00497 "<= BlackBox::bbSignalOutputModification()" 00498 <<std::endl); 00499 }
IOStatus bbtk::BlackBox::bbUpdateInputs | ( | ) | [protected] |
Updates the BlackBox inputs Calls RecursiveExecute on all BlackBoxInputConnector
Definition at line 739 of file bbtkBlackBox.cxx.
References bbGetInputConnectorMap(), bbtkBlackBoxDebugMessage, bbtk::GetIOStatusString(), bbtk::i, and bbtk::UPTODATE.
Referenced by bbRecursiveExecute().
00740 { 00741 bbtkBlackBoxDebugMessage("process",4, 00742 "=> BlackBox::bbUpdateInputs()" 00743 <<std::endl); 00744 00745 IOStatus s = UPTODATE; 00746 00747 InputConnectorMapType::iterator i; 00748 for ( i = bbGetInputConnectorMap().begin(); 00749 i!= bbGetInputConnectorMap().end(); ++i) 00750 { 00751 // if (i->first=="WinHide") continue; 00752 // If input type is Void : no recurse 00753 //if ( bbGetDescriptor()->GetInputDescriptor(i->first)->GetTypeInfo() 00754 // == typeid(Void) ) 00755 // continue; 00756 bbtkBlackBoxDebugMessage("change",2, 00757 "Input '"<<i->first 00758 <<"': status before update = '" 00759 <<GetIOStatusString(i->second->GetStatus()) 00760 <<"'"<<std::endl); 00761 i->second->RecursiveExecute(); 00762 IOStatus t = i->second->GetStatus(); 00763 if (t > s) s = t; 00764 bbtkBlackBoxDebugMessage("change",2, 00765 "Input '"<<i->first 00766 <<"': status before process = '" 00767 <<GetIOStatusString(i->second->GetStatus()) 00768 <<"'"<<std::endl); 00769 } 00770 00771 bbtkBlackBoxDebugMessage("process",4, 00772 "<= BlackBox::bbUpdateInputs()" 00773 <<std::endl); 00774 return s; 00775 }
virtual void bbtk::BlackBox::bbUserFinalizeProcessing | ( | ) | [inline, protected, virtual] |
User must redefine this method to uninitialize what has been initialized in bbUserInitializeProcessing, typically desallocate memory that has been allocated dynamically. It is called in the box destructor if and only if (iff) bbUserInitializeProcessing has been called previously.
Reimplemented in bbtk::QtBlackBox, bbtk::WidgetBlackBox< W >, bbtk::WxBlackBox, bbtk::WidgetBlackBox< QWidget >, and bbtk::WidgetBlackBox< wxWindow >.
Definition at line 388 of file bbtkBlackBox.h.
virtual void bbtk::BlackBox::bbUserInitializeProcessing | ( | ) | [inline, protected, virtual] |
User can redefine this method to initialize what must be initialized for the box to work, for example allocate dynamic data. It is called once and only once before any call to bbUserCreateWidget or bbUserProcess. What has been allocated here must be desalocated in bbFinalizeProcessing
Reimplemented in bbtk::QtBlackBox, bbtk::WidgetBlackBox< W >, bbtk::WxBlackBox, bbtk::WidgetBlackBox< QWidget >, and bbtk::WidgetBlackBox< wxWindow >.
Definition at line 381 of file bbtkBlackBox.h.
virtual void bbtk::BlackBox::bbUserOnShow | ( | ) | [inline, protected, virtual] |
Definition at line 390 of file bbtkBlackBox.h.
Referenced by bbtk::WidgetBlackBox< W >::bbSetShown().
virtual void bbtk::BlackBox::bbUserSetDefaultValues | ( | ) | [inline, protected, virtual] |
User can redefine this method to set the default values of the box inputs and outputs (it is called in the box constructor)
Reimplemented in bbtk::QtBlackBox, bbtk::WidgetBlackBox< W >, bbtk::WxBlackBox, bbtk::WidgetBlackBox< QWidget >, and bbtk::WidgetBlackBox< wxWindow >.
Definition at line 373 of file bbtkBlackBox.h.
void bbtk::BlackBox::bbWriteDotFileBlackBox | ( | FILE * | ff, | |
BlackBox::Pointer | parentblackbox, | |||
int | detail, | |||
int | level, | |||
bool | instanceOrtype, | |||
bool | relative_link | |||
) | [protected, virtual] |
Write Graphviz-dot description in file.
Write Graphviz-dot description in file. Here dumps a single box description (i/o) but overloaded in ComplexBlackBox to dump the internal pipeline representation recursing into internal boxes descriptions if level>0. detail = 1 : draw inputs and outputs (do not draw otherwise) instanceOrtype = true : draw inputs and outputs VALUES (uses bbGetInputAsString / bbGetOutputAsString which use adaptors) If relative_link is true then creates relative hrefs
Reimplemented in bbtk::ComplexBlackBox.
Definition at line 1090 of file bbtkBlackBox.cxx.
References bbGetDescriptor(), bbGetInputAsString(), bbGetName(), bbGetOutputAsString(), bbGetTypeName(), bbWriteDotInputOutputName(), bbtk::Connection::GetOriginalBlackBoxFrom(), bbtk::Connection::GetOriginalBlackBoxFromOutput(), bbtk::Connection::GetOriginalBlackBoxTo(), bbtk::Connection::GetOriginalBlackBoxToInput(), bbtk::i, mInputConnectorMap, mOutputConnectorMap, and bbtk::SubsBrackets().
01096 { 01097 InputConnectorMapType::iterator i; 01098 // label 01099 std::string labelStr; 01100 std::string valueStr(""); 01101 01102 if (detail==0) { 01103 labelStr = bbGetName() ; 01104 //EED 18 Fev 2008 01105 labelStr = labelStr + "\\n[" +this->bbGetDescriptor()->GetPackage()->GetName()+"::"+ bbGetTypeName() + "]"; 01106 } else { 01107 labelStr = bbGetName(); 01108 labelStr = labelStr + " [" +this->bbGetDescriptor()->GetPackage()->GetName()+"::"+ bbGetTypeName() + "] "; 01109 } 01110 01111 SubsBrackets(labelStr); 01112 if (detail==1) 01113 { 01114 labelStr = labelStr + " | {{ "; 01115 std::string tempStrTypeName; 01116 bool tmp; 01117 tmp=false; 01118 for ( i = mInputConnectorMap.begin(); i != mInputConnectorMap.end(); ++i ) 01119 { 01120 if (tmp==true) 01121 { 01122 labelStr=labelStr+" | "; 01123 } 01124 tmp=true; 01125 if (instanceOrtype==true) 01126 { 01127 valueStr = this->bbGetInputAsString(i->first) + " = "; 01128 } 01129 const BlackBoxInputDescriptor* id = bbGetDescriptor()->GetInputDescriptor(i->first); 01130 tempStrTypeName=id->GetTypeName(); 01131 SubsBrackets(tempStrTypeName); 01132 std::string Name(i->first); 01133 SubsBrackets(Name); 01134 labelStr=labelStr + "<"+i->first.c_str()+"> " + valueStr + Name.c_str() + " [" + tempStrTypeName.c_str() + "]"; 01135 } 01136 labelStr=labelStr+ " } | {"; 01137 tmp = false; 01138 OutputConnectorMapType::iterator ii; 01139 for ( ii = mOutputConnectorMap.begin(); ii != mOutputConnectorMap.end(); ++ii ) 01140 { 01141 if (tmp==true) 01142 { 01143 labelStr=labelStr+" | "; 01144 } 01145 tmp = true; 01146 if (instanceOrtype==true) 01147 { 01148 valueStr = this->bbGetOutputAsString(ii->first) + " = "; 01149 } 01150 const BlackBoxOutputDescriptor* id = bbGetDescriptor()->GetOutputDescriptor(ii->first); 01151 tempStrTypeName=id->GetTypeName(); 01152 SubsBrackets(tempStrTypeName); 01153 std::string Name(ii->first); 01154 SubsBrackets(Name); 01155 labelStr=labelStr+"<"+ii->first.c_str()+"> " + valueStr + Name.c_str() + " ["+tempStrTypeName+"]"; 01156 } 01157 labelStr = labelStr+ " } }" ; 01158 } // detail 01159 01160 fprintf(ff," " ); 01161 bbWriteDotInputOutputName(ff,true,detail,level); 01162 std::string tmp ( bbGetTypeName() ); 01163 SubsBrackets(tmp); 01164 std::string url; 01165 if (relative_link) 01166 url = this->bbGetDescriptor()->GetPackage()->GetDocRelativeURL() + "#" + tmp; 01167 else 01168 url = this->bbGetDescriptor()->GetPackage()->GetDocURL() + "#" + tmp; 01169 01170 fprintf( ff , " [shape=record, URL=\"%s\",label=\"%s\"]%s\n",url.c_str(),labelStr.c_str(),";" ); 01171 // std::cout << labelStr << std::endl; 01172 01173 // Relation Input 01174 if (GetThisPointer<BlackBox>()!=parentblackbox){ 01175 for ( i = mInputConnectorMap.begin(); i != mInputConnectorMap.end(); ++i ) 01176 { 01177 if (i->second) 01178 { 01179 Connection* con = i->second->GetConnection(); 01180 if (con!=NULL){ 01181 BlackBox::Pointer a=con->GetOriginalBlackBoxFrom(); 01182 BlackBox::Pointer b=con->GetOriginalBlackBoxTo(); 01183 fprintf(ff," "); 01184 a->bbWriteDotInputOutputName(ff,false,detail,level); 01185 if (detail==1) 01186 { 01187 fprintf(ff,":%s",con->GetOriginalBlackBoxFromOutput().c_str()); 01188 } 01189 fprintf(ff,"->"); 01190 b->bbWriteDotInputOutputName(ff,true,detail,level); 01191 if (detail==1) 01192 { 01193 fprintf(ff,":%s",con->GetOriginalBlackBoxToInput().c_str()); 01194 } 01195 fprintf(ff,"%s\n",";"); 01196 } // if con 01197 } // if second 01198 } // for 01199 } // if parentblackbox 01200 }
void bbtk::BlackBox::bbWriteDotInputOutputName | ( | FILE * | ff, | |
bool | inputoutput, | |||
int | detail, | |||
int | level | |||
) | [protected, virtual] |
Auxiliary method for bbWriteDotFileBlackBox.
Reimplemented in bbtk::ComplexBlackBox.
Definition at line 951 of file bbtkBlackBox.cxx.
References bbGetTypeName().
Referenced by bbWriteDotFileBlackBox().
00952 { 00953 fprintf(ff,"%s%p",bbGetTypeName().c_str(),this); 00954 }
void bbtk::BlackBox::Check | ( | bool | recursive = true |
) | [protected, virtual] |
Reimplemented in bbtk::ComplexBlackBox.
Definition at line 1443 of file bbtkBlackBox.cxx.
References bbtkBlackBoxMessage.
01444 { 01445 bbtkBlackBoxMessage("debug",1,"*** Checking" 01446 <<" ... OK"<<std::endl); 01447 }
std::string bbtk::Object::GetObjectInfo | ( | ) | const [virtual, inherited] |
Reimplemented in bbtk::AtomicBlackBox, bbtk::ComplexBlackBox, bbtk::ComplexBlackBoxDescriptor, bbtk::Connection, bbtk::Executer, bbtk::Factory, bbtk::Interpreter, bbtk::InterpreterVirtual, bbtk::Package, and bbtk::Transcriptor.
Definition at line 98 of file bbtkObject.cxx.
virtual size_t bbtk::Object::GetObjectInternalSize | ( | ) | const [inline, virtual, inherited] |
Reimplemented in bbtk::ComplexBlackBox, bbtk::ComplexBlackBoxDescriptor, bbtk::Connection, bbtk::Executer, bbtk::Factory, bbtk::Interpreter, bbtk::InterpreterVirtual, bbtk::Package, and bbtk::Transcriptor.
Definition at line 61 of file bbtkObject.h.
00061 { return sizeof(Object); }
std::string bbtk::Object::GetObjectName | ( | ) | const [virtual, inherited] |
Reimplemented in bbtk::ComplexBlackBox, bbtk::ComplexBlackBoxDescriptor, bbtk::Connection, bbtk::Executer, bbtk::Factory, bbtk::Interpreter, bbtk::InterpreterVirtual, bbtk::Package, bbtk::QtBlackBox, bbtk::QtBlackBoxDescriptor, bbtk::Transcriptor, bbtk::WidgetBlackBox< W >, bbtk::WidgetBlackBoxDescriptor< T >, bbtk::WxBlackBox, bbtk::WxBlackBoxDescriptor, bbtk::WidgetBlackBox< QWidget >, bbtk::WidgetBlackBox< wxWindow >, bbtk::WidgetBlackBoxDescriptor< QWidget >, and bbtk::WidgetBlackBoxDescriptor< wxWindow >.
Definition at line 91 of file bbtkObject.cxx.
Referenced by bbtk::BlackBox::Deleter::Delete(), and bbtk::Object::Deleter::operator()().
virtual size_t bbtk::Object::GetObjectRecursiveSize | ( | ) | const [inline, virtual, inherited] |
Reimplemented in bbtk::AtomicBlackBox, bbtk::ComplexBlackBox, bbtk::ComplexBlackBoxDescriptor, bbtk::Connection, bbtk::Executer, bbtk::Factory, bbtk::Interpreter, bbtk::InterpreterVirtual, bbtk::Package, and bbtk::Transcriptor.
Definition at line 62 of file bbtkObject.h.
Referenced by bbtk::Transcriptor::GetObjectRecursiveSize(), bbtk::Package::GetObjectRecursiveSize(), bbtk::InterpreterVirtual::GetObjectRecursiveSize(), bbtk::Interpreter::GetObjectRecursiveSize(), bbtk::Factory::GetObjectRecursiveSize(), bbtk::Executer::GetObjectRecursiveSize(), bbtk::Connection::GetObjectRecursiveSize(), bbtk::ComplexBlackBoxDescriptor::GetObjectRecursiveSize(), and bbtk::ComplexBlackBox::GetObjectRecursiveSize().
00062 { return sizeof(Object); }
static long bbtk::Object::GetObjectsCount | ( | ) | [inline, static, inherited] |
Definition at line 75 of file bbtkObject.h.
Referenced by bbtk::StaticInitTime::~StaticInitTime().
00075 { return mgObjectList.size(); }
virtual size_t bbtk::Object::GetObjectSize | ( | ) | const [inline, virtual, inherited] |
Reimplemented in bbtk::AtomicBlackBox, bbtk::ComplexBlackBox, bbtk::ComplexBlackBoxDescriptor, bbtk::Connection, bbtk::Executer, bbtk::Factory, bbtk::Interpreter, bbtk::InterpreterVirtual, bbtk::Package, bbtk::QtBlackBoxDescriptor, bbtk::Transcriptor, and bbtk::WxBlackBoxDescriptor.
Definition at line 60 of file bbtkObject.h.
Referenced by bbtk::Transcriptor::GetObjectSize(), bbtk::Package::GetObjectSize(), bbtk::InterpreterVirtual::GetObjectSize(), bbtk::Interpreter::GetObjectSize(), bbtk::Factory::GetObjectSize(), bbtk::Executer::GetObjectSize(), bbtk::Connection::GetObjectSize(), bbtk::ComplexBlackBoxDescriptor::GetObjectSize(), and bbtk::ComplexBlackBox::GetObjectSize().
00060 { return sizeof(Object); }
boost::shared_ptr<U> bbtk::Object::GetThisPointer | ( | ) | const [inline, protected, inherited] |
Definition at line 92 of file bbtkObject.h.
00093 { 00094 return boost::dynamic_pointer_cast<U>(mThisPointer.lock()); 00095 }
long bbtk::Object::GetUseCount | ( | ) | [inline, inherited] |
void bbtk::Object::InsertInObjectList | ( | Pointer | p | ) | [static, inherited] |
Definition at line 59 of file bbtkObject.cxx.
References bbtkDebugMessage, and bbtk::Object::mgObjectList.
Referenced by bbtk::Object::MakePointer().
00060 { 00061 bbtkDebugMessage("object",9,"##> Object::InsertInObjectList(\"" 00062 <<p->GetObjectName()<<"\" ["<<p<<"])"<<std::endl); 00063 boost::weak_ptr<Object> w(p); 00064 mgObjectList.insert(w); 00065 }
void bbtk::Object::InsertInPackageList | ( | Pointer | p | ) | [static, inherited] |
Definition at line 69 of file bbtkObject.cxx.
References bbtkDebugMessage, and bbtk::Object::mgPackageList.
00070 { 00071 bbtkDebugMessage("object",9,"##> Object::InsertInPackageList(\"" 00072 <<p->GetObjectName()<<"\" ["<<p<<"])"<<std::endl); 00073 boost::weak_ptr<Object> w(p); 00074 mgPackageList.insert(w); 00075 }
void bbtk::Object::LockThis | ( | ) | [inline, protected, inherited] |
static boost::shared_ptr<U> bbtk::BlackBox::MakeBlackBoxPointer | ( | U * | s, | |
bool | lock = false | |||
) | [inline, static, protected] |
Like Object::MakePointer but returns a boost::shared_pointer which uses a BlackBox::Deleter to delete the object instead of the default Object::Deleter.
Definition at line 609 of file bbtkBlackBox.h.
Referenced by bbAllocateConnectors(), bbtk::ComplexBlackBox::bbClone(), bbtk::ComplexBlackBox::ComplexBlackBox(), and bbtk::ComplexBlackBox::New().
00610 { 00611 return MakePointer(s,BlackBox::Deleter(),lock); 00612 }
static boost::shared_ptr<U> bbtk::Object::MakePointer | ( | U * | s, | |
const D & | del, | |||
bool | lock = false | |||
) | [inline, static, protected, inherited] |
Definition at line 115 of file bbtkObject.h.
References bbtk::Object::InsertInObjectList().
00118 { 00119 if (s->mThisPointer.lock()) 00120 { 00121 boost::shared_ptr<U> p = s->GetThisPointer<U>(); 00122 if (!lock) s->mThisPointerLocked.reset(); 00123 return p; 00124 } 00125 boost::shared_ptr<U> p = boost::shared_ptr<U>(s,del); 00126 static_cast<D*> 00127 (p._internal_get_deleter(typeid(D))) 00128 ->mPointer = p; 00129 s->mThisPointer = p; 00130 Object::InsertInObjectList(p); 00131 if (lock) s->LockThis(); 00132 return p; 00133 }
static boost::shared_ptr<U> bbtk::Object::MakePointer | ( | U * | s, | |
bool | lock = false | |||
) | [inline, static, protected, inherited] |
Definition at line 97 of file bbtkObject.h.
References bbtk::Object::InsertInObjectList().
Referenced by bbtk::ComplexBlackBoxDescriptor::ComplexBlackBoxDescriptor(), bbtk::Executer::Executer(), bbtk::Interpreter::Init(), bbtk::Transcriptor::New(), bbtk::Package::New(), bbtk::InterpreterVirtual::New(), bbtk::Interpreter::New(), bbtk::Factory::New(), bbtk::Executer::New(), and bbtk::ComplexBlackBoxDescriptor::New().
00098 { 00099 if (s->mThisPointer.lock()) 00100 { 00101 boost::shared_ptr<U> p = s->GetThisPointer<U>(); 00102 if (!lock) s->mThisPointerLocked.reset(); 00103 return p; 00104 } 00105 boost::shared_ptr<U> p = boost::shared_ptr<U>(s,Object::Deleter()); 00106 static_cast<Object::Deleter*> 00107 (p._internal_get_deleter(typeid(Object::Deleter))) 00108 ->mPointer = p; 00109 s->mThisPointer = p; 00110 Object::InsertInObjectList(p); 00111 if (lock) s->LockThis(); 00112 return p; 00113 }
void bbtk::Object::PrintObjectInfo | ( | const Pointer & | o | ) | [static, inherited] |
Definition at line 180 of file bbtkObject.cxx.
Referenced by bbtk::Object::PrintObjectListInfo().
00181 { 00182 std::cout << "* [" << p << "] \t" 00183 << p.use_count()-1 << " r \t" 00184 << p->GetObjectRecursiveSize() << " (" 00185 << p->GetObjectSize() << ") b \t" 00186 << p->GetObjectName() 00187 << std::endl; 00188 std::cout << p->GetObjectInfo(); 00189 }
void bbtk::Object::PrintObjectListInfo | ( | const std::string & | name | ) | [static, inherited] |
Definition at line 105 of file bbtkObject.cxx.
References bbtk::i, bbtk::Object::mgObjectList, and bbtk::Object::PrintObjectInfo().
Referenced by bbtk::Interpreter::commandDebug().
00106 { 00107 00108 std::cout 00109 << "=============== Living bbtk::Object pointers ========="<<std::endl; 00110 00111 long n = 0; 00112 long u = 0; 00113 size_t m = 0; 00114 ObjectListType::iterator i; 00115 for (i = mgObjectList.begin(); 00116 i!=mgObjectList.end(); 00117 ++i) 00118 { 00119 if (i->use_count() == 0) 00120 { 00121 u++; 00122 } 00123 else 00124 { 00125 Object::Pointer p(i->lock()); 00126 if (p->GetObjectName().find(name) != std::string::npos ) 00127 { 00128 std::cout << n << "/" << mgObjectList.size() << " "; 00129 PrintObjectInfo(p); 00130 m += p->GetObjectSize(); 00131 n++; 00132 } 00133 } 00134 } 00135 std::cout 00136 << "------------------------------------------------------"<<std::endl; 00137 00138 std::cout << " Total : "<<n<<" objects - "<<m<<" b"<<std::endl; 00139 if (u==1) 00140 { 00141 std::cout<<"* Note : "<<u 00142 <<" object in list has 0 ref count, " 00143 <<"i.e. are no more accessible by bbtk but did not properly destroyed because another ref counting system is holding them !"<<std::endl; 00144 } 00145 else if (u>1) 00146 { 00147 std::cout<<"* Note : "<<u 00148 <<" objects in list have 0 ref count, " 00149 <<"i.e. are no more accessible by bbtk but did not properly destroyed because another ref counting system is holding them !"<<std::endl; 00150 } 00151 std::cout 00152 << "============ EO Living bbtk::Object pointers ========="<<std::endl; 00153 00154 }
void bbtk::Object::ReleasePackages | ( | ) | [static, inherited] |
Definition at line 222 of file bbtkObject.cxx.
References bbtkDebugMessage, bbtk::i, bbtk::Object::mgPackageList, and bbtk::Package::Release().
Referenced by bbtk::StaticInitTime::~StaticInitTime().
00223 { 00224 bbtkDebugMessage("object",1,"##> Object::ReleasePackages()"<<std::endl); 00225 // Release package pointers 00226 ObjectListType::iterator i; 00227 for (i = mgPackageList.begin(); 00228 i!= mgPackageList.end(); 00229 ++i) 00230 { 00231 if (i->use_count() != 0) 00232 { 00233 bbtkDebugMessage("object",1,"##> Releasing package '"<< 00234 i->lock()->GetThisPointer<Package>()->GetName() 00235 <<"'"<<std::endl); 00236 // Object::Pointer p(i->lock()); 00237 Package::WeakPointer w(i->lock()->GetThisPointer<Package>()); 00238 Package::Release(w); 00239 /* 00240 if (p->GetObjectName().find(name) != std::string::npos ) 00241 { 00242 std::cout << n << "/" << mgObjectList.size() << " "; 00243 PrintObjectInfo(p); 00244 m += p->GetObjectSize(); 00245 n++; 00246 } 00247 */ 00248 } 00249 } 00250 00251 }
void bbtk::Object::RemoveFromObjectList | ( | WeakPointer | p | ) | [static, inherited] |
Definition at line 80 of file bbtkObject.cxx.
References bbtkDebugMessage, and bbtk::Object::mgObjectList.
Referenced by bbtk::Object::Deleter::operator()().
00081 { 00082 bbtkDebugMessage("object",9,"##> Object::RemoveFromObjectList()" 00083 <<std::endl); 00084 mgObjectList.erase(p); 00085 00086 }
void bbtk::Object::UnLockThis | ( | ) | [inline, protected, inherited] |
friend class ComplexBlackBox [friend] |
Definition at line 550 of file bbtkBlackBox.h.
friend class Connection [friend] |
Definition at line 549 of file bbtkBlackBox.h.
friend struct Object::Deleter [friend] |
Reimplemented in bbtk::ComplexBlackBox, bbtk::QtBlackBox, bbtk::WidgetBlackBox< W >, bbtk::WxBlackBox, bbtk::WidgetBlackBox< QWidget >, and bbtk::WidgetBlackBox< wxWindow >.
Definition at line 74 of file bbtkBlackBox.h.
std::string bbtk::BlackBox::bbmBoxProcessMode [private] |
The box processing mode 0 : "Pipeline" mode 1 : "Always" mode 2 : "Reactive" mode
Definition at line 645 of file bbtkBlackBox.h.
Referenced by bbGetBoxProcessModeValue().
bool bbtk::BlackBox::bbmExecuting [private] |
bool bbtk::BlackBox::bbmInitialized [private] |
Is the box initialized ?
Definition at line 634 of file bbtkBlackBox.h.
Referenced by bbFinalizeProcessing(), and bbInitializeProcessing().
std::string bbtk::BlackBox::bbmName [private] |
The name of the black-box.
Definition at line 638 of file bbtkBlackBox.h.
Referenced by bbGetNameWithParent(), and ~BlackBox().
std::string bbtk::BlackBox::bbmPackageName [private] |
The parent of the black box in the ComplexBlackBox hierarchy.
Definition at line 647 of file bbtkBlackBox.h.
Referenced by bbGetNameWithParent().
Map that contains the input connectors of the black box.
Definition at line 656 of file bbtkBlackBox.h.
Referenced by bbPrintHelp(), and bbWriteDotFileBlackBox().
Map that contains the output connectors of the black box.
Definition at line 654 of file bbtkBlackBox.h.
Referenced by bbPrintHelp(), and bbWriteDotFileBlackBox().