#include <bbtkComplexBlackBox.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'. | |
Public Types | |
typedef ComplexBlackBox | Self |
typedef boost::shared_ptr< Self > | Pointer |
typedef boost::weak_ptr< Self > | WeakPointer |
typedef std::map< std::string, BlackBox::Pointer > | BlackBoxMapType |
The type of map of black boxes. | |
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 | |
std::string | GetObjectName () const |
std::string | GetObjectInfo () const |
size_t | GetObjectSize () const |
size_t | GetObjectInternalSize () const |
size_t | GetObjectRecursiveSize () const |
BlackBoxDescriptor::Pointer | bbGetDescriptor () const |
Returns the pointer on the box' descriptor. | |
BlackBox::Pointer | bbClone (const std::string &name) |
Returns a pointer on a new instance with name <name>. | |
void | Clear () |
Clear. | |
void | SetAsPrototype () |
Set as prototype. | |
bool | IsAPrototype () const |
Returns true if it is a prototype. | |
std::string | bbGetNameWithParent () const |
Returns the name with the name of the parent prepended if any. | |
void | bbExecute (bool force=false) |
Data | bbGetOutput (const std::string &label) |
Gets the data of the output called <name>. | |
Data | bbGetInput (const std::string &label) |
Gets the input Data of a given name. | |
void | bbSetOutput (const std::string &name, Data data) |
Sets the data of the output called <name>. | |
void | bbSetInput (const std::string &name, Data data, bool setModified=true) |
Sets the data of the input called <name>. | |
void | bbBruteForceSetInputPointer (const std::string &name, void *data, bool setModified=true) |
Sets the data of the input called <name>. | |
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. | |
BlackBox::Pointer | bbGetBlackBox (const std::string &name) |
Returns the black box with name <name>. | |
const BlackBoxMapType & | bbGetBlackBoxMap () |
void | bbPrintBlackBoxes () |
void | bbInsertHTMLGraph (std::ofstream &s, int detail, int level, bool instanceOrtype, const std::string &output_dir, bool relative_link) |
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) |
Virtual. | |
virtual BlackBox::Pointer | bbFindBlackBox (const std::string &blackboxname) |
void | Check (bool recursive=true) |
virtual void | bbGetHelp (bool full=true) const |
Prints the Help on the BlackBox type. | |
virtual void | bbPrintHelp (BlackBox::Pointer parentblackbox, int detail, int level) |
long | GetUseCount () |
General accessors | |
Methods which give access to general informations on 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). | |
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>. | |
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 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. | |
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). | |
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 Types | |
typedef BlackBox | Superclass |
Protected Member Functions | |
ComplexBlackBox () | |
ComplexBlackBox (const ComplexBlackBox &) | |
~ComplexBlackBox () | |
Destructor. | |
void | bbAddBlackBox (BlackBox::Pointer) |
Adds the black box to the complex box. | |
void | bbAddToExecutionList (const std::string &name) |
void | bbUnsafeAddBlackBox (BlackBox::Pointer) |
Adds the black box to the complex box (unsafe). | |
void | bbRemoveBlackBox (const std::string &name, bool remove_connections=true) |
Removes the black box from the complex box. | |
void | bbAddConnection (Connection::Pointer) |
Adds the connection to the complex box. | |
BlackBox::Pointer | bbUnsafeGetBlackBox (const std::string &name) |
void | bbAllocateConnectors () |
Allocates the i/o connectors of the black box. | |
void | bbDesallocateConnectors () |
Desallocates the i/o connectors of the black box. | |
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 | 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 | |
static ComplexBlackBox::Pointer | New (const std::string &name, ComplexBlackBoxDescriptor::Pointer desc) |
Creates a new complex black box. | |
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 Types | |
typedef std::list < Connection::Pointer > | ConnectionListType |
The type of list of connections. | |
Private Member Functions | |
ComplexBlackBox (const std::string &name, ComplexBlackBoxDescriptor::Pointer desc) | |
Constructor that takes the ComplexBlackBox name. | |
ComplexBlackBox (ComplexBlackBox &from, const std::string &name) | |
Constructor from an existing box (copy) with a new name. | |
Private Attributes | |
ComplexBlackBoxDescriptor::Pointer | mLockedDescriptor |
Default constructor : derived classes must use the constructor with the ComplexBlackBox's name. | |
ComplexBlackBoxDescriptor::WeakPointer | mDescriptor |
The descriptor pointer. | |
BlackBoxMapType | mBlackBoxMap |
The map of black boxes. | |
ConnectionListType | mConnectionList |
The list of connections. | |
std::vector< std::string > | mExecutionList |
The execution list. | |
Friends | |
struct | Object::Deleter |
class | ComplexBlackBoxDescriptor |
Definition at line 59 of file bbtkComplexBlackBox.h.
typedef std::map<std::string, BlackBox::Pointer> bbtk::ComplexBlackBox::BlackBoxMapType |
typedef std::list<Connection::Pointer> bbtk::ComplexBlackBox::ConnectionListType [private] |
typedef std::map<std::string, BlackBoxInputConnector*> bbtk::BlackBox::InputConnectorMapType [inherited] |
typedef OutputChangeSignalType::slot_function_type bbtk::BlackBox::OutputChangeCallbackType [inherited] |
Definition at line 87 of file bbtkBlackBox.h.
typedef boost::signals::trackable bbtk::BlackBox::OutputChangeObserverType [inherited] |
Definition at line 74 of file bbtkBlackBox.h.
typedef boost::signal<void (bbtk::BlackBox::Pointer, const std::string&, IOStatus)> bbtk::BlackBox::OutputChangeSignalType [inherited] |
Definition at line 85 of file bbtkBlackBox.h.
typedef std::map<std::string, BlackBoxOutputConnector*> bbtk::BlackBox::OutputConnectorMapType [inherited] |
typedef boost::shared_ptr<Self> bbtk::ComplexBlackBox::Pointer |
typedef BlackBox bbtk::ComplexBlackBox::Superclass [protected] |
Definition at line 63 of file bbtkComplexBlackBox.h.
typedef boost::weak_ptr<Self> bbtk::ComplexBlackBox::WeakPointer |
enum bbtk::BlackBox::BoxProcessModeValue [inherited] |
The possible values of the input 'BoxProcessMode'.
Definition at line 297 of file bbtkBlackBox.h.
00298 { 00299 bbPipeline, 00300 bbAlways, 00301 bbReactive 00302 }
bbtk::ComplexBlackBox::ComplexBlackBox | ( | ) | [protected] |
bbtk::ComplexBlackBox::ComplexBlackBox | ( | const ComplexBlackBox & | ) | [protected] |
bbtk::ComplexBlackBox::~ComplexBlackBox | ( | ) | [protected] |
Destructor.
Definition at line 139 of file bbtkComplexBlackBox.cxx.
References bbDesallocateConnectors(), bbtkBlackBoxDebugMessage, and Clear().
00140 { 00141 bbtkBlackBoxDebugMessage("object",3, 00142 "==> ~ComplexBlackBox()" 00143 <<std::endl); 00144 00145 Clear(); 00146 this->bbDesallocateConnectors(); 00147 00148 bbtkBlackBoxDebugMessage("object",3, 00149 "<== ~ComplexBlackBox()" 00150 <<std::endl); 00151 }
bbtk::ComplexBlackBox::ComplexBlackBox | ( | const std::string & | name, | |
ComplexBlackBoxDescriptor::Pointer | desc | |||
) | [private] |
Constructor that takes the ComplexBlackBox name.
Usefull constructor.
Definition at line 62 of file bbtkComplexBlackBox.cxx.
References bbAllocateConnectors(), and bbtkBlackBoxDebugMessage.
00064 : 00065 BlackBox(name), 00066 mLockedDescriptor(desc), 00067 mDescriptor(desc) 00068 { 00069 bbtkBlackBoxDebugMessage("object",3, 00070 "##> ComplexBlackBox(\"" 00071 <<name<<"\")"<<std::endl); 00072 bbAllocateConnectors(); 00073 bbtkBlackBoxDebugMessage("object",3, 00074 "<## ComplexBlackBox(\"" 00075 <<name<<"\")"<<std::endl); 00076 }
bbtk::ComplexBlackBox::ComplexBlackBox | ( | ComplexBlackBox & | from, | |
const std::string & | name | |||
) | [private] |
Constructor from an existing box (copy) with a new name.
Definition at line 81 of file bbtkComplexBlackBox.cxx.
References bbAddConnection(), bbAllocateConnectors(), bbGetBlackBox(), bbtk::BlackBox::bbGetName(), bbtkBlackBoxDebugMessage, bbUnsafeAddBlackBox(), bbtk::i, bbtk::BlackBox::MakeBlackBoxPointer(), mBlackBoxMap, mConnectionList, and mDescriptor.
00083 : BlackBox(from,name), 00084 // The locked descriptor is copied from the unlocked one 00085 // to make the box a non-prototype !! 00086 mLockedDescriptor(from.mDescriptor), 00087 mDescriptor(from.mDescriptor), 00088 mExecutionList(from.mExecutionList) 00089 { 00090 bbtkBlackBoxDebugMessage("object",3, 00091 "##> ComplexBlackBox(\"" 00092 <<from.bbGetName()<<"\",\"" 00093 <<name<<"\")"<<std::endl); 00094 bbtkBlackBoxDebugMessage("object",4," * Cloning Black Boxes"<<std::endl); 00095 00096 // We have to make the shared_ptr on this because it is used 00097 // in bbUnsafeAddBlackBox ! 00098 MakeBlackBoxPointer(this,true); 00099 00100 BlackBoxMapType::const_iterator i; 00101 for ( i = from.mBlackBoxMap.begin(); i != from.mBlackBoxMap.end(); ++i ) 00102 { 00103 bbtkBlackBoxDebugMessage("object",5," * Cloning \""<<i->first<<"\""<<std::endl); 00104 BlackBox::Pointer B = i->second->bbClone(i->second->bbGetName()); 00105 bbUnsafeAddBlackBox(B); 00106 } 00107 00108 bbtkBlackBoxDebugMessage("object",4," * Cloning Connections"<<std::endl); 00109 ConnectionListType::const_iterator j; 00110 for ( j = from.mConnectionList.begin(); j != from.mConnectionList.end(); ++j ) 00111 { 00112 bbtkBlackBoxDebugMessage("object",5," * Cloning \""<< 00113 (*j)->GetFullName()<<"\""<<std::endl); 00114 00115 BlackBox::Pointer bbfrom = bbGetBlackBox( (*j)->GetOriginalBlackBoxFrom()->bbGetName() ); 00116 BlackBox::Pointer bbto = bbGetBlackBox( (*j)->GetOriginalBlackBoxTo()->bbGetName() ); 00117 00118 Connection::Pointer c = mDescriptor.lock()->GetFactory()-> 00119 NewConnection( bbfrom, 00120 (*j)->GetOriginalBlackBoxFromOutput(), 00121 bbto, 00122 (*j)->GetOriginalBlackBoxToInput() ); 00123 00124 //c->Check(); 00125 bbAddConnection(c); 00126 00127 } 00128 00129 bbAllocateConnectors(); 00130 bbtkBlackBoxDebugMessage("object",3, 00131 "<## ComplexBlackBox(\"" 00132 <<from.bbGetName()<<"\",\"" 00133 <<name<<"\")"<<std::endl); 00134 }
void bbtk::ComplexBlackBox::bbAddBlackBox | ( | BlackBox::Pointer | b | ) | [protected] |
Adds the black box to the complex box.
Definition at line 475 of file bbtkComplexBlackBox.cxx.
References bbtkBlackBoxDebugMessage, bbtkError, bbUnsafeGetBlackBox(), and mBlackBoxMap.
00476 { 00477 bbtkBlackBoxDebugMessage("kernel",7, 00478 "ComplexBlackBox::AddBlackBox(\""<<b->bbGetName() 00479 <<"\")" 00480 <<std::endl); 00481 00482 if ( bbUnsafeGetBlackBox(b->bbGetName()) ) 00483 { 00484 bbtkError("a black box called \""<<b->bbGetName() 00485 <<"\" already exists"); 00486 } 00487 b->bbSetParent(GetThisPointer<ComplexBlackBox>()); 00488 mBlackBoxMap[b->bbGetName()] = b; 00489 00490 }
void bbtk::ComplexBlackBox::bbAddConnection | ( | Connection::Pointer | c | ) | [protected] |
Adds the connection to the complex box.
Definition at line 549 of file bbtkComplexBlackBox.cxx.
References bbtkBlackBoxDebugMessage, and mConnectionList.
Referenced by ComplexBlackBox().
00550 { 00551 bbtkBlackBoxDebugMessage("kernel",7, 00552 "ComplexBlackBox::AddConnection(\""<<"..."<<"\")" 00553 <<std::endl); 00554 00555 mConnectionList.push_back(c); 00556 00557 }
void bbtk::BlackBox::bbAddOutputObserver | ( | const std::string & | output_name, | |
OutputChangeCallbackType | f | |||
) | [inherited] |
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 bbtk::BlackBox::bbGetOutputConnector().
00411 { 00412 bbGetOutputConnector(output).AddChangeObserver(f); 00413 }
void bbtk::ComplexBlackBox::bbAddToExecutionList | ( | const std::string & | name | ) | [protected] |
Definition at line 306 of file bbtkComplexBlackBox.cxx.
References bbtkBlackBoxDebugMessage, and mExecutionList.
00307 { 00308 bbtkBlackBoxDebugMessage("kernel",9, 00309 "ComplexBlackBox::bbAddToExecutionList(\"" 00310 <<name<<"\")" 00311 <<std::endl); 00312 00313 mExecutionList.push_back( name ); 00314 00315 00316 }
void bbtk::ComplexBlackBox::bbAllocateConnectors | ( | ) | [protected, virtual] |
Allocates the i/o connectors of the black box.
Reimplemented from bbtk::BlackBox.
Definition at line 178 of file bbtkComplexBlackBox.cxx.
References bbGetDescriptor(), bbtk::BlackBox::bbGetInputConnectorMap(), bbtk::BlackBox::bbGetOutputConnectorMap(), bbtkBlackBoxDebugMessage, bbUnsafeGetBlackBox(), bbtk::ComplexBlackBoxInputDescriptor::GetInput(), bbtk::ComplexBlackBoxOutputDescriptor::GetOutput(), bbtk::ComplexBlackBoxOutputDescriptor::GetTarget(), bbtk::ComplexBlackBoxInputDescriptor::GetTarget(), and bbtk::i.
Referenced by ComplexBlackBox().
00179 { 00180 bbtkBlackBoxDebugMessage("kernel",8, 00181 "==> ComplexBlackBox::bbAllocateConnectors()" 00182 <<std::endl); 00183 00184 // Input connectors 00185 const BlackBoxDescriptor::InputDescriptorMapType& imap 00186 = bbGetDescriptor()->GetInputDescriptorMap(); 00187 BlackBoxDescriptor::InputDescriptorMapType::const_iterator i; 00188 for ( i = imap.begin(); i != imap.end(); ++i ) 00189 { 00190 bbtkBlackBoxDebugMessage("kernel",8,"* Allocate \""<<i->first<<"\""<<std::endl); 00191 // Redirect the connector to the internal box connector 00192 // Cast the BBInputDescriptor into a ComplexBBInputDescriptor 00193 ComplexBlackBoxInputDescriptor* d = 00194 (ComplexBlackBoxInputDescriptor*)i->second; 00195 // Get the internal box connector 00196 BlackBoxInputConnector* c = 00197 bbUnsafeGetBlackBox ( d->GetTarget() ) 00198 ->bbGetInputConnectorMap()[ d->GetInput() ]; 00199 00200 bbGetInputConnectorMap()[i->second->GetName()] = c; 00201 } 00202 00203 // Output connectors 00204 const BlackBoxDescriptor::OutputDescriptorMapType& omap 00205 = bbGetDescriptor()->GetOutputDescriptorMap(); 00206 BlackBoxDescriptor::OutputDescriptorMapType::const_iterator o; 00207 for ( o = omap.begin(); o != omap.end(); ++o ) 00208 { 00209 bbtkBlackBoxDebugMessage("kernel",8,"* Allocate \""<<o->first<<"\""<<std::endl); 00210 // Redirect the connector to the internal box connector 00211 // Cast the BBOutputDescriptor into a ComplexBBOutputDescriptor 00212 ComplexBlackBoxOutputDescriptor* d = 00213 (ComplexBlackBoxOutputDescriptor*)o->second; 00214 // Get the internal box connector 00215 BlackBoxOutputConnector* c = 00216 bbUnsafeGetBlackBox ( d->GetTarget() ) 00217 ->bbGetOutputConnectorMap()[ d->GetOutput() ]; 00218 00219 bbGetOutputConnectorMap()[o->second->GetName()] = c; 00220 } 00221 bbtkBlackBoxDebugMessage("kernel",8, 00222 "<== ComplexBlackBox::bbAllocateConnectors()" 00223 <<std::endl); 00224 }
bool bbtk::BlackBox::bbBoxProcessModeIsAlways | ( | ) | const [virtual, inherited] |
Returns true iff the input 'BoxProcessMode' is set to 'Always' (or a synonym).
Definition at line 399 of file bbtkBlackBox.cxx.
References bbtk::BlackBox::bbAlways, and bbtk::BlackBox::bbGetBoxProcessModeValue().
Referenced by bbtk::BlackBox::bbComputePostProcessStatus(), and bbtk::BlackBox::bbRecursiveExecute().
00400 { 00401 return (bbGetBoxProcessModeValue() == bbAlways); 00402 }
bool bbtk::BlackBox::bbBoxProcessModeIsReactive | ( | ) | const [virtual, inherited] |
Returns true iff the input 'BoxProcessMode' is set to 'Reactive' (or a synonym).
Definition at line 392 of file bbtkBlackBox.cxx.
References bbtk::BlackBox::bbGetBoxProcessModeValue(), and bbtk::BlackBox::bbReactive.
Referenced by bbtk::BlackBox::bbSetStatusAndPropagate().
00393 { 00394 return (bbGetBoxProcessModeValue() == bbReactive); 00395 }
void bbtk::ComplexBlackBox::bbBruteForceSetInputPointer | ( | const std::string & | name, | |
void * | data, | |||
bool | setModified = true | |||
) | [virtual] |
Sets the data of the input called <name>.
Implements bbtk::BlackBox.
Definition at line 392 of file bbtkComplexBlackBox.cxx.
References bbGetBlackBox(), bbGetDescriptor(), bbtkBlackBoxDebugMessage, bbtk::ComplexBlackBoxInputDescriptor::GetInput(), and bbtk::ComplexBlackBoxInputDescriptor::GetTarget().
00395 { 00396 bbtkBlackBoxDebugMessage("data",7, 00397 "ComplexBlackBox::bbBruteForceSetInputPointer('" 00398 <<name<<"',"<<data<<")" 00399 <<std::endl); 00400 00401 ComplexBlackBoxInputDescriptor* d = (ComplexBlackBoxInputDescriptor*) 00402 bbGetDescriptor()->GetInputDescriptor(name); 00403 00404 bbGetBlackBox(d->GetTarget())->bbBruteForceSetInputPointer(d->GetInput(), 00405 data, 00406 setModified); 00407 00408 }
BlackBox::Pointer bbtk::ComplexBlackBox::bbClone | ( | const std::string & | name | ) | [virtual] |
Returns a pointer on a new instance with name <name>.
Returns a pointer on a clone of the box with name <name>
Implements bbtk::BlackBox.
Definition at line 252 of file bbtkComplexBlackBox.cxx.
References bbtkBlackBoxDebugMessage, ComplexBlackBox(), and bbtk::BlackBox::MakeBlackBoxPointer().
00253 { 00254 bbtkBlackBoxDebugMessage("kernel",9, 00255 "==> ComplexBlackBox::bbClone(\""<<name<<"\")" 00256 <<std::endl); 00257 00258 ComplexBlackBox* CBB = new ComplexBlackBox(*this,name); 00259 bbtkBlackBoxDebugMessage("kernel",9, 00260 "<== ComplexBlackBox::bbClone(\""<<name<<"\")" 00261 <<std::endl); 00262 return MakeBlackBoxPointer(CBB); 00263 }
void bbtk::BlackBox::bbComputePostProcessStatus | ( | ) | [protected, inherited] |
Computes the final IOStatus of inputs and outputs after processing.
Definition at line 779 of file bbtkBlackBox.cxx.
References bbtk::BlackBox::bbBoxProcessModeIsAlways(), bbtk::BlackBox::bbGetInputConnectorMap(), bbtk::BlackBox::bbGetOutputConnectorMap(), bbtkBlackBoxDebugMessage, bbtk::GetIOStatusString(), bbtk::i, bbtk::MODIFIED, bbtk::OUTOFDATE, and bbtk::UPTODATE.
Referenced by bbtk::BlackBox::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::ComplexBlackBox::bbConnectInput | ( | const std::string & | name, | |
Connection * | c | |||
) | [virtual] |
Connects the input <name> to the connection c.
Reimplemented from bbtk::BlackBox.
Definition at line 413 of file bbtkComplexBlackBox.cxx.
References bbGetBlackBox(), bbGetDescriptor(), bbtkBlackBoxDebugMessage, bbtk::Connection::GetFullName(), bbtk::Connection::SetBlackBoxTo(), and bbtk::Connection::SetBlackBoxToInput().
00414 { 00415 bbtkBlackBoxDebugMessage("connection",2, 00416 "==> ComplexBlackBox::bbConnectInput(\"" 00417 <<name<<"\","<<c->GetFullName()<<")" 00418 <<std::endl); 00419 00420 ComplexBlackBoxInputDescriptor* d = (ComplexBlackBoxInputDescriptor*) 00421 bbGetDescriptor()->GetInputDescriptor(name); 00422 00423 00424 BlackBox::Pointer t = bbGetBlackBox(d->GetTarget()); 00425 00426 bbtkBlackBoxDebugMessage("connection",2," - Target = "<<d->GetTarget()<<" = "<<t->bbGetFullName()<<std::endl); 00427 00428 c->SetBlackBoxTo(t); 00429 c->SetBlackBoxToInput(d->GetInput()); 00430 00431 bbtkBlackBoxDebugMessage("connection",2," - New conn = "<<c->GetFullName()<<std::endl); 00432 t->bbConnectInput(d->GetInput(),c); 00433 00434 bbtkBlackBoxDebugMessage("connection",2, 00435 "<== ComplexBlackBox::bbConnectInput(\"" 00436 <<name<<"\","<<c->GetFullName()<<")" 00437 <<std::endl); 00438 }
void bbtk::ComplexBlackBox::bbConnectOutput | ( | const std::string & | name, | |
Connection * | c | |||
) | [virtual] |
Connects the output <name> to the connection c.
Reimplemented from bbtk::BlackBox.
Definition at line 444 of file bbtkComplexBlackBox.cxx.
References bbGetBlackBox(), bbGetDescriptor(), bbtkBlackBoxDebugMessage, bbtk::Connection::GetFullName(), bbtk::Connection::SetBlackBoxFrom(), and bbtk::Connection::SetBlackBoxFromOutput().
00445 { 00446 bbtkBlackBoxDebugMessage("connection",2, 00447 "==> ComplexBlackBox::bbConnectOutput(\"" 00448 <<name<<"\","<<c->GetFullName()<<")" 00449 <<std::endl); 00450 00451 ComplexBlackBoxOutputDescriptor* d = (ComplexBlackBoxOutputDescriptor*) 00452 bbGetDescriptor()->GetOutputDescriptor(name); 00453 00454 BlackBox::Pointer t = bbGetBlackBox(d->GetTarget()); 00455 00456 bbtkBlackBoxDebugMessage("connection",2," - Target = "<<d->GetTarget()<<" = "<<t->bbGetFullName()<<std::endl); 00457 00458 c->SetBlackBoxFrom(t); 00459 c->SetBlackBoxFromOutput(d->GetOutput()); 00460 00461 bbtkBlackBoxDebugMessage("connection",2," - New conn = "<<c->GetFullName()<<std::endl); 00462 00463 t->bbConnectOutput(d->GetOutput(),c); 00464 00465 bbtkBlackBoxDebugMessage("connection",2, 00466 "<== ComplexBlackBox::bbConnectOutput(\"" 00467 <<name<<"\","<<c->GetFullName()<<")" 00468 <<std::endl); 00469 }
void bbtk::BlackBox::bbCopyIOValues | ( | BlackBox & | from | ) | [protected, virtual, inherited] |
Copies the values of the inputs/output from the BlackBox from.
Definition at line 314 of file bbtkBlackBox.cxx.
References bbtk::BlackBox::bbGetDescriptor(), bbtk::BlackBox::bbGetFullName(), bbtk::BlackBox::bbGetInput(), bbtk::BlackBox::bbGetOutput(), bbtk::BlackBox::bbSetInput(), bbtk::BlackBox::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, inherited] |
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 bbtk::BlackBox::bbRecursiveExecute().
virtual int bbtk::BlackBox::bbDelete | ( | ) | [inline, protected, virtual, inherited] |
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::ComplexBlackBox::bbDesallocateConnectors | ( | ) | [protected, virtual] |
Desallocates the i/o connectors of the black box.
Reimplemented from bbtk::BlackBox.
Definition at line 230 of file bbtkComplexBlackBox.cxx.
References bbtk::BlackBox::bbGetInputConnectorMap(), bbtk::BlackBox::bbGetOutputConnectorMap(), and bbtkBlackBoxDebugMessage.
Referenced by ~ComplexBlackBox().
00231 { 00232 bbtkBlackBoxDebugMessage("kernel",8, 00233 "==> ComplexBlackBox::DesallocateConnectors()" 00234 <<std::endl); 00235 00236 // The connectors have not been allocated by the complex box 00237 // but by the internal boxes. Hence **DO NOT** desallocate ! 00238 // just clear the maps to avoid that 00239 // BlackBox::bbDesallocateConnectors delete the connectors 00240 bbGetInputConnectorMap().clear(); 00241 bbGetOutputConnectorMap().clear(); 00242 00243 bbtkBlackBoxDebugMessage("kernel",8, 00244 "<== ComplexBlackBox::DesallocateConnectors()" 00245 <<std::endl); 00246 00247 00248 }
void bbtk::ComplexBlackBox::bbExecute | ( | bool | force = false |
) | [virtual] |
Main processing method of the box. Executes the box so that its outputs are up-to-date on exit
Reimplemented from bbtk::BlackBox.
Definition at line 269 of file bbtkComplexBlackBox.cxx.
References bbtkBlackBoxDebugMessage, bbtk::i, mBlackBoxMap, and mExecutionList.
00270 { 00271 bbtkBlackBoxDebugMessage("process",2, 00272 "**> ComplexBlackBox::bbExecute()" 00273 <<std::endl); 00274 00275 00276 Wx::BusyCursor wait; 00277 00278 if (mExecutionList.size() != 0) 00279 { 00280 00281 std::vector<std::string>::const_iterator i; 00282 for (i=mExecutionList.begin(); 00283 i!=mExecutionList.end(); 00284 ++i) 00285 { 00286 bbtkBlackBoxDebugMessage("process",3," -> Executing '"<<*i<<"'"<<std::endl); 00287 mBlackBoxMap[*i]->bbExecute(force); 00288 } 00289 } 00290 else 00291 { 00292 std::map<std::string, BlackBox::Pointer>::iterator i; 00293 for (i=mBlackBoxMap.begin(); i!=mBlackBoxMap.end(); ++i) 00294 { 00295 i->second->bbExecute(force); 00296 } 00297 } 00298 bbtkBlackBoxDebugMessage("process",2, 00299 "<** ComplexBlackBox::bbExecute()" 00300 <<std::endl); 00301 00302 }
void bbtk::BlackBox::bbFinalizeProcessing | ( | ) | [protected, inherited] |
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 bbtk::BlackBox::bbmInitialized, bbtk::BlackBox::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 }
BlackBox::Pointer bbtk::ComplexBlackBox::bbFindBlackBox | ( | const std::string & | blackboxname | ) | [virtual] |
Reimplemented from bbtk::BlackBox.
Definition at line 632 of file bbtkComplexBlackBox.cxx.
References bbtk::i, and mBlackBoxMap.
00633 { 00634 BlackBox::Pointer blackbox; 00635 std::string subname=""; 00636 std::string restname=""; 00637 std::string delimiters(">"); 00638 // Skip delimiters at beginning. 00639 std::string::size_type lastPos = blackboxname.find_first_not_of(delimiters, 0); 00640 // Find first "non-delimiter". 00641 std::string::size_type pos = blackboxname.find_first_of(delimiters, lastPos); 00642 00643 // Found a token, add it to the vector. 00644 subname = blackboxname.substr(lastPos, pos - lastPos); 00645 restname = blackboxname.substr(lastPos+pos - lastPos+1, 999); 00646 00647 if (restname==subname) 00648 { 00649 restname=""; 00650 } 00651 00652 BlackBoxMapType::iterator i = mBlackBoxMap.find(subname); 00653 if ( i != mBlackBoxMap.end() ) 00654 { 00655 blackbox = i->second; 00656 if (restname!="") 00657 { 00658 blackbox = blackbox->bbFindBlackBox(restname); 00659 } 00660 } 00661 return blackbox; 00662 }
BlackBox::Pointer bbtk::ComplexBlackBox::bbGetBlackBox | ( | const std::string & | name | ) |
Returns the black box with name <name>.
Definition at line 563 of file bbtkComplexBlackBox.cxx.
References bbtkBlackBoxDebugMessage, bbtkError, bbtk::i, and mBlackBoxMap.
Referenced by bbBruteForceSetInputPointer(), bbConnectInput(), bbConnectOutput(), bbGetInput(), bbGetOutput(), bbSetInput(), bbSetOutput(), bbWriteDotFileBlackBox(), and ComplexBlackBox().
00564 { 00565 bbtkBlackBoxDebugMessage("kernel",9, 00566 "ComplexBlackBox::GetBlackBox(\""<<name<<"\")" 00567 <<std::endl); 00568 00569 BlackBoxMapType::iterator i = mBlackBoxMap.find(name); 00570 if ( i == mBlackBoxMap.end() ) 00571 { 00572 bbtkError("the black box \""<<name<<"\" does not exist"); 00573 } 00574 00575 return i->second; 00576 }
const BlackBoxMapType& bbtk::ComplexBlackBox::bbGetBlackBoxMap | ( | ) | [inline] |
BlackBox::BoxProcessModeValue bbtk::BlackBox::bbGetBoxProcessModeValue | ( | ) | const [inherited] |
Returns the "decoded" value of the input "BoxProcessMode".
Definition at line 363 of file bbtkBlackBox.cxx.
References bbtk::BlackBox::bbAlways, bbtk::BlackBox::bbGetFullName(), bbtk::BlackBox::bbmBoxProcessMode, bbtk::BlackBox::bbPipeline, bbtk::BlackBox::bbReactive, and bbtkError.
Referenced by bbtk::BlackBox::bbBoxProcessModeIsAlways(), and bbtk::BlackBox::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 }
BlackBoxDescriptor::Pointer bbtk::ComplexBlackBox::bbGetDescriptor | ( | ) | const [inline, virtual] |
Returns the pointer on the box' descriptor.
Implements bbtk::BlackBox.
Definition at line 68 of file bbtkComplexBlackBox.h.
Referenced by bbAllocateConnectors(), bbBruteForceSetInputPointer(), bbConnectInput(), bbConnectOutput(), bbGetInput(), bbGetNameWithParent(), bbGetOutput(), bbSetInput(), bbSetOutput(), and bbWriteDotFileBlackBox().
00068 { return mDescriptor.lock(); }
std::string bbtk::BlackBox::bbGetFullName | ( | ) | const [virtual, inherited] |
Returns the full name of the BlackBox (instance+type).
Definition at line 169 of file bbtkBlackBox.cxx.
References bbtk::BlackBox::bbGetDescriptor(), and bbtk::BlackBox::bbGetNameWithParent().
Referenced by bbtk::AtomicBlackBox::AtomicBlackBox(), bbtk::BlackBox::bbCopyIOValues(), bbtk::BlackBox::bbGetBoxProcessModeValue(), bbtk::BlackBox::bbSignalOutputModification(), bbtk::BlackBox::BlackBox(), and Check().
00170 { 00171 return this->bbGetNameWithParent()+"<"+this->bbGetDescriptor()->GetTypeName()+">"; 00172 }
void bbtk::BlackBox::bbGetHelp | ( | bool | full = true |
) | const [virtual, inherited] |
Prints the Help on the BlackBox type.
Definition at line 192 of file bbtkBlackBox.cxx.
References bbtk::BlackBox::bbGetDescriptor().
00193 { 00194 bbGetDescriptor()->GetHelp(full); 00195 }
Data bbtk::ComplexBlackBox::bbGetInput | ( | const std::string & | label | ) | [virtual] |
Gets the input Data of a given name.
Implements bbtk::BlackBox.
Definition at line 339 of file bbtkComplexBlackBox.cxx.
References bbGetBlackBox(), bbGetDescriptor(), bbtkBlackBoxDebugMessage, bbtk::ComplexBlackBoxInputDescriptor::GetInput(), and bbtk::ComplexBlackBoxInputDescriptor::GetTarget().
00340 { 00341 bbtkBlackBoxDebugMessage("data",7, 00342 "ComplexBlackBox::bbGetInput(\""<<name<<"\")" 00343 <<std::endl); 00344 00345 ComplexBlackBoxInputDescriptor* d = 00346 (ComplexBlackBoxInputDescriptor*) 00347 bbGetDescriptor()->GetInputDescriptor(name); 00348 00349 Data p = bbGetBlackBox(d->GetTarget())->bbGetInput(d->GetInput()); 00350 00351 return p; 00352 }
std::string bbtk::BlackBox::bbGetInputAsString | ( | const std::string & | input | ) | [inherited] |
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 bbtk::BlackBox::bbGetDescriptor(), bbtk::BlackBox::bbGetInput(), and bbtk::BlackBox::bbGetInputType().
Referenced by bbtk::BlackBox::bbPrintHelp(), bbWriteDotFileBlackBox(), and bbtk::BlackBox::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, inherited] |
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, inherited] |
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, inherited] |
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, inherited] |
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, inherited] |
Returns the input connectors map (const).
Definition at line 192 of file bbtkBlackBox.h.
00193 { return mInputConnectorMap; }
InputConnectorMapType& bbtk::BlackBox::bbGetInputConnectorMap | ( | ) | [inline, inherited] |
Returns the input connectors map.
Definition at line 189 of file bbtkBlackBox.h.
Referenced by bbAllocateConnectors(), bbtk::BlackBox::bbAllocateConnectors(), bbtk::AtomicBlackBox::bbBruteForceSetInputPointer(), bbtk::BlackBox::bbComputePostProcessStatus(), bbtk::BlackBox::bbConnectInput(), bbDesallocateConnectors(), bbtk::BlackBox::bbDesallocateConnectors(), bbtk::BlackBox::bbDisconnectInput(), bbtk::AtomicBlackBox::bbSetInput(), bbtk::BlackBox::bbSetStatusAndPropagate(), bbtk::BlackBox::bbUpdateInputs(), and bbWriteDotFileBlackBox().
00190 { return mInputConnectorMap; }
IOStatus bbtk::BlackBox::bbGetInputStatus | ( | const std::string & | name | ) | const [inline, inherited] |
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, inherited] |
Gets the input type of a given label.
Definition at line 242 of file bbtkBlackBox.cxx.
References bbtk::BlackBox::bbGetDescriptor(), bbtkBlackBoxDebugMessage, and bbtkDebugDecTab.
Referenced by bbtk::BlackBox::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, inherited] |
Returns the name of the BlackBox (instance).
Definition at line 131 of file bbtkBlackBox.h.
Referenced by bbGetNameWithParent(), bbInsertHTMLGraph(), bbtk::BlackBox::bbPrintHelp(), bbtk::WidgetBlackBox< W >::bbUserSetDefaultValues(), bbWriteDotFileBlackBox(), bbtk::BlackBox::bbWriteDotFileBlackBox(), and ComplexBlackBox().
00131 { return bbmName; }
std::string bbtk::ComplexBlackBox::bbGetNameWithParent | ( | ) | const [virtual] |
Returns the name with the name of the parent prepended if any.
Reimplemented from bbtk::BlackBox.
Definition at line 1049 of file bbtkComplexBlackBox.cxx.
References bbGetDescriptor(), bbtk::BlackBox::bbGetName(), and IsAPrototype().
Referenced by GetObjectName().
01050 { 01051 if (!IsAPrototype()) return BlackBox::bbGetNameWithParent(); 01052 if (bbGetDescriptor()) 01053 { 01054 return bbGetDescriptor()->GetFullTypeName() + ":" + bbGetName(); 01055 } 01056 else 01057 { 01058 return std::string(":") + bbGetName(); 01059 } 01060 }
Data bbtk::ComplexBlackBox::bbGetOutput | ( | const std::string & | name | ) | [virtual] |
Gets the data of the output called <name>.
Implements bbtk::BlackBox.
Definition at line 321 of file bbtkComplexBlackBox.cxx.
References bbGetBlackBox(), bbGetDescriptor(), bbtkBlackBoxDebugMessage, bbtk::ComplexBlackBoxOutputDescriptor::GetOutput(), and bbtk::ComplexBlackBoxOutputDescriptor::GetTarget().
00322 { 00323 bbtkBlackBoxDebugMessage("data",7, 00324 "ComplexBlackBox::bbGetOutput(\""<<name<<"\")" 00325 <<std::endl); 00326 00327 ComplexBlackBoxOutputDescriptor* d = 00328 (ComplexBlackBoxOutputDescriptor*) 00329 bbGetDescriptor()->GetOutputDescriptor(name); 00330 00331 Data p = bbGetBlackBox(d->GetTarget())->bbGetOutput(d->GetOutput()); 00332 00333 return p; 00334 }
std::string bbtk::BlackBox::bbGetOutputAsString | ( | const std::string & | output | ) | [inherited] |
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 bbtk::BlackBox::bbGetDescriptor(), bbtk::BlackBox::bbGetOutput(), and bbtk::BlackBox::bbGetOutputType().
Referenced by bbtk::BlackBox::bbPrintHelp(), bbWriteDotFileBlackBox(), and bbtk::BlackBox::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, inherited] |
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, inherited] |
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, inherited] |
Returns the output connector.
Definition at line 209 of file bbtkBlackBox.h.
Referenced by bbtk::BlackBox::bbAddOutputObserver().
00210 { return *(mOutputConnectorMap.find(n)->second); }
const OutputConnectorMapType& bbtk::BlackBox::bbGetOutputConnectorMap | ( | ) | const [inline, inherited] |
Returns the output connectors map (const).
Definition at line 206 of file bbtkBlackBox.h.
00207 { return mOutputConnectorMap; }
OutputConnectorMapType& bbtk::BlackBox::bbGetOutputConnectorMap | ( | ) | [inline, inherited] |
Returns the output connectors map.
Definition at line 203 of file bbtkBlackBox.h.
Referenced by bbAllocateConnectors(), bbtk::BlackBox::bbAllocateConnectors(), bbtk::BlackBox::bbComputePostProcessStatus(), bbtk::BlackBox::bbConnectOutput(), bbDesallocateConnectors(), bbtk::BlackBox::bbDesallocateConnectors(), bbtk::BlackBox::bbDisconnectOutput(), bbtk::WidgetBlackBox< W >::bbIsOutputWidgetConnected(), bbtk::BlackBox::bbRecursiveExecute(), bbtk::BlackBox::bbSetStatusAndPropagate(), and bbtk::BlackBox::bbSignalOutputModification().
00204 { return mOutputConnectorMap; }
TypeInfo bbtk::BlackBox::bbGetOutputType | ( | const std::string & | label | ) | const [virtual, inherited] |
Gets the output type of a given label.
Definition at line 229 of file bbtkBlackBox.cxx.
References bbtk::BlackBox::bbGetDescriptor(), bbtkBlackBoxDebugMessage, and bbtkDebugDecTab.
Referenced by bbtk::BlackBox::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, inherited] |
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, inherited] |
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(), bbInsertHTMLGraph(), bbtk::WidgetBlackBox< wxWindow >::bbUserCreateWidget(), bbWriteDotFileBlackBox(), bbtk::BlackBox::bbWriteDotFileBlackBox(), bbWriteDotInputOutputName(), and bbtk::BlackBox::bbWriteDotInputOutputName().
00127 { return bbGetDescriptor()->GetTypeName(); }
void bbtk::BlackBox::bbGlobalAddToExecutionList | ( | BlackBox::Pointer | b | ) | [static, inherited] |
Definition at line 1429 of file bbtkBlackBox.cxx.
References bbtk::bbmgExecutionList, bbtk::bbmgGlobalProcessingExecutionList, and bbtkDebugMessage.
Referenced by bbtk::BlackBox::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, inherited] |
Definition at line 1424 of file bbtkBlackBox.cxx.
References bbtk::bbmgFreezeExecution.
Referenced by bbtk::BlackBox::bbExecute().
01425 { 01426 return bbmgFreezeExecution; 01427 }
bool bbtk::BlackBox::bbGlobalGetSomeBoxExecuting | ( | ) | [static, inherited] |
Definition at line 1409 of file bbtkBlackBox.cxx.
References bbtk::bbmgSomeBoxExecuting.
Referenced by bbtk::BlackBox::bbCanReact(), and bbtk::BlackBox::bbRecursiveExecute().
01410 { 01411 return bbmgSomeBoxExecuting; 01412 }
void bbtk::BlackBox::bbGlobalProcessExecutionList | ( | ) | [static, inherited] |
Definition at line 1368 of file bbtkBlackBox.cxx.
References bbtk::bbmgExecutionList, bbtk::bbmgGlobalProcessingExecutionList, bbtkDebugMessage, bbtkGlobalError, and bbtk::i.
Referenced by bbtk::BlackBox::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, inherited] |
Definition at line 1419 of file bbtkBlackBox.cxx.
References bbtk::bbmgFreezeExecution.
01420 { 01421 bbmgFreezeExecution = b; 01422 }
void bbtk::BlackBox::bbGlobalSetSomeBoxExecuting | ( | bool | b | ) | [static, inherited] |
Definition at line 1414 of file bbtkBlackBox.cxx.
References bbtk::bbmgSomeBoxExecuting.
Referenced by bbtk::BlackBox::bbRecursiveExecute().
01415 { 01416 bbmgSomeBoxExecuting = b; 01417 }
bool bbtk::BlackBox::bbHasInput | ( | const std::string & | label | ) | const [virtual, inherited] |
Returns true iff the BlackBox has an input of name label.
Definition at line 200 of file bbtkBlackBox.cxx.
References bbtk::BlackBox::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, inherited] |
Returns true iff the BlackBox has an output of name label.
Definition at line 215 of file bbtkBlackBox.cxx.
References bbtk::BlackBox::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, inherited] |
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 bbtk::BlackBox::bbmInitialized, bbtk::BlackBox::bbRecursiveInitializeProcessing(), and bbtkBlackBoxDebugMessage.
Referenced by bbtk::BlackBox::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::ComplexBlackBox::bbInsertHTMLGraph | ( | std::ofstream & | s, | |
int | detail, | |||
int | level, | |||
bool | instanceOrtype, | |||
const std::string & | output_dir, | |||
bool | relative_link | |||
) |
Generates a png image representing the pipeline graph of the complex box and writes html code to insert it into the output file stream. detail : level : depth of nested complex boxes graph development (0:only this box level output_dir is the directory in which to write the files
Reimplemented from bbtk::BlackBox.
Definition at line 666 of file bbtkComplexBlackBox.cxx.
References bbtk::BlackBox::bbGetName(), bbtk::BlackBox::bbGetTypeName(), bbWriteDotFileBlackBox(), bbtk::ConfigurationFile::Get_default_temp_dir(), and bbtk::ConfigurationFile::GetInstance().
00672 { 00673 std::string directory(output_dir); 00674 00675 if (output_dir.length() == 0) 00676 { 00677 // Don't pollute the file store with "temp_dir" directories ... 00678 std::string default_temp_dir = ConfigurationFile::GetInstance().Get_default_temp_dir(); 00679 directory = default_temp_dir + "/" + "temp_dir"; 00680 } 00681 00682 std::string simplefilename (this->bbGetTypeName()+"_"+this->bbGetName()); 00683 std::string simplefilename_png (simplefilename+".png"); 00684 std::string filename (directory+"/"+simplefilename); 00685 std::string filename_png (filename+".png"); 00686 std::string filename_cmap (filename+".cmap"); 00687 std::string filename_dot (filename+".dot"); 00688 00689 std::string filename_png2 ("\"" + filename_png + "\""); 00690 std::string filename_cmap2 ("\"" + filename_cmap + "\""); 00691 std::string filename_dot2 ("\"" + filename_dot + "\""); 00692 00693 00694 #ifdef WIN32 00695 std::string currentexecpath("\"\"" + crea::System::GetDllAppPath("bbtk") +"\\dot_embedded\\dot\""); 00696 std::string command1 (currentexecpath + " -Tpng -o " + filename_png2 + " " + filename_dot2 + "\""); 00697 std::string command1a(currentexecpath + " -T cmap -o " + filename_cmap2 + " " + filename_dot2 + "\""); 00698 #else 00699 #ifdef APPLE 00700 std::string command1 ("dot -Tpng:quartz -o " + filename_png2 + " " + filename_dot2 ); 00701 std::string command1a("dot -T cmap -o " + filename_cmap2 + " " + filename_dot2 ); 00702 #else 00703 std::string command1 ("dot -Tpng:cairo -o " + filename_png2 + " " + filename_dot2 ); 00704 std::string command1a("dot -T cmap -o " + filename_cmap2 + " " + filename_dot2 ); 00705 #endif 00706 #endif 00707 00708 00709 00710 00711 // 1. Generating .dot file 00712 FILE *ff; 00713 ff = fopen(filename_dot.c_str(),"w"); 00714 fprintf(ff,"digraph bbtk_graph{\n"); 00715 fprintf(ff,"rankdir=LR%s\n",";"); 00716 fprintf(ff,"node [shape=record]%s\n",";"); 00717 00718 this->bbWriteDotFileBlackBox(ff, 00719 GetThisPointer<ComplexBlackBox>(), 00720 detail,level, 00721 instanceOrtype, 00722 relative_link ); 00723 00724 fprintf(ff,"}\n"); 00725 fclose(ff); 00726 00727 std::cout<<"JCP bbtkComplexBlackBox.cxx execute1="<<command1<<std::endl; 00728 // 2. Executing .dot file -> png 00729 system( command1.c_str() ); 00730 // 3. Executing .dot file -> cmap 00731 std::cout<<"JCP bbtkComplexBlackBox.cxx execute2="<<command1a<<std::endl; 00732 system( command1a.c_str() ); 00733 00734 // 4. HTML code insertion 00735 // 4.1 image 00736 (s) << "<center><img src=\"" << simplefilename_png 00737 << "\" border=\"0\" usemap=\"#map_"<< simplefilename 00738 <<"\" alt=\"\"></center>\n"; 00739 00740 // 4.2 map 00741 (s) << "<map name=\"map_"<< simplefilename <<"\">\n"; 00742 FILE *ff2; 00743 char c; 00744 ff2=fopen(filename_cmap.c_str(),"r"); 00745 if (ff2!=NULL){ 00746 while (!feof(ff2)) 00747 { 00748 c=fgetc(ff2); 00749 if (c!=-1) 00750 { 00751 (s) << c; 00752 } // if 00753 } // while 00754 } // if ff2 00755 (s) << "</map>\n\n"; 00756 00757 // End 00758 }
virtual bool bbtk::BlackBox::bbIsShown | ( | ) | [inline, virtual, inherited] |
Reimplemented in bbtk::WidgetBlackBox< W >, bbtk::WidgetBlackBox< QWidget >, and bbtk::WidgetBlackBox< wxWindow >.
Definition at line 342 of file bbtkBlackBox.h.
void bbtk::ComplexBlackBox::bbPrintBlackBoxes | ( | ) |
Definition at line 600 of file bbtkComplexBlackBox.cxx.
References bbtkBlackBoxDebugMessage, bbtkMessage, bbtk::i, and mBlackBoxMap.
00601 { 00602 bbtkBlackBoxDebugMessage("kernel",9, 00603 "ComplexBlackBox::PrintBlackBoxes()" 00604 <<std::endl); 00605 00606 BlackBoxMapType::iterator i; 00607 for ( i = mBlackBoxMap.begin(); i != mBlackBoxMap.end(); ++i ) 00608 { 00609 bbtkMessage("help",1,i->second->bbGetFullName()<<std::endl); 00610 } 00611 00612 }
void bbtk::BlackBox::bbPrintHelp | ( | BlackBox::Pointer | parentblackbox, | |
int | detail, | |||
int | level | |||
) | [virtual, inherited] |
Definition at line 1207 of file bbtkBlackBox.cxx.
References bbtk::BlackBox::bbGetDescriptor(), bbtk::BlackBox::bbGetInputAsString(), bbtk::BlackBox::bbGetName(), bbtk::BlackBox::bbGetOutputAsString(), bbtkBlackBoxMessage, bbtk::GetIOStatusString(), bbtk::Connection::GetOriginalBlackBoxFrom(), bbtk::Connection::GetOriginalBlackBoxFromOutput(), bbtk::i, bbtk::BlackBox::mInputConnectorMap, and bbtk::BlackBox::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, inherited] |
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 bbtk::BlackBox::bbRecursiveExecute().
00475 { 00476 bbtkError("BlackBox::bbProcess called : how can this happen ?"); 00477 // this->bbUserProcess(); 00478 }
void bbtk::BlackBox::bbRecursiveExecute | ( | Connection::Pointer | caller | ) | [protected, virtual, inherited] |
Recursive execution method
caller | : The connection which invoked the method; null if called by bbExecute |
Definition at line 659 of file bbtkBlackBox.cxx.
References bbtk::BlackBox::bbBoxProcessModeIsAlways(), bbtk::BlackBox::bbComputePostProcessStatus(), bbtk::BlackBox::bbCreateWindow(), bbtk::BlackBox::bbGetExecuting(), bbtk::BlackBox::bbGetOutputConnectorMap(), bbtk::BlackBox::bbGlobalGetSomeBoxExecuting(), bbtk::BlackBox::bbGlobalSetSomeBoxExecuting(), bbtk::BlackBox::bbInitializeProcessing(), bbtk::BlackBox::bbProcess(), bbtk::BlackBox::bbSetExecuting(), bbtk::BlackBox::bbShowWindow(), bbtkBlackBoxDebugMessage, bbtkWarning, bbtk::BlackBox::bbUpdateInputs(), and bbtk::UPTODATE.
Referenced by bbtk::BlackBox::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, inherited] |
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 bbtk::BlackBox::bbFinalizeProcessing().
virtual void bbtk::BlackBox::bbRecursiveInitializeProcessing | ( | ) | [inline, protected, virtual, inherited] |
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 bbtk::BlackBox::bbInitializeProcessing().
void bbtk::ComplexBlackBox::bbRemoveBlackBox | ( | const std::string & | name, | |
bool | remove_connections = true | |||
) | [protected] |
Removes the black box from the complex box.
Definition at line 510 of file bbtkComplexBlackBox.cxx.
References bbtkBlackBoxDebugMessage, bbtkError, bbtk::i, mBlackBoxMap, mConnectionList, and bbtk::Package::UnLoadReleasedDynamicallyLoadedPackages().
00512 { 00513 bbtkBlackBoxDebugMessage("kernel",7, 00514 "ComplexBlackBox::RemoveBlackBox(\""<<name<<"\")" 00515 <<std::endl); 00516 00517 BlackBoxMapType::iterator i = mBlackBoxMap.find(name); 00518 if ( i == mBlackBoxMap.end() ) 00519 { 00520 bbtkError("the black box \""<<name<<"\" does not exist"); 00521 } 00522 BlackBox::WeakPointer p = i->second; 00523 00524 if (remove_connections) 00525 { 00526 ConnectionListType::const_iterator j; 00527 for ( j = mConnectionList.begin(); 00528 j != mConnectionList.end(); ++j ) 00529 { 00530 (*j)->Check(); 00531 } 00532 } 00533 if (p.use_count()!=1) 00534 { 00535 bbtkError("the black box \""<<name<<"\" is still connected"); 00536 } 00537 00538 mBlackBoxMap.erase(i); 00539 00540 00541 // Unload orphan dl packages 00542 Package::UnLoadReleasedDynamicallyLoadedPackages(); 00543 00544 }
void bbtk::BlackBox::bbRemoveOutputObserver | ( | const std::string & | output_name, | |
OutputChangeCallbackType | f | |||
) | [inherited] |
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::ComplexBlackBox::bbSetInput | ( | const std::string & | name, | |
Data | data, | |||
bool | setModified = true | |||
) | [virtual] |
Sets the data of the input called <name>.
Implements bbtk::BlackBox.
Definition at line 374 of file bbtkComplexBlackBox.cxx.
References bbGetBlackBox(), bbGetDescriptor(), bbtkBlackBoxDebugMessage, bbtk::ComplexBlackBoxInputDescriptor::GetInput(), and bbtk::ComplexBlackBoxInputDescriptor::GetTarget().
00376 { 00377 bbtkBlackBoxDebugMessage("data",7, 00378 "ComplexBlackBox::bbSetInput(\""<<name<<"\",data)" 00379 <<std::endl); 00380 00381 ComplexBlackBoxInputDescriptor* d = (ComplexBlackBoxInputDescriptor*) 00382 bbGetDescriptor()->GetInputDescriptor(name); 00383 00384 bbGetBlackBox(d->GetTarget())->bbSetInput(d->GetInput(),data,setModified); 00385 00386 }
void bbtk::BlackBox::bbSetInputBoxExecute | ( | Void | = 0 |
) | [inline, inherited] |
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, inherited] |
Sets the value of the input 'BoxProcessMode'.
Definition at line 294 of file bbtkBlackBox.h.
Referenced by bbtk::AtomicBlackBoxDescriptor::AtomicBlackBoxDescriptor().
00294 { bbmBoxProcessMode = a; }
void bbtk::ComplexBlackBox::bbSetOutput | ( | const std::string & | name, | |
Data | data | |||
) | [virtual] |
Sets the data of the output called <name>.
Implements bbtk::BlackBox.
Definition at line 357 of file bbtkComplexBlackBox.cxx.
References bbGetBlackBox(), bbGetDescriptor(), bbtkBlackBoxDebugMessage, bbtk::ComplexBlackBoxOutputDescriptor::GetOutput(), and bbtk::ComplexBlackBoxOutputDescriptor::GetTarget().
00358 { 00359 bbtkBlackBoxDebugMessage("data",7, 00360 "ComplexBlackBox::bbSetOutput(\""<<name<<"\",data)" 00361 <<std::endl); 00362 00363 ComplexBlackBoxOutputDescriptor* d = 00364 (ComplexBlackBoxOutputDescriptor*) 00365 bbGetDescriptor()->GetOutputDescriptor(name); 00366 00367 bbGetBlackBox(d->GetTarget())->bbSetOutput(d->GetOutput(),data); 00368 00369 }
void bbtk::BlackBox::bbSetOutputBoxChange | ( | Void | = 0 |
) | [inline, inherited] |
Sets the value of the output 'BoxChange'.
Definition at line 320 of file bbtkBlackBox.h.
Referenced by bbtk::AtomicBlackBoxDescriptor::AtomicBlackBoxDescriptor().
virtual void bbtk::BlackBox::bbSetShown | ( | bool | ) | [inline, virtual, inherited] |
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, inherited] |
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 bbtk::BlackBox::bbBoxProcessModeIsReactive(), bbtk::BlackBox::bbCanReact(), bbtk::BlackBox::bbGetInputConnectorMap(), bbtk::BlackBox::bbGetOutputConnectorMap(), bbtk::BlackBox::bbGlobalAddToExecutionList(), bbtkBlackBoxDebugMessage, bbtkError, bbtk::GetIOStatusString(), bbtk::OUTOFDATE, bbtk::BlackBoxInputConnector::SetStatus(), and bbtk::UPTODATE.
Referenced by bbtk::AtomicBlackBox::bbBruteForceSetInputPointer(), bbtk::BlackBox::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, inherited] |
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 bbtk::BlackBox::bbRecursiveExecute().
void bbtk::BlackBox::bbSignalOutputModification | ( | const std::vector< std::string > & | output_name, | |
bool | reaction = true | |||
) | [virtual, inherited] |
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 bbtk::BlackBox::bbGetFullName(), bbtk::BlackBox::bbGetOutputConnectorMap(), bbtk::BlackBox::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, inherited] |
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 bbtk::BlackBox::bbGetFullName(), bbtk::BlackBox::bbGetOutputConnectorMap(), bbtk::BlackBox::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, inherited] |
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 bbtk::BlackBox::bbGetOutputConnectorMap(), bbtk::BlackBox::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 }
void bbtk::ComplexBlackBox::bbUnsafeAddBlackBox | ( | BlackBox::Pointer | b | ) | [protected] |
Adds the black box to the complex box (unsafe).
Definition at line 495 of file bbtkComplexBlackBox.cxx.
References bbtkBlackBoxDebugMessage, and mBlackBoxMap.
Referenced by ComplexBlackBox().
00496 { 00497 bbtkBlackBoxDebugMessage("kernel",7, 00498 "ComplexBlackBox::UnsafeAddBlackBox(\""<<b->bbGetName() 00499 <<"\")" 00500 <<std::endl); 00501 00502 b->bbSetParent(GetThisPointer<ComplexBlackBox>()); 00503 mBlackBoxMap[b->bbGetName()] = b; 00504 00505 }
BlackBox::Pointer bbtk::ComplexBlackBox::bbUnsafeGetBlackBox | ( | const std::string & | name | ) | [protected] |
Returns the black box with name <name> : does not throw an exception if it does not exist but return a null pointer
Definition at line 582 of file bbtkComplexBlackBox.cxx.
References bbtkBlackBoxDebugMessage, bbtk::i, and mBlackBoxMap.
Referenced by bbAddBlackBox(), and bbAllocateConnectors().
00583 { 00584 bbtkBlackBoxDebugMessage("kernel",9, 00585 "ComplexBlackBox::UnsafeGetBlackBox(\""<<name<<"\")" 00586 <<std::endl); 00587 00588 BlackBoxMapType::iterator i = mBlackBoxMap.find(name); 00589 if ( i == mBlackBoxMap.end() ) 00590 { 00591 return BlackBox::Pointer(); 00592 } 00593 00594 return i->second; 00595 00596 }
IOStatus bbtk::BlackBox::bbUpdateInputs | ( | ) | [protected, inherited] |
Updates the BlackBox inputs Calls RecursiveExecute on all BlackBoxInputConnector
Definition at line 739 of file bbtkBlackBox.cxx.
References bbtk::BlackBox::bbGetInputConnectorMap(), bbtkBlackBoxDebugMessage, bbtk::GetIOStatusString(), bbtk::i, and bbtk::UPTODATE.
Referenced by bbtk::BlackBox::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, inherited] |
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, inherited] |
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, inherited] |
Definition at line 390 of file bbtkBlackBox.h.
Referenced by bbtk::WidgetBlackBox< W >::bbSetShown().
virtual void bbtk::BlackBox::bbUserSetDefaultValues | ( | ) | [inline, protected, virtual, inherited] |
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::ComplexBlackBox::bbWriteDotFileBlackBox | ( | FILE * | ff, | |
BlackBox::Pointer | parentblackbox, | |||
int | detail, | |||
int | level, | |||
bool | instanceOrtype, | |||
bool | relative_link | |||
) | [virtual] |
Write Graphviz-dot description in file.
Writes Graphviz-dot description in file. Generates own description and recursively calls itself on internal boxes with level-1
Reimplemented from bbtk::BlackBox.
Definition at line 764 of file bbtkComplexBlackBox.cxx.
References bbGetBlackBox(), bbGetDescriptor(), bbtk::BlackBox::bbGetInputAsString(), bbtk::BlackBox::bbGetInputConnectorMap(), bbtk::BlackBox::bbGetName(), bbtk::BlackBox::bbGetOutputAsString(), bbtk::BlackBox::bbGetTypeName(), bbWriteDotInputOutputName(), bbtk::ComplexBlackBoxInputDescriptor::GetInput(), bbtk::BlackBoxInputOutputDescriptor::GetName(), bbtk::Connection::GetOriginalBlackBoxFrom(), bbtk::Connection::GetOriginalBlackBoxFromOutput(), bbtk::Connection::GetOriginalBlackBoxTo(), bbtk::Connection::GetOriginalBlackBoxToInput(), bbtk::ComplexBlackBoxOutputDescriptor::GetOutput(), bbtk::ComplexBlackBoxOutputDescriptor::GetTarget(), bbtk::ComplexBlackBoxInputDescriptor::GetTarget(), bbtk::i, and mBlackBoxMap.
Referenced by bbInsertHTMLGraph().
00769 { 00770 std::string tmp1; 00771 std::string valueStr(""); 00772 Package::Pointer package = this->bbGetDescriptor()->GetPackage(); 00773 00774 if (package!=NULL) 00775 { 00776 if (relative_link) 00777 tmp1 = this->bbGetDescriptor()->GetPackage()->GetDocRelativeURL(); 00778 else 00779 tmp1 = this->bbGetDescriptor()->GetPackage()->GetDocURL(); 00780 } 00781 else 00782 { 00783 tmp1 = "Caspitas"; 00784 } 00785 00786 std::string tmp2=bbGetTypeName(); 00787 std::string url(tmp1 + "#" + tmp2 ); 00788 fprintf( ff , "subgraph cluster_%s_%p {\n",bbGetName().c_str(),this); 00789 00790 if (!( (bbGetTypeName()=="workspace") && (bbGetName()=="workspacePrototype")) ) 00791 { 00792 fprintf( ff , " URL = \"%s\" %s",url.c_str(),";"); 00793 } 00794 00795 std::string boxname="["+bbGetTypeName()+"]"; 00796 if (GetThisPointer<ComplexBlackBox>()!=parentblackbox) 00797 { 00798 if (detail==0) 00799 { 00800 boxname=bbGetName(); 00801 } 00802 else 00803 { 00804 boxname = bbGetName(); 00805 boxname = boxname + " [" +this->bbGetDescriptor()->GetPackage()->GetName()+"::"+ bbGetTypeName() + "]"; 00806 } 00807 00808 } 00809 fprintf( ff , " label = \"%s\"%s\n", boxname.c_str() ,";"); 00810 00811 00812 00813 // fprintf( ff , " style=filled%s\n",";"); 00814 // fprintf( ff , " color=grey%s\n",";"); 00815 fprintf( ff , " node [style=filled]%s\n",";"); 00816 fprintf( ff , " fillcolor=grey%s\n",";"); 00817 fprintf( ff , " edge [color=blue]%s\n",";"); 00818 00819 00820 // Labels Salida 00821 std::string labelStr1; 00822 std::string labelStr2; 00823 labelStr1 = boxname + "\\n(output)" ; 00824 labelStr2 = " | {{ "; 00825 bool tmp; 00826 tmp=false; 00827 OutputConnectorMapType::iterator i; 00828 00829 const BlackBoxDescriptor::OutputDescriptorMapType& omap = this->bbGetDescriptor()->GetOutputDescriptorMap(); 00830 BlackBoxDescriptor::OutputDescriptorMapType::const_iterator o; 00831 for ( o = omap.begin(); o != omap.end(); ++o ) 00832 { 00833 if (tmp==true) 00834 { 00835 labelStr2=labelStr2+" | "; 00836 } 00837 tmp=true; 00838 if (instanceOrtype==true) 00839 { 00840 valueStr = this->bbGetOutputAsString(o->second->GetName()/* 00841 ,factory*/) + " = "; 00842 } 00843 labelStr2=labelStr2+"<"+o->second->GetName().c_str()+"> " + valueStr + o->second->GetName().c_str(); 00844 } 00845 00846 labelStr2 = labelStr2+ " } }"; 00847 00848 00849 00850 if (detail==1) 00851 { 00852 labelStr1 = labelStr1 + labelStr2; 00853 } 00854 00855 if (tmp){ 00856 fprintf(ff," " ); 00857 bbWriteDotInputOutputName(ff,false,detail,level); 00858 fprintf( ff , " [shape=record, style=filled,fillcolor=grey,color=red,label=\"%s\"]%s\n",labelStr1.c_str(),";" ); 00859 } 00860 00861 00862 // label Entrada 00863 labelStr1 = boxname + "\\n(input)" ; 00864 labelStr2 = " | {{ "; 00865 tmp=false; 00866 InputConnectorMapType::iterator ii; 00867 00868 const BlackBoxDescriptor::InputDescriptorMapType& imap = this->bbGetDescriptor()->GetInputDescriptorMap(); 00869 BlackBoxDescriptor::InputDescriptorMapType::const_iterator iii; 00870 for ( iii = imap.begin(); iii != imap.end(); ++iii ) 00871 { 00872 if (tmp==true) 00873 { 00874 labelStr2=labelStr2+" | "; 00875 } 00876 tmp=true; 00877 if (instanceOrtype==true) 00878 { 00879 valueStr = this->bbGetInputAsString(iii->second->GetName()/*,factory*/) + " = "; 00880 } 00881 labelStr2=labelStr2+"<"+iii->second->GetName().c_str()+"> " + valueStr + iii->second->GetName().c_str(); 00882 } 00883 00884 00885 labelStr2 = labelStr2+ " } }"; 00886 if (detail==1) 00887 { 00888 labelStr1 = labelStr1 + labelStr2; 00889 } 00890 if (tmp){ 00891 fprintf(ff," " ); 00892 bbWriteDotInputOutputName(ff,true,detail,level); 00893 fprintf( ff , " [shape=record, style=filled,fillcolor=grey,color=red,label=\"%s\"]%s\n",labelStr1.c_str(),";" ); 00894 } 00895 00896 00897 // Body 00898 BlackBoxMapType::iterator j; 00899 for ( j = mBlackBoxMap.begin(); j != mBlackBoxMap.end(); ++j ) 00900 { 00901 if (level>-1) 00902 { 00903 j->second->bbWriteDotFileBlackBox(ff, 00904 parentblackbox, 00905 detail, 00906 level-1, 00907 instanceOrtype, 00908 relative_link); 00909 } 00910 } 00911 00912 fprintf( ff , "}\n\n"); 00913 00914 fprintf( ff , " edge[color=blue]%s\n",";"); 00915 00916 if (level>-1) 00917 { 00918 // Relation Input with the inside BlackBox of the this ComplexBlackbox 00919 ComplexBlackBoxDescriptor::InputDescriptorMapType::iterator xx; 00920 ComplexBlackBoxDescriptor::InputDescriptorMapType idmt=bbGetDescriptor()->GetInputDescriptorMap(); 00921 for ( xx = idmt.begin(); xx != idmt.end(); ++xx ) 00922 { 00923 ComplexBlackBoxInputDescriptor *cbbid = (ComplexBlackBoxInputDescriptor*)xx->second; 00924 00925 fprintf(ff," "); 00926 bbWriteDotInputOutputName(ff,true,detail,level); 00927 if (detail==1) 00928 { 00929 fprintf(ff,":%s",cbbid->GetName().c_str() ); 00930 } 00931 fprintf(ff,"->" ); 00932 BlackBox::Pointer bb = bbGetBlackBox( cbbid->GetTarget() ); 00933 bb->bbWriteDotInputOutputName(ff,true,detail,level); 00934 if (detail==1) 00935 { 00936 fprintf(ff,":%s \n", cbbid->GetInput().c_str() ); 00937 } 00938 }// for xx 00939 00940 00941 00942 fprintf(ff,"\n \n"); 00943 00944 00945 00946 // Relation Output ComplexBlackBox 00947 ComplexBlackBoxDescriptor::OutputDescriptorMapType::iterator yy; 00948 ComplexBlackBoxDescriptor::OutputDescriptorMapType odmt=bbGetDescriptor()->GetOutputDescriptorMap(); 00949 for ( yy = odmt.begin(); yy != odmt.end(); ++yy ) 00950 { 00951 ComplexBlackBoxOutputDescriptor *cbbod = (ComplexBlackBoxOutputDescriptor*)yy->second; 00952 fprintf(ff," "); 00953 BlackBox::Pointer bb = bbGetBlackBox( cbbod->GetTarget() ); 00954 bb->bbWriteDotInputOutputName(ff,false,detail,level); 00955 if (detail==1) 00956 { 00957 fprintf(ff,":%s", cbbod->GetOutput().c_str() ); 00958 } 00959 fprintf(ff,"->" ); 00960 bbWriteDotInputOutputName(ff,false,detail,level); 00961 if (detail==1) 00962 { 00963 fprintf(ff,":%s",cbbod->GetName().c_str() ); 00964 } 00965 fprintf(ff,"\n"); 00966 } // for yy 00967 00968 } // if level 00969 00970 00971 00972 // Relation from the out side of this ComplexBlackBox with its Inputs 00973 if (GetThisPointer<ComplexBlackBox>()!=parentblackbox) { 00974 for ( ii = bbGetInputConnectorMap().begin(); 00975 ii != bbGetInputConnectorMap().end(); ++ii ) 00976 { 00977 if (ii->second) 00978 { 00979 Connection* con = ii->second->GetConnection(); 00980 if (con!=NULL){ 00981 BlackBox::Pointer a=con->GetOriginalBlackBoxFrom(); 00982 BlackBox::Pointer b=con->GetOriginalBlackBoxTo(); 00983 fprintf(ff," "); 00984 a->bbWriteDotInputOutputName(ff,false,detail,level); 00985 if (detail==1) 00986 { 00987 fprintf(ff,":%s",con->GetOriginalBlackBoxFromOutput().c_str()); 00988 } 00989 fprintf(ff,"->"); 00990 b->bbWriteDotInputOutputName(ff,true,detail,level); 00991 if (detail==1) 00992 { 00993 fprintf(ff,":%s",con->GetOriginalBlackBoxToInput().c_str()); 00994 } 00995 fprintf(ff,"%s\n",";"); 00996 } // if con 00997 } // if second 00998 } // for 00999 } // if parentblackbox 01000 }
void bbtk::ComplexBlackBox::bbWriteDotInputOutputName | ( | FILE * | ff, | |
bool | inputoutput, | |||
int | detail, | |||
int | level | |||
) | [virtual] |
Virtual.
Reimplemented from bbtk::BlackBox.
Definition at line 619 of file bbtkComplexBlackBox.cxx.
References bbtk::BlackBox::bbGetTypeName().
Referenced by bbWriteDotFileBlackBox().
00620 { 00621 if (inputoutput) 00622 { 00623 fprintf(ff,"%s_IN_%p",bbGetTypeName().c_str(),this); 00624 } else { 00625 fprintf(ff,"%s_OUT_%p",bbGetTypeName().c_str(),this); 00626 } // if inputoutput 00627 }
void bbtk::ComplexBlackBox::Check | ( | bool | recursive = true |
) | [virtual] |
Reimplemented from bbtk::BlackBox.
Definition at line 1025 of file bbtkComplexBlackBox.cxx.
References bbtk::BlackBox::bbGetFullName(), bbtkMessage, bbtk::i, mBlackBoxMap, and mConnectionList.
01026 { 01027 bbtkMessage("debug",1,"**** Checking Complex Black Box "<<(void*)this 01028 <<" ["<<bbGetFullName()<<"]"<<std::endl); 01029 01030 BlackBoxMapType::const_iterator i; 01031 for ( i = mBlackBoxMap.begin(); i != mBlackBoxMap.end(); ++i ) 01032 { 01033 i->second->Check(recursive); 01034 } 01035 ConnectionListType::const_iterator j; 01036 for ( j = mConnectionList.begin(); 01037 j != mConnectionList.end(); ++j ) 01038 { 01039 (*j)->Check(); 01040 } 01041 bbtkMessage("debug",1,"**** Checking Complex Black Box "<<(void*)this 01042 <<" ["<<bbGetFullName()<<"] ... OK"<<std::endl); 01043 01044 }
void bbtk::ComplexBlackBox::Clear | ( | ) |
Clear.
Definition at line 157 of file bbtkComplexBlackBox.cxx.
References bbtkBlackBoxDebugMessage, mBlackBoxMap, and mConnectionList.
Referenced by ~ComplexBlackBox().
00158 { 00159 bbtkBlackBoxDebugMessage("object",3, 00160 "==> ComplexBlackBox::Clear()" 00161 <<std::endl); 00162 00163 bbtkBlackBoxDebugMessage("object",4, 00164 " -> Releasing connections"<<std::endl); 00165 mConnectionList.clear(); 00166 bbtkBlackBoxDebugMessage("object",4, 00167 " -> Releasing boxes"<<std::endl); 00168 mBlackBoxMap.clear(); 00169 00170 bbtkBlackBoxDebugMessage("object",3, 00171 "<== ComplexBlackBox::Clear()" 00172 <<std::endl); 00173 }
std::string bbtk::ComplexBlackBox::GetObjectInfo | ( | ) | const [virtual] |
Reimplemented from bbtk::Object.
Definition at line 1072 of file bbtkComplexBlackBox.cxx.
References bbtk::i, mBlackBoxMap, and mConnectionList.
01073 { 01074 std::stringstream i; 01075 i << " - "<<mBlackBoxMap.size() << " boxes / " 01076 <<mConnectionList.size() << " connections" << std::endl; 01077 return i.str(); 01078 }
size_t bbtk::ComplexBlackBox::GetObjectInternalSize | ( | ) | const [virtual] |
Reimplemented from bbtk::Object.
Definition at line 1090 of file bbtkComplexBlackBox.cxx.
Referenced by GetObjectRecursiveSize(), and GetObjectSize().
01091 { 01092 size_t s = sizeof(ComplexBlackBox); 01093 return s; 01094 }
std::string bbtk::ComplexBlackBox::GetObjectName | ( | ) | const [virtual] |
Reimplemented from bbtk::Object.
Definition at line 1064 of file bbtkComplexBlackBox.cxx.
References bbGetNameWithParent().
01065 { 01066 return std::string("ComplexBlackBox '")+bbGetNameWithParent() 01067 +std::string("'"); 01068 }
size_t bbtk::ComplexBlackBox::GetObjectRecursiveSize | ( | ) | const [virtual] |
Reimplemented from bbtk::Object.
Definition at line 1097 of file bbtkComplexBlackBox.cxx.
References GetObjectInternalSize(), bbtk::Object::GetObjectRecursiveSize(), bbtk::i, mBlackBoxMap, and mConnectionList.
01098 { 01099 size_t s = Superclass::GetObjectRecursiveSize(); 01100 s += ComplexBlackBox::GetObjectInternalSize(); 01101 BlackBoxMapType::const_iterator i; 01102 for ( i = mBlackBoxMap.begin(); i != mBlackBoxMap.end(); ++i ) 01103 { 01104 s += i->second->GetObjectRecursiveSize(); 01105 } 01106 ConnectionListType::const_iterator j; 01107 for ( j = mConnectionList.begin(); 01108 j != mConnectionList.end(); ++j ) 01109 { 01110 s += (*j)->GetObjectRecursiveSize(); 01111 } 01112 return s; 01113 }
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(); }
size_t bbtk::ComplexBlackBox::GetObjectSize | ( | ) | const [virtual] |
Reimplemented from bbtk::Object.
Definition at line 1082 of file bbtkComplexBlackBox.cxx.
References GetObjectInternalSize(), and bbtk::Object::GetObjectSize().
01083 { 01084 size_t s = Superclass::GetObjectSize(); 01085 s += ComplexBlackBox::GetObjectInternalSize(); 01086 return s; 01087 }
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 }
bool bbtk::ComplexBlackBox::IsAPrototype | ( | ) | const [inline] |
Returns true if it is a prototype.
Definition at line 79 of file bbtkComplexBlackBox.h.
Referenced by bbGetNameWithParent().
00079 { return (!mLockedDescriptor); }
void bbtk::Object::LockThis | ( | ) | [inline, protected, inherited] |
static boost::shared_ptr<U> bbtk::BlackBox::MakeBlackBoxPointer | ( | U * | s, | |
bool | lock = false | |||
) | [inline, static, protected, inherited] |
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 bbtk::BlackBox::bbAllocateConnectors(), bbClone(), ComplexBlackBox(), and 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 }
ComplexBlackBox::Pointer bbtk::ComplexBlackBox::New | ( | const std::string & | name, | |
ComplexBlackBoxDescriptor::Pointer | desc | |||
) | [static, protected] |
Creates a new complex black box.
Definition at line 47 of file bbtkComplexBlackBox.cxx.
References bbtkDebugMessage, bbtkendl, ComplexBlackBox(), and bbtk::BlackBox::MakeBlackBoxPointer().
00049 { 00050 bbtkDebugMessage("object",1,"##> ComplexBlackBox::New('"<<name<<"','"<< 00051 desc->GetTypeName()<<"')" <<bbtkendl); 00052 ComplexBlackBox::Pointer p = 00053 MakeBlackBoxPointer(new ComplexBlackBox(name,desc)); 00054 bbtkDebugMessage("object",2,"<## ComplexBlackBox::New('"<<name<<"','"<< 00055 desc->GetTypeName()<<"')" <<bbtkendl); 00056 return p; 00057 }
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::ComplexBlackBox::SetAsPrototype | ( | ) | [inline] |
Set as prototype.
Definition at line 77 of file bbtkComplexBlackBox.h.
00077 { mLockedDescriptor.reset(); }
void bbtk::Object::UnLockThis | ( | ) | [inline, protected, inherited] |
friend class ComplexBlackBoxDescriptor [friend] |
Definition at line 61 of file bbtkComplexBlackBox.h.
friend struct Object::Deleter [friend] |
The map of black boxes.
Definition at line 191 of file bbtkComplexBlackBox.h.
Referenced by bbAddBlackBox(), bbExecute(), bbFindBlackBox(), bbGetBlackBox(), bbPrintBlackBoxes(), bbRemoveBlackBox(), bbUnsafeAddBlackBox(), bbUnsafeGetBlackBox(), bbWriteDotFileBlackBox(), Check(), Clear(), ComplexBlackBox(), GetObjectInfo(), and GetObjectRecursiveSize().
The list of connections.
Definition at line 197 of file bbtkComplexBlackBox.h.
Referenced by bbAddConnection(), bbRemoveBlackBox(), Check(), Clear(), ComplexBlackBox(), GetObjectInfo(), and GetObjectRecursiveSize().
The descriptor pointer.
Definition at line 188 of file bbtkComplexBlackBox.h.
Referenced by ComplexBlackBox().
std::vector<std::string> bbtk::ComplexBlackBox::mExecutionList [private] |
The execution list.
Definition at line 200 of file bbtkComplexBlackBox.h.
Referenced by bbAddToExecutionList(), and bbExecute().
Default constructor : derived classes must use the constructor with the ComplexBlackBox's name.
The descriptor pointer : is 0 if the box is a prototype
Definition at line 186 of file bbtkComplexBlackBox.h.