bbtk::ComplexBlackBox Class Reference

Abstract user defined black boxes. More...

#include <bbtkComplexBlackBox.h>

List of all members.

Public Types

typedef ComplexBlackBox Self
typedef boost::shared_ptr< SelfPointer
typedef boost::weak_ptr< SelfWeakPointer
typedef std::map< std::string,
BlackBox::Pointer > 
BlackBoxMapType
 The type of map of black boxes.

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)
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)
IOStatus bbBackwardUpdate (Connection::Pointer caller)
void bbSetModifiedStatus (BlackBoxInputConnector *c)

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.

Static Protected Member Functions

static ComplexBlackBox::Pointer New (const std::string &name, ComplexBlackBoxDescriptor::Pointer desc)
 Creates a new complex black box.

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


Detailed Description

Abstract user defined black boxes.

Definition at line 58 of file bbtkComplexBlackBox.h.


Member Typedef Documentation

typedef ComplexBlackBox bbtk::ComplexBlackBox::Self

Definition at line 60 of file bbtkComplexBlackBox.h.

typedef boost::shared_ptr<Self> bbtk::ComplexBlackBox::Pointer

Definition at line 60 of file bbtkComplexBlackBox.h.

typedef boost::weak_ptr<Self> bbtk::ComplexBlackBox::WeakPointer

Definition at line 60 of file bbtkComplexBlackBox.h.

typedef BlackBox bbtk::ComplexBlackBox::Superclass [protected]

Definition at line 62 of file bbtkComplexBlackBox.h.

typedef std::map<std::string, BlackBox::Pointer> bbtk::ComplexBlackBox::BlackBoxMapType

The type of map of black boxes.

Definition at line 101 of file bbtkComplexBlackBox.h.

typedef std::list<Connection::Pointer> bbtk::ComplexBlackBox::ConnectionListType [private]

The type of list of connections.

Definition at line 199 of file bbtkComplexBlackBox.h.


Constructor & Destructor Documentation

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(), bbtkDebugMessage, mBlackBoxMap, and mConnectionList.

00140   {
00141     bbtkDebugMessage("object",3,
00142                      "==> ComplexBlackBox::~ComplexBlackBox() ["
00143                      <<bbGetName()<<"]"<<std::endl);
00144 
00145     bbtkDebugMessage("object",4,
00146                      " -> Releasing connections"<<std::endl);
00147     mConnectionList.clear();
00148     bbtkDebugMessage("object",4,
00149                      " -> Releasing boxes"<<std::endl);
00150     mBlackBoxMap.clear();
00151 
00152     //    Clear();
00153     this->bbDesallocateConnectors();
00154 
00155     bbtkDebugMessage("object",3,
00156                      "<== ComplexBlackBox::~ComplexBlackBox() ["
00157                      <<bbGetName()<<"]"<<std::endl);
00158   } 

Here is the call graph for this function:

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 bbtkDebugMessage.

00064     : 
00065     BlackBox(name),
00066     mLockedDescriptor(desc),
00067     mDescriptor(desc)
00068   {
00069     bbtkDebugMessage("object",3,
00070                      "##> ComplexBlackBox::ComplexBlackBox(\""
00071                      <<name<<"\")"<<std::endl);
00072     bbAllocateConnectors();
00073     bbtkDebugMessage("object",3,
00074                      "<## ComplexBlackBox::ComplexBlackBox(\""
00075                      <<name<<"\")"<<std::endl);
00076   }

Here is the call graph for this function:

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(), bbtkDebugMessage, bbtkDebugMessageInc, bbUnsafeAddBlackBox(), bbtk::i, mBlackBoxMap, mConnectionList, mDescriptor, mExecutionList, and mLockedDescriptor.

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     bbtkDebugMessage("object",3,
00091                         "##> ComplexBlackBox::ComplexBlackBox(\""
00092                         <<from.bbGetName()<<"\",\""
00093                         <<name<<"\")"<<std::endl);
00094     bbtkDebugMessage("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         bbtkDebugMessageInc("object",5,"    * Cloning \""<<i->first<<"\""<<std::endl);
00104         BlackBox::Pointer B = i->second->bbClone(i->second->bbGetName());
00105         bbUnsafeAddBlackBox(B);
00106       }
00107    
00108     bbtkDebugMessage("object",4,"  * Cloning Connections"<<std::endl);
00109     ConnectionListType::const_iterator j;
00110     for ( j = from.mConnectionList.begin(); j != from.mConnectionList.end(); ++j ) 
00111       {
00112         bbtkDebugMessage("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     bbtkDebugMessage("object",3,
00131                         "<## ComplexBlackBox::ComplexBlackBox(\""
00132                         <<from.bbGetName()<<"\",\""
00133                         <<name<<"\")"<<std::endl);
00134   }

Here is the call graph for this function:


Member Function Documentation

std::string bbtk::ComplexBlackBox::GetObjectName (  )  const

Definition at line 1130 of file bbtkComplexBlackBox.cxx.

References bbGetNameWithParent().

01131   {
01132     return std::string("ComplexBlackBox '")+bbGetNameWithParent()
01133       +std::string("'");
01134   }

Here is the call graph for this function:

std::string bbtk::ComplexBlackBox::GetObjectInfo (  )  const

Definition at line 1138 of file bbtkComplexBlackBox.cxx.

References bbtk::i, mBlackBoxMap, and mConnectionList.

01139   {
01140     std::stringstream i;
01141     i << "  - "<<mBlackBoxMap.size() << " boxes / "
01142       <<mConnectionList.size() << " connections" << std::endl;
01143     return i.str();
01144   }

size_t bbtk::ComplexBlackBox::GetObjectSize (  )  const

Definition at line 1148 of file bbtkComplexBlackBox.cxx.

01149   {
01150     size_t s = Superclass::GetObjectSize();
01151     s += ComplexBlackBox::GetObjectInternalSize();
01152     return s;
01153   }

size_t bbtk::ComplexBlackBox::GetObjectInternalSize (  )  const

Definition at line 1156 of file bbtkComplexBlackBox.cxx.

01157   {
01158     size_t s = sizeof(ComplexBlackBox);
01159     return s;
01160   }

size_t bbtk::ComplexBlackBox::GetObjectRecursiveSize (  )  const

Definition at line 1163 of file bbtkComplexBlackBox.cxx.

References bbtk::i, mBlackBoxMap, and mConnectionList.

01164   {
01165     size_t s = Superclass::GetObjectRecursiveSize();
01166     s += ComplexBlackBox::GetObjectInternalSize();
01167     BlackBoxMapType::const_iterator i;
01168     for ( i = mBlackBoxMap.begin(); i != mBlackBoxMap.end(); ++i ) 
01169       {
01170         s += i->second->GetObjectRecursiveSize();
01171       }
01172     ConnectionListType::const_iterator j;
01173     for ( j = mConnectionList.begin(); 
01174           j != mConnectionList.end(); ++j ) 
01175       {
01176         s += (*j)->GetObjectRecursiveSize();
01177       }
01178     return s;
01179   }

BlackBoxDescriptor::Pointer bbtk::ComplexBlackBox::bbGetDescriptor (  )  const [inline]

Returns the pointer on the box' descriptor.

Definition at line 67 of file bbtkComplexBlackBox.h.

Referenced by bbAllocateConnectors(), bbBackwardUpdate(), bbBruteForceSetInputPointer(), bbConnectInput(), bbConnectOutput(), bbGetInput(), bbGetNameWithParent(), bbGetOutput(), bbSetInput(), and bbSetOutput().

00067 { return mDescriptor.lock(); }

Here is the caller graph for this function:

BlackBox::Pointer bbtk::ComplexBlackBox::bbClone ( const std::string &  name  ) 

Returns a pointer on a new instance with name <name>.

Returns a pointer on a clone of the box with name <name>

Definition at line 235 of file bbtkComplexBlackBox.cxx.

References bbtkDebugMessageInc.

00236   {
00237     bbtkDebugMessageInc("Kernel",9,
00238                         "ComplexBlackBox::bbClone(\""<<name<<"\") ["
00239                         <<bbGetFullName()<<"]"<<std::endl);
00240     
00241     ComplexBlackBox* CBB = new ComplexBlackBox(*this,name);
00242     return MakeBlackBoxPointer(CBB);
00243   }

void bbtk::ComplexBlackBox::Clear (  ) 

Clear.

void bbtk::ComplexBlackBox::SetAsPrototype (  )  [inline]

Set as prototype.

Definition at line 76 of file bbtkComplexBlackBox.h.

00076 { mLockedDescriptor.reset(); }

bool bbtk::ComplexBlackBox::IsAPrototype (  )  const [inline]

Returns true if it is a prototype.

Definition at line 78 of file bbtkComplexBlackBox.h.

Referenced by bbGetNameWithParent().

00078 { return (!mLockedDescriptor); }

Here is the caller graph for this function:

std::string bbtk::ComplexBlackBox::bbGetNameWithParent (  )  const

Returns the name with the name of the parent prepended if any.

Definition at line 1115 of file bbtkComplexBlackBox.cxx.

References bbGetDescriptor(), and IsAPrototype().

Referenced by GetObjectName().

01116   {
01117     if (!IsAPrototype()) return BlackBox::bbGetNameWithParent();
01118     if (bbGetDescriptor()) 
01119       {
01120         return bbGetDescriptor()->GetFullTypeName() + ":" + bbGetName();
01121       }
01122     else 
01123       {
01124         return std::string(":") + bbGetName();
01125       }
01126   } 

Here is the call graph for this function:

Here is the caller graph for this function:

void bbtk::ComplexBlackBox::bbExecute ( bool  force = false  ) 

Main processing method of the box. Executes the box so that its outputs are up-to-date on exit

Definition at line 249 of file bbtkComplexBlackBox.cxx.

References bbtkDebugMessage, bbtkDebugMessageInc, bbtk::i, mBlackBoxMap, and mExecutionList.

00250   {
00251     bbtkDebugMessageInc("process",2,
00252                         "=> ComplexBlackBox::bbExecute() ["
00253                         <<bbGetFullName()<<"]"<<std::endl);
00254 
00255 
00256     Wx::BusyCursor wait;
00257     
00258     if (mExecutionList.size() != 0) 
00259       {
00260         
00261         std::vector<std::string>::const_iterator i;
00262         for (i=mExecutionList.begin(); 
00263              i!=mExecutionList.end();
00264              ++i) 
00265           {
00266             bbtkDebugMessage("process",3," -> Executing '"<<*i<<"'"<<std::endl);
00267             mBlackBoxMap[*i]->bbExecute(force);
00268           }
00269       }
00270     else 
00271       {
00272         std::map<std::string, BlackBox::Pointer>::iterator i;
00273         for (i=mBlackBoxMap.begin(); i!=mBlackBoxMap.end(); ++i)
00274           {
00275             i->second->bbExecute(force);
00276           }
00277       } 
00278 
00279   }

Data bbtk::ComplexBlackBox::bbGetOutput ( const std::string &  label  ) 

Definition at line 384 of file bbtkComplexBlackBox.cxx.

References bbGetBlackBox(), bbGetDescriptor(), bbGetOutput(), bbtkDebugDecTab, bbtkDebugMessageInc, bbtk::ComplexBlackBoxOutputDescriptor::GetOutput(), and bbtk::ComplexBlackBoxOutputDescriptor::GetTarget().

Referenced by bbGetOutput().

00385   {
00386     bbtkDebugMessageInc("Data",7,
00387                         "ComplexBlackBox::bbGetOutput(\""<<name<<"\") ["
00388                         <<bbGetFullName()<<"]"<<std::endl);
00389 
00390     ComplexBlackBoxOutputDescriptor* d = 
00391       (ComplexBlackBoxOutputDescriptor*)
00392       bbGetDescriptor()->GetOutputDescriptor(name);
00393     
00394     Data p = bbGetBlackBox(d->GetTarget())->bbGetOutput(d->GetOutput());
00395 
00396 
00397     bbtkDebugDecTab("Data",7);
00398     return p;
00399   }

Here is the call graph for this function:

Here is the caller graph for this function:

Data bbtk::ComplexBlackBox::bbGetInput ( const std::string &  label  ) 

Gets the input Data of a given name.

Definition at line 404 of file bbtkComplexBlackBox.cxx.

References bbGetBlackBox(), bbGetDescriptor(), bbGetInput(), bbtkDebugDecTab, bbtkDebugMessageInc, bbtk::ComplexBlackBoxInputDescriptor::GetInput(), and bbtk::ComplexBlackBoxInputDescriptor::GetTarget().

Referenced by bbGetInput().

00405   {
00406     bbtkDebugMessageInc("Data",7,
00407                         "ComplexBlackBox::bbGetInput(\""<<name<<"\") ["
00408                         <<bbGetFullName()<<"]"<<std::endl);  
00409 
00410     ComplexBlackBoxInputDescriptor* d = 
00411       (ComplexBlackBoxInputDescriptor*)
00412       bbGetDescriptor()->GetInputDescriptor(name);
00413 
00414     Data p = bbGetBlackBox(d->GetTarget())->bbGetInput(d->GetInput());
00415 
00416     bbtkDebugDecTab("Data",7);
00417     return p;
00418   }

Here is the call graph for this function:

Here is the caller graph for this function:

void bbtk::ComplexBlackBox::bbSetOutput ( const std::string &  name,
Data  data 
)

Sets the data of the output called <name>.

Definition at line 423 of file bbtkComplexBlackBox.cxx.

References bbGetBlackBox(), bbGetDescriptor(), bbSetOutput(), bbtkDebugDecTab, bbtkDebugMessageInc, bbtk::ComplexBlackBoxOutputDescriptor::GetOutput(), and bbtk::ComplexBlackBoxOutputDescriptor::GetTarget().

Referenced by bbSetOutput().

00424   {
00425     bbtkDebugMessageInc("Data",7,
00426                         "ComplexBlackBox::bbSetOutput(\""<<name<<"\",data) ["
00427                         <<bbGetFullName()<<"]"<<std::endl); 
00428 
00429     ComplexBlackBoxOutputDescriptor* d = 
00430       (ComplexBlackBoxOutputDescriptor*)
00431       bbGetDescriptor()->GetOutputDescriptor(name);
00432     
00433     bbGetBlackBox(d->GetTarget())->bbSetOutput(d->GetOutput(),data);
00434 
00435     bbtkDebugDecTab("Data",7);
00436   }

Here is the call graph for this function:

Here is the caller graph for this function:

void bbtk::ComplexBlackBox::bbSetInput ( const std::string &  name,
Data  data,
bool  setModified = true 
)

Sets the data of the input called <name>.

Definition at line 441 of file bbtkComplexBlackBox.cxx.

References bbGetBlackBox(), bbGetDescriptor(), bbSetInput(), bbtkDebugDecTab, bbtkDebugMessageInc, bbtk::ComplexBlackBoxInputDescriptor::GetInput(), and bbtk::ComplexBlackBoxInputDescriptor::GetTarget().

Referenced by bbSetInput().

00443   {
00444     bbtkDebugMessageInc("Data",7,
00445                         "ComplexBlackBox::bbSetInput(\""<<name<<"\",data) ["
00446                         <<bbGetFullName()<<"]"<<std::endl);  
00447 
00448     ComplexBlackBoxInputDescriptor* d = (ComplexBlackBoxInputDescriptor*)
00449       bbGetDescriptor()->GetInputDescriptor(name);
00450 
00451     bbGetBlackBox(d->GetTarget())->bbSetInput(d->GetInput(),data,setModified);
00452 
00453     bbtkDebugDecTab("Data",7);
00454   }

Here is the call graph for this function:

Here is the caller graph for this function:

void bbtk::ComplexBlackBox::bbBruteForceSetInputPointer ( const std::string &  name,
void *  data,
bool  setModified = true 
)

Sets the data of the input called <name>.

Definition at line 460 of file bbtkComplexBlackBox.cxx.

References bbBruteForceSetInputPointer(), bbGetBlackBox(), bbGetDescriptor(), bbtkDebugDecTab, bbtkDebugMessageInc, bbtk::ComplexBlackBoxInputDescriptor::GetInput(), and bbtk::ComplexBlackBoxInputDescriptor::GetTarget().

Referenced by bbBruteForceSetInputPointer().

00463   {
00464     bbtkDebugMessageInc("Data",7,
00465                         "ComplexBlackBox::bbBruteForceSetInputPointer('"
00466                         <<name<<"',"<<data<<") ["
00467                         <<bbGetFullName()<<"]"<<std::endl);  
00468 
00469     ComplexBlackBoxInputDescriptor* d = (ComplexBlackBoxInputDescriptor*)
00470       bbGetDescriptor()->GetInputDescriptor(name);
00471 
00472     bbGetBlackBox(d->GetTarget())->bbBruteForceSetInputPointer(d->GetInput(),
00473                                                                data,
00474                                                                setModified);
00475 
00476     bbtkDebugDecTab("Data",7);
00477   }

Here is the call graph for this function:

Here is the caller graph for this function:

void bbtk::ComplexBlackBox::bbConnectInput ( const std::string &  name,
Connection c 
) [virtual]

Connects the input <name> to the connection c.

Definition at line 482 of file bbtkComplexBlackBox.cxx.

References bbGetBlackBox(), bbGetDescriptor(), bbtkDebugMessage, bbtk::Connection::GetFullName(), bbtk::Connection::SetBlackBoxTo(), and bbtk::Connection::SetBlackBoxToInput().

00483   {
00484     bbtkDebugMessage("connection",2,
00485                      "==> ComplexBlackBox::bbConnectInput(\""
00486                      <<name<<"\","<<c->GetFullName()<<") ["
00487                      <<bbGetFullName()<<"]"
00488                      <<std::endl);       
00489     
00490    ComplexBlackBoxInputDescriptor* d = (ComplexBlackBoxInputDescriptor*)
00491       bbGetDescriptor()->GetInputDescriptor(name);
00492 
00493 
00494    BlackBox::Pointer t = bbGetBlackBox(d->GetTarget());
00495 
00496    bbtkDebugMessage("connection",2," - Target = "<<d->GetTarget()<<" = "<<t->bbGetFullName()<<std::endl);
00497 
00498    c->SetBlackBoxTo(t);
00499    c->SetBlackBoxToInput(d->GetInput());
00500 
00501    bbtkDebugMessage("connection",2," - New conn = "<<c->GetFullName()<<std::endl);
00502    t->bbConnectInput(d->GetInput(),c);
00503 
00504    bbtkDebugMessage("connection",2,
00505                      "<== ComplexBlackBox::bbConnectInput(\""
00506                      <<name<<"\","<<c->GetFullName()<<") ["
00507                      <<bbGetFullName()<<"]"
00508                      <<std::endl);       
00509   }

Here is the call graph for this function:

void bbtk::ComplexBlackBox::bbConnectOutput ( const std::string &  name,
Connection c 
) [virtual]

Connects the output <name> to the connection c.

Definition at line 515 of file bbtkComplexBlackBox.cxx.

References bbGetBlackBox(), bbGetDescriptor(), bbtkDebugMessage, bbtk::Connection::GetFullName(), bbtk::Connection::SetBlackBoxFrom(), and bbtk::Connection::SetBlackBoxFromOutput().

00516   {
00517     bbtkDebugMessage("connection",2,
00518                      "==> ComplexBlackBox::bbConnectOutput(\""
00519                      <<name<<"\","<<c->GetFullName()<<") ["
00520                      <<bbGetFullName()<<"]"<<std::endl);       
00521 
00522    ComplexBlackBoxOutputDescriptor* d = (ComplexBlackBoxOutputDescriptor*)
00523       bbGetDescriptor()->GetOutputDescriptor(name);
00524 
00525    BlackBox::Pointer t = bbGetBlackBox(d->GetTarget());
00526  
00527   bbtkDebugMessage("connection",2," - Target = "<<d->GetTarget()<<" = "<<t->bbGetFullName()<<std::endl);
00528 
00529    c->SetBlackBoxFrom(t);
00530    c->SetBlackBoxFromOutput(d->GetOutput());
00531 
00532    bbtkDebugMessage("connection",2," - New conn = "<<c->GetFullName()<<std::endl);
00533 
00534    t->bbConnectOutput(d->GetOutput(),c);
00535   
00536     bbtkDebugMessage("connection",2,
00537                      "<== ComplexBlackBox::bbConnectOutput(\""
00538                      <<name<<"\","<<c->GetFullName()<<") ["
00539                      <<bbGetFullName()<<"]"<<std::endl);       
00540   }

Here is the call graph for this function:

BlackBox::Pointer bbtk::ComplexBlackBox::bbGetBlackBox ( const std::string &  name  ) 

Returns the black box with name <name>.

Definition at line 638 of file bbtkComplexBlackBox.cxx.

References bbtkDebugDecTab, bbtkDebugMessageInc, bbtkError, bbtk::i, and mBlackBoxMap.

Referenced by bbBruteForceSetInputPointer(), bbConnectInput(), bbConnectOutput(), bbGetInput(), bbGetOutput(), bbSetInput(), bbSetOutput(), and ComplexBlackBox().

00639   {
00640     bbtkDebugMessageInc("Kernel",9,
00641                         "ComplexBlackBox::GetBlackBox(\""<<name<<"\") ["
00642                         <<bbGetFullName()<<"]"<<std::endl);  
00643 
00644     BlackBoxMapType::iterator i = mBlackBoxMap.find(name);
00645     if ( i == mBlackBoxMap.end() ) 
00646       {
00647         bbtkError("the black box \""<<name<<"\" does not exist");
00648       }
00649 
00650     bbtkDebugDecTab("Kernel",9);
00651     return i->second;
00652   }

Here is the caller graph for this function:

const BlackBoxMapType& bbtk::ComplexBlackBox::bbGetBlackBoxMap (  )  [inline]

Definition at line 103 of file bbtkComplexBlackBox.h.

00103 { return mBlackBoxMap; }

void bbtk::ComplexBlackBox::bbPrintBlackBoxes (  ) 

Definition at line 679 of file bbtkComplexBlackBox.cxx.

References bbtkDebugDecTab, bbtkDebugMessageInc, bbtkMessage, bbtk::i, and mBlackBoxMap.

00680   {
00681     bbtkDebugMessageInc("Kernel",9,
00682                         "ComplexBlackBox::PrintBlackBoxes() ["
00683                         <<bbGetFullName()<<"]"
00684                         <<std::endl);  
00685 
00686     BlackBoxMapType::iterator i;
00687     for ( i = mBlackBoxMap.begin(); i != mBlackBoxMap.end(); ++i ) 
00688       {
00689         bbtkMessage("Help",1,i->second->bbGetFullName()<<std::endl);
00690       }
00691 
00692     bbtkDebugDecTab("Kernel",9);
00693   }

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

Definition at line 747 of file bbtkComplexBlackBox.cxx.

References bbWriteDotFileBlackBox().

00753   {
00754     
00755     std::string directory(output_dir);
00756 
00757     if (output_dir.length() == 0) 
00758     {
00759            // Don't pollute the file store with  "temp_dir" directories ... 
00760            std::string default_temp_dir = ConfigurationFile::GetInstance().Get_default_temp_dir();
00761            directory =  default_temp_dir + "/" + "temp_dir";
00762     }
00763     
00764     std::string simplefilename  (this->bbGetTypeName()+"_"+this->bbGetName());
00765     std::string simplefilename_png (simplefilename+".png");
00766     std::string filename           (directory+"/"+simplefilename);
00767     std::string filename_png       (filename+".png");
00768     std::string filename_cmap      (filename+".cmap");
00769     std::string filename_dot       (filename+".dot");
00770 
00771     std::string filename_png2   ("\""   + filename_png  + "\"");
00772     std::string filename_cmap2  ("\""   + filename_cmap + "\"");
00773     std::string filename_dot2   ("\""   + filename_dot  + "\"");
00774     
00775 
00776     std::string command1 ("dot -T png -o "  
00777                           + filename_png2  + " " + filename_dot2);
00778     std::string command1a("dot -T cmap -o " 
00779                           + filename_cmap2 + " " + filename_dot2);
00780 
00781     // 1. Generating .dot file
00782     FILE *ff;
00783     ff = fopen(filename_dot.c_str(),"w");
00784     fprintf(ff,"digraph bbtk_graph{\n");
00785     fprintf(ff,"rankdir=LR%s\n",";");
00786     fprintf(ff,"node [shape=record]%s\n",";");
00787 
00788     this->bbWriteDotFileBlackBox(ff,
00789                                  GetThisPointer<ComplexBlackBox>(),
00790                                  detail,level,
00791                                  instanceOrtype,
00792                                  relative_link );
00793 
00794     fprintf(ff,"}\n");
00795     fclose(ff);
00796 
00797     // 2. Executing .dot file -> png
00798     system( command1.c_str() );   
00799     // 3. Executing .dot file -> cmap
00800     system( command1a.c_str() );  
00801     
00802     // 4. HTML code insertion
00803     // 4.1 image
00804     (s) << "<center><img src=\"" << simplefilename_png 
00805          <<   "\" border=\"0\" usemap=\"#map_"<< simplefilename 
00806          <<"\" alt=\"\"></center>\n";
00807 
00808     // 4.2 map
00809     (s) << "<map name=\"map_"<< simplefilename <<"\">\n";
00810     FILE *ff2;
00811     char c;
00812     ff2=fopen(filename_cmap.c_str(),"r");
00813     while (!feof(ff2))
00814     {
00815            c=fgetc(ff2);
00816            if (c!=-1)
00817            {
00818               (s) << c;
00819            }
00820     }
00821     (s) << "</map>\n\n";
00822     
00823     // End
00824   }

Here is the call graph for this function:

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

Definition at line 830 of file bbtkComplexBlackBox.cxx.

References bbtk::ComplexBlackBoxInputDescriptor::GetInput(), bbtk::Connection::GetOriginalBlackBoxFrom(), bbtk::Connection::GetOriginalBlackBoxFromOutput(), bbtk::Connection::GetOriginalBlackBoxTo(), bbtk::Connection::GetOriginalBlackBoxToInput(), bbtk::ComplexBlackBoxOutputDescriptor::GetOutput(), bbtk::ComplexBlackBoxOutputDescriptor::GetTarget(), bbtk::ComplexBlackBoxInputDescriptor::GetTarget(), and bbtk::i.

Referenced by bbInsertHTMLGraph().

00835   {
00836     std::string tmp1;
00837     std::string valueStr("");
00838     Package::Pointer package = this->bbGetDescriptor()->GetPackage(); 
00839 
00840     if (package!=NULL)
00841     {
00842       if (relative_link)
00843              tmp1 = this->bbGetDescriptor()->GetPackage()->GetDocRelativeURL();
00844            else 
00845              tmp1 = this->bbGetDescriptor()->GetPackage()->GetDocURL();
00846     } 
00847     else 
00848     {
00849            tmp1 = "Caspitas";
00850     }
00851 
00852     std::string tmp2=bbGetTypeName();
00853     std::string url(tmp1 + "#" + tmp2 );        
00854     fprintf( ff , "subgraph cluster_%s_%p {\n",bbGetName().c_str(),this);
00855 
00856     if (!(   (bbGetTypeName()=="workspace") && (bbGetName()=="workspacePrototype")) )
00857     {
00858            fprintf( ff , "  URL = \"%s\" %s",url.c_str(),";");
00859     }
00860 
00861     std::string boxname="["+bbGetTypeName()+"]";
00862     if (GetThisPointer<ComplexBlackBox>()!=parentblackbox)
00863     {
00864        if (detail==0)
00865             {
00866           boxname=bbGetName();
00867        } 
00868        else 
00869        {
00870           boxname = bbGetName();
00871           boxname = boxname + "   [" +this->bbGetDescriptor()->GetPackage()->GetName()+"::"+ bbGetTypeName() + "]";
00872             }
00873 
00874     }
00875     fprintf( ff , "  label = \"%s\"%s\n",  boxname.c_str() ,";");
00876 
00877 
00878 
00879     //  fprintf( ff , "  style=filled%s\n",";");
00880     //  fprintf( ff , "  color=grey%s\n",";");
00881     fprintf( ff , "  node [style=filled]%s\n",";");
00882     fprintf( ff , "  fillcolor=grey%s\n",";");
00883     fprintf( ff , "  edge [color=blue]%s\n",";");
00884 
00885 
00886     // Labels Salida
00887     std::string labelStr1;
00888     std::string labelStr2;
00889     labelStr1 = boxname + "\\n(output)" ; 
00890     labelStr2 = " | {{ ";
00891     bool tmp; 
00892     tmp=false;
00893     OutputConnectorMapType::iterator i;
00894 
00895     const BlackBoxDescriptor::OutputDescriptorMapType& omap = this->bbGetDescriptor()->GetOutputDescriptorMap();
00896     BlackBoxDescriptor::OutputDescriptorMapType::const_iterator o;      
00897     for ( o = omap.begin();  o != omap.end(); ++o ) 
00898       {
00899         if (tmp==true)
00900           {
00901             labelStr2=labelStr2+" | ";
00902           }
00903         tmp=true;
00904         if (instanceOrtype==true)
00905           {
00906             valueStr = this->bbGetOutputAsString(o->second->GetName()/*
00907                                                                    ,factory*/) + " = ";
00908           } 
00909         labelStr2=labelStr2+"<"+o->second->GetName().c_str()+"> " + valueStr + o->second->GetName().c_str();
00910       }
00911 
00912     labelStr2 = labelStr2+ " } }";
00913 
00914 
00915 
00916     if (detail==1)
00917       {
00918         labelStr1 = labelStr1 + labelStr2;
00919       }
00920 
00921     if (tmp){
00922       fprintf(ff,"  " );
00923       bbWriteDotInputOutputName(ff,false,detail,level);
00924       fprintf( ff , " [shape=record, style=filled,fillcolor=grey,color=red,label=\"%s\"]%s\n",labelStr1.c_str(),";" );
00925     }
00926 
00927 
00928     // label Entrada
00929     labelStr1 = boxname + "\\n(input)" ; 
00930     labelStr2 = " | {{ "; 
00931     tmp=false;
00932     InputConnectorMapType::iterator ii;
00933 
00934     const BlackBoxDescriptor::InputDescriptorMapType& imap = this->bbGetDescriptor()->GetInputDescriptorMap();  
00935     BlackBoxDescriptor::InputDescriptorMapType::const_iterator iii;
00936     for ( iii = imap.begin();  iii != imap.end(); ++iii ) 
00937       {
00938         if (tmp==true)
00939           {
00940             labelStr2=labelStr2+" | ";
00941           }
00942         tmp=true;
00943         if (instanceOrtype==true)
00944           {
00945             valueStr = this->bbGetInputAsString(iii->second->GetName()/*,factory*/) + " = ";
00946           } 
00947         labelStr2=labelStr2+"<"+iii->second->GetName().c_str()+"> " + valueStr + iii->second->GetName().c_str();
00948       }
00949 
00950 
00951     labelStr2 = labelStr2+ " } }";
00952     if (detail==1)
00953       {
00954         labelStr1 = labelStr1 + labelStr2;
00955       }
00956     if (tmp){
00957       fprintf(ff,"  " );
00958       bbWriteDotInputOutputName(ff,true,detail,level);
00959       fprintf( ff , " [shape=record, style=filled,fillcolor=grey,color=red,label=\"%s\"]%s\n",labelStr1.c_str(),";" );
00960     }
00961 
00962 
00963     // Body
00964     BlackBoxMapType::iterator j;
00965     for ( j = mBlackBoxMap.begin(); j != mBlackBoxMap.end(); ++j ) 
00966       {
00967         if (level>-1)
00968           {
00969             j->second->bbWriteDotFileBlackBox(ff,
00970                                               parentblackbox,
00971                                               detail,
00972                                               level-1,
00973                                               instanceOrtype,
00974                                               relative_link);
00975           }
00976       }
00977 
00978     fprintf( ff , "}\n\n");
00979 
00980     fprintf( ff , "  edge[color=blue]%s\n",";");
00981 
00982     if (level>-1)
00983       {
00984         // Relation Input  with the inside BlackBox of the this ComplexBlackbox
00985         ComplexBlackBoxDescriptor::InputDescriptorMapType::iterator xx;
00986         ComplexBlackBoxDescriptor::InputDescriptorMapType idmt=bbGetDescriptor()->GetInputDescriptorMap();
00987         for ( xx = idmt.begin(); xx != idmt.end(); ++xx ) 
00988           {
00989             ComplexBlackBoxInputDescriptor *cbbid = (ComplexBlackBoxInputDescriptor*)xx->second;
00990 
00991             fprintf(ff,"  ");
00992             bbWriteDotInputOutputName(ff,true,detail,level);
00993             if (detail==1)
00994               {
00995                 fprintf(ff,":%s",cbbid->GetName().c_str() );
00996               }
00997             fprintf(ff,"->" );
00998             BlackBox::Pointer bb = bbGetBlackBox( cbbid->GetTarget() ); 
00999             bb->bbWriteDotInputOutputName(ff,true,detail,level);
01000             if (detail==1)
01001               {
01002                 fprintf(ff,":%s \n", cbbid->GetInput().c_str() );
01003               }
01004           }// for xx
01005 
01006 
01007 
01008         fprintf(ff,"\n \n");
01009 
01010 
01011 
01012         // Relation Output ComplexBlackBox
01013         ComplexBlackBoxDescriptor::OutputDescriptorMapType::iterator yy;
01014         ComplexBlackBoxDescriptor::OutputDescriptorMapType odmt=bbGetDescriptor()->GetOutputDescriptorMap();
01015         for ( yy = odmt.begin(); yy != odmt.end(); ++yy ) 
01016           {
01017             ComplexBlackBoxOutputDescriptor *cbbod = (ComplexBlackBoxOutputDescriptor*)yy->second;
01018             fprintf(ff,"  ");
01019             BlackBox::Pointer bb = bbGetBlackBox( cbbod->GetTarget() ); 
01020             bb->bbWriteDotInputOutputName(ff,false,detail,level);
01021             if (detail==1)
01022               {
01023                 fprintf(ff,":%s", cbbod->GetOutput().c_str() );
01024               }
01025             fprintf(ff,"->" );
01026             bbWriteDotInputOutputName(ff,false,detail,level);
01027             if (detail==1)
01028               {
01029                 fprintf(ff,":%s",cbbod->GetName().c_str() );
01030               }
01031             fprintf(ff,"\n");
01032           } // for yy
01033 
01034       } // if level
01035 
01036 
01037 
01038         // Relation from the out side of this ComplexBlackBox with its Inputs
01039     if (GetThisPointer<ComplexBlackBox>()!=parentblackbox) {
01040       for ( ii = bbGetInputConnectorMap().begin(); 
01041             ii != bbGetInputConnectorMap().end(); ++ii ) 
01042         {
01043           if (ii->second)
01044             {
01045               Connection* con = ii->second->GetConnection();
01046               if (con!=NULL){
01047                 BlackBox::Pointer a=con->GetOriginalBlackBoxFrom();
01048                 BlackBox::Pointer b=con->GetOriginalBlackBoxTo();
01049                 fprintf(ff,"  ");
01050                 a->bbWriteDotInputOutputName(ff,false,detail,level);
01051                 if (detail==1)
01052                   {
01053                     fprintf(ff,":%s",con->GetOriginalBlackBoxFromOutput().c_str());
01054                   }
01055                 fprintf(ff,"->");
01056                 b->bbWriteDotInputOutputName(ff,true,detail,level);
01057                 if (detail==1)
01058                   {
01059                     fprintf(ff,":%s",con->GetOriginalBlackBoxToInput().c_str());
01060                   }
01061                 fprintf(ff,"%s\n",";");
01062               } // if con
01063             } // if second
01064         } // for
01065     } // if parentblackbox
01066   }

Here is the call graph for this function:

Here is the caller graph for this function:

void bbtk::ComplexBlackBox::bbWriteDotInputOutputName ( FILE *  ff,
bool  inputoutput,
int  detail,
int  level 
) [virtual]

Virtual.

Definition at line 700 of file bbtkComplexBlackBox.cxx.

00701   {
00702     if (inputoutput)
00703       {
00704         fprintf(ff,"%s_IN_%p",bbGetTypeName().c_str(),this);
00705       } else {
00706       fprintf(ff,"%s_OUT_%p",bbGetTypeName().c_str(),this);
00707     } // if inputoutput
00708   }

BlackBox::Pointer bbtk::ComplexBlackBox::bbFindBlackBox ( const std::string &  blackboxname  )  [virtual]

Definition at line 713 of file bbtkComplexBlackBox.cxx.

References bbtk::i, and mBlackBoxMap.

00714   {
00715     BlackBox::Pointer blackbox;
00716     std::string subname="";
00717     std::string restname="";
00718     std::string delimiters(">");
00719     // Skip delimiters at beginning.
00720     std::string::size_type lastPos = blackboxname.find_first_not_of(delimiters, 0);
00721     // Find first "non-delimiter".
00722     std::string::size_type pos     = blackboxname.find_first_of(delimiters, lastPos);
00723             
00724     // Found a token, add it to the vector.
00725     subname = blackboxname.substr(lastPos, pos - lastPos);
00726     restname = blackboxname.substr(lastPos+pos - lastPos+1, 999);
00727 
00728     if (restname==subname)
00729     {
00730            restname="";
00731     }
00732 
00733     BlackBoxMapType::iterator i = mBlackBoxMap.find(subname);
00734     if ( i != mBlackBoxMap.end() ) 
00735     {
00736        blackbox = i->second;
00737        if (restname!="")
00738             {
00739              blackbox = blackbox->bbFindBlackBox(restname);
00740             }
00741     }
00742     return blackbox;
00743   }

void bbtk::ComplexBlackBox::Check ( bool  recursive = true  ) 

Definition at line 1091 of file bbtkComplexBlackBox.cxx.

References bbtkMessage, bbtk::i, mBlackBoxMap, and mConnectionList.

01092   {
01093      bbtkMessage("debug",1,"**** Checking Complex Black Box "<<(void*)this
01094                  <<" ["<<bbGetFullName()<<"]"<<std::endl);
01095      
01096      BlackBoxMapType::const_iterator i;
01097      for ( i = mBlackBoxMap.begin(); i != mBlackBoxMap.end(); ++i ) 
01098        {
01099          i->second->Check(recursive);
01100        }
01101      ConnectionListType::const_iterator j;
01102      for ( j = mConnectionList.begin(); 
01103            j != mConnectionList.end(); ++j ) 
01104        {
01105          (*j)->Check();
01106        }
01107      bbtkMessage("debug",1,"**** Checking Complex Black Box "<<(void*)this
01108                  <<" ["<<bbGetFullName()<<"] ... OK"<<std::endl);
01109   
01110   }

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, and bbtkendl.

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   }

IOStatus bbtk::ComplexBlackBox::bbBackwardUpdate ( Connection::Pointer  caller  ) 

Definition at line 315 of file bbtkComplexBlackBox.cxx.

References bbGetDescriptor(), bbtkDebugMessageInc, bbtkError, bbtkInternalError, bbUnsafeGetBlackBox(), bbtk::ComplexBlackBoxOutputDescriptor::GetTarget(), bbtk::i, bbtk::MODIFIED, and bbtk::UPTODATE.

00316   {
00317     bbtkDebugMessageInc("process",3,
00318                         "==> ComplexBlackBox::bbBackwardUpdate("
00319                         <<(caller?caller->GetFullName():"0")<<") ["
00320                         <<bbGetFullName()<<"]"<<std::endl);
00321     //    bbtkInternalError("ComplexBlackBox::bbBackwardUpdate should never be called !");
00322     
00323     if (caller==0)
00324       {
00325         bbtkInternalError("ComplexBlackBox::bbBackwardUpdate called with caller=0");
00326       }
00327 
00328     /*
00329     std::cout << "CBB BUP : "<<caller->GetBlackBoxFrom()->bbGetFullName()
00330               <<"."<<caller->GetBlackBoxFromOutput()<<"----"
00331               <<caller->GetOriginalBlackBoxFrom()->bbGetFullName()
00332               <<"."<<caller->GetOriginalBlackBoxFromOutput()<<std::endl;
00333     */
00334       
00335 
00336 
00337     IOStatus s = UPTODATE;
00338     const BlackBoxDescriptor::OutputDescriptorMapType& omap 
00339       = bbGetDescriptor()->GetOutputDescriptorMap(); 
00340     BlackBoxDescriptor::OutputDescriptorMapType::const_iterator i 
00341       = omap.find(caller->GetBlackBoxFromOutput());
00342     if (i!=omap.end())
00343       { 
00344         // Cast the BBOutputDescriptor into a ComplexBBOutputDescriptor
00345         ComplexBlackBoxOutputDescriptor* d = 
00346           (ComplexBlackBoxOutputDescriptor*)i->second;
00347         // Get the internal box 
00348         BlackBox::Pointer b = bbUnsafeGetBlackBox ( d->GetTarget() );
00349         // Calls BackwardUpdate on it
00350         bbtkDebugMessageInc("process",4,"Internal box connected to output : "<<d->GetTarget()<<std::endl);
00351         // Because internal box can also be a complex box we have to 
00352         // temporarily change the connection BlackBoxFromOutput to the 
00353         // mapped one
00354         
00355         //      std::string oldout = caller->GetBlackBoxFromOutput();
00356         //      std::cout << "oldout = "<<oldout<<std::endl;
00357         //      std::cout << "tmpout = "<<d->GetOutput()<<std::endl;
00358         //      caller->SetBlackBoxFromOutput(d->GetOutput());
00359         //
00360         //Connection newcaller(*caller);
00361         //newcaller.SetBlackBoxFromOutput(d->GetOutput());
00362         //IOStatus s1 = b->bbBackwardUpdate(&newcaller);
00363         IOStatus s1 = b->bbBackwardUpdate(caller);
00364         //newcaller.Clear();
00365         // restore old output
00366         //      caller->SetBlackBoxFromOutput(oldout);
00367 
00368         // ??? STATUS OF CBBs ???
00369         // ??? Here it is only the final status of the boxes connected to the output 
00370         if (s1==MODIFIED) s=MODIFIED;
00371       }
00372     else 
00373       {
00374         bbtkError("Connection '"<<caller->GetFullName()<<"' does not point to a valid output of the complex box !");
00375       }
00376 
00377     return s;
00378     
00379   }

Here is the call graph for this function:

void bbtk::ComplexBlackBox::bbSetModifiedStatus ( BlackBoxInputConnector c  ) 

Definition at line 283 of file bbtkComplexBlackBox.cxx.

References bbtkDebugMessage, and bbtk::BlackBoxInputConnector::GetBlackBox().

00284   {
00285     bbtkDebugMessage("modified",1,
00286                         "==> ComplexBlackBox::bbSetModifiedStatus("
00287                      <<c<<") ["<<bbGetFullName()<<"]"<<std::endl);
00288 
00289     c->GetBlackBox()->bbSetModifiedStatus(c);
00290 
00291     /*
00292     bbtkDebugMessage("modified",1,
00293                      "<== ComplexBlackBox::bbSetModifiedStatus("
00294                      <<c<<") ["<<bbGetFullName()<<"]"<<std::endl);
00295     */
00296   }

Here is the call graph for this function:

void bbtk::ComplexBlackBox::bbAddBlackBox ( BlackBox::Pointer  b  )  [protected]

Adds the black box to the complex box.

Definition at line 546 of file bbtkComplexBlackBox.cxx.

References bbtkDebugDecTab, bbtkDebugMessageInc, bbtkError, bbUnsafeGetBlackBox(), and mBlackBoxMap.

00547   {
00548     bbtkDebugMessageInc("Kernel",7,
00549                         "ComplexBlackBox::AddBlackBox(\""<<b->bbGetName()
00550                         <<"\") ["
00551                         <<bbGetFullName()<<"]"<<std::endl);  
00552     
00553     if ( bbUnsafeGetBlackBox(b->bbGetName()) ) 
00554       {
00555         bbtkError("a black box called \""<<b->bbGetName()
00556                   <<"\" already exists");
00557       }
00558     b->bbSetParent(GetThisPointer<ComplexBlackBox>());
00559     mBlackBoxMap[b->bbGetName()] = b;
00560 
00561     bbtkDebugDecTab("Kernel",7);
00562   }

Here is the call graph for this function:

void bbtk::ComplexBlackBox::bbAddToExecutionList ( const std::string &  name  )  [protected]

Definition at line 300 of file bbtkComplexBlackBox.cxx.

References bbtkDebugDecTab, bbtkDebugMessageInc, and mExecutionList.

00301   {
00302         bbtkDebugMessageInc("Kernel",9,
00303                         "ComplexBlackBox::bbAddToExecutionList(\""
00304                         <<name<<"\") ["
00305                         <<bbGetFullName()<<"]"<<std::endl);
00306 
00307         mExecutionList.push_back( name );
00308 
00309      bbtkDebugDecTab("Kernel",9);   
00310 
00311   }

void bbtk::ComplexBlackBox::bbUnsafeAddBlackBox ( BlackBox::Pointer  b  )  [protected]

Adds the black box to the complex box (unsafe).

Definition at line 567 of file bbtkComplexBlackBox.cxx.

References bbtkDebugDecTab, bbtkDebugMessageInc, and mBlackBoxMap.

Referenced by ComplexBlackBox().

00568   {
00569     bbtkDebugMessageInc("Kernel",7,
00570                         "ComplexBlackBox::UnsafeAddBlackBox(\""<<b->bbGetName()
00571                         <<"\") ["
00572                         <<bbGetFullName()<<"]"<<std::endl);  
00573     
00574     b->bbSetParent(GetThisPointer<ComplexBlackBox>());
00575     mBlackBoxMap[b->bbGetName()] = b;
00576 
00577     bbtkDebugDecTab("Kernel",7);
00578   }

Here is the caller graph for this function:

void bbtk::ComplexBlackBox::bbRemoveBlackBox ( const std::string &  name,
bool  remove_connections = true 
) [protected]

Removes the black box from the complex box.

Definition at line 583 of file bbtkComplexBlackBox.cxx.

References bbtkDebugDecTab, bbtkDebugMessageInc, bbtkError, bbtk::i, mBlackBoxMap, and mConnectionList.

00585   {
00586     bbtkDebugMessageInc("Kernel",7,
00587                         "ComplexBlackBox::RemoveBlackBox(\""<<name<<"\") ["
00588                         <<bbGetFullName()<<"]"<<std::endl);  
00589 
00590     BlackBoxMapType::iterator i = mBlackBoxMap.find(name);
00591     if ( i == mBlackBoxMap.end() ) 
00592       {
00593         bbtkError("the black box \""<<name<<"\" does not exist");
00594       }
00595     BlackBox::WeakPointer p = i->second;
00596     
00597     if (remove_connections)
00598       {
00599         ConnectionListType::const_iterator j;
00600         for ( j = mConnectionList.begin(); 
00601               j != mConnectionList.end(); ++j ) 
00602           {
00603             (*j)->Check();
00604           }
00605       }
00606     if (p.use_count()!=1) 
00607       {
00608         bbtkError("the black box \""<<name<<"\" is still connected");
00609       }
00610     
00611     mBlackBoxMap.erase(i);
00612     
00613 
00614     // Unload orphan dl packages 
00615     Package::UnLoadReleasedDynamicallyLoadedPackages();
00616 
00617     bbtkDebugDecTab("Kernel",7);
00618   }

void bbtk::ComplexBlackBox::bbAddConnection ( Connection::Pointer  c  )  [protected]

Adds the connection to the complex box.

Definition at line 623 of file bbtkComplexBlackBox.cxx.

References bbtkDebugDecTab, bbtkDebugMessageInc, and mConnectionList.

Referenced by ComplexBlackBox().

00624   {
00625     bbtkDebugMessageInc("Kernel",7,
00626                         "ComplexBlackBox::AddConnection(\""<<"..."<<"\") ["
00627                         <<bbGetFullName()<<"]"<<std::endl);  
00628 
00629     mConnectionList.push_back(c);
00630 
00631     bbtkDebugDecTab("Kernel",7);
00632   }

Here is the caller graph for this function:

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 658 of file bbtkComplexBlackBox.cxx.

References bbtkDebugDecTab, bbtkDebugMessageInc, bbtk::i, and mBlackBoxMap.

Referenced by bbAddBlackBox(), bbAllocateConnectors(), and bbBackwardUpdate().

00659   {
00660     bbtkDebugMessageInc("Kernel",9,
00661                         "ComplexBlackBox::UnsafeGetBlackBox(\""<<name<<"\") ["
00662                         <<bbGetFullName()<<"]"
00663                         <<std::endl);  
00664 
00665     BlackBoxMapType::iterator i = mBlackBoxMap.find(name);
00666     if ( i == mBlackBoxMap.end() ) 
00667       {
00668         bbtkDebugDecTab("Kernel",9);
00669         return BlackBox::Pointer();
00670       }
00671 
00672     bbtkDebugDecTab("Kernel",9);
00673     return i->second;
00674     
00675   }

Here is the caller graph for this function:

void bbtk::ComplexBlackBox::bbAllocateConnectors (  )  [protected]

Allocates the i/o connectors of the black box.

Definition at line 164 of file bbtkComplexBlackBox.cxx.

References bbGetDescriptor(), bbtkDebugDecTab, bbtkDebugMessage, bbtkDebugMessageInc, bbUnsafeGetBlackBox(), bbtk::ComplexBlackBoxInputDescriptor::GetInput(), bbtk::ComplexBlackBoxOutputDescriptor::GetOutput(), bbtk::ComplexBlackBoxOutputDescriptor::GetTarget(), bbtk::ComplexBlackBoxInputDescriptor::GetTarget(), and bbtk::i.

Referenced by ComplexBlackBox().

00165   {  
00166     bbtkDebugMessageInc("Kernel",8,
00167                         "ComplexBlackBox::bbAllocateConnectors() ["
00168                         <<bbGetFullName()<<"]"
00169                         <<std::endl);   
00170     
00171     // Input connectors
00172     const BlackBoxDescriptor::InputDescriptorMapType& imap 
00173       = bbGetDescriptor()->GetInputDescriptorMap(); 
00174     BlackBoxDescriptor::InputDescriptorMapType::const_iterator i;       
00175     for ( i = imap.begin(); i != imap.end(); ++i )                      
00176       {                                                                 
00177         bbtkDebugMessage("Kernel",8,"* Allocate \""<<i->first<<"\""<<std::endl);
00178         // Redirect the connector to the internal box connector
00179         // Cast the BBInputDescriptor into a ComplexBBInputDescriptor
00180         ComplexBlackBoxInputDescriptor* d = 
00181           (ComplexBlackBoxInputDescriptor*)i->second;
00182         // Get the internal box connector
00183         BlackBoxInputConnector* c = 
00184           bbUnsafeGetBlackBox ( d->GetTarget() )
00185           ->bbGetInputConnectorMap()[ d->GetInput() ];
00186         
00187         bbGetInputConnectorMap()[i->second->GetName()] = c;
00188       }                                                                 
00189 
00190     // Output connectors
00191     const BlackBoxDescriptor::OutputDescriptorMapType& omap 
00192       = bbGetDescriptor()->GetOutputDescriptorMap();                   
00193     BlackBoxDescriptor::OutputDescriptorMapType::const_iterator o; 
00194     for ( o = omap.begin(); o != omap.end(); ++o )
00195       {                                                 
00196         bbtkDebugMessage("Kernel",8,"* Allocate \""<<o->first<<"\""<<std::endl);
00197         // Redirect the connector to the internal box connector
00198         // Cast the BBOutputDescriptor into a ComplexBBOutputDescriptor
00199         ComplexBlackBoxOutputDescriptor* d = 
00200           (ComplexBlackBoxOutputDescriptor*)o->second;
00201         // Get the internal box connector
00202         BlackBoxOutputConnector* c = 
00203           bbUnsafeGetBlackBox ( d->GetTarget() )
00204           ->bbGetOutputConnectorMap()[ d->GetOutput() ];
00205 
00206         bbGetOutputConnectorMap()[o->second->GetName()] = c;
00207       }
00208     
00209     bbtkDebugDecTab("Kernel",8);  
00210   }

Here is the call graph for this function:

Here is the caller graph for this function:

void bbtk::ComplexBlackBox::bbDesallocateConnectors (  )  [protected]

Desallocates the i/o connectors of the black box.

Definition at line 216 of file bbtkComplexBlackBox.cxx.

References bbtkDebugDecTab, and bbtkDebugMessageInc.

Referenced by ~ComplexBlackBox().

00217   {
00218     bbtkDebugMessageInc("Kernel",8,
00219                         "ComplexBlackBox::DesallocateConnectors()"
00220                         <<std::endl);                                   
00221 
00222     // The connectors have not been allocated by the complex box 
00223     // but by the internal boxes. Hence **DO NOT** desallocate !
00224     // just clear the maps to avoid that 
00225     // BlackBox::bbDesallocateConnectors delete the connectors
00226     bbGetInputConnectorMap().clear();
00227     bbGetOutputConnectorMap().clear();
00228 
00229     bbtkDebugDecTab("Kernel",8);  
00230 
00231   }

Here is the caller graph for this function:


Friends And Related Function Documentation

friend struct Object::Deleter [friend]

Definition at line 60 of file bbtkComplexBlackBox.h.

friend class ComplexBlackBoxDescriptor [friend]

Definition at line 60 of file bbtkComplexBlackBox.h.


Member Data Documentation

ComplexBlackBoxDescriptor::Pointer bbtk::ComplexBlackBox::mLockedDescriptor [private]

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 190 of file bbtkComplexBlackBox.h.

Referenced by ComplexBlackBox().

ComplexBlackBoxDescriptor::WeakPointer bbtk::ComplexBlackBox::mDescriptor [private]

The descriptor pointer.

Definition at line 192 of file bbtkComplexBlackBox.h.

Referenced by ComplexBlackBox().

BlackBoxMapType bbtk::ComplexBlackBox::mBlackBoxMap [private]

ConnectionListType bbtk::ComplexBlackBox::mConnectionList [private]

std::vector<std::string> bbtk::ComplexBlackBox::mExecutionList [private]

The execution list.

Definition at line 204 of file bbtkComplexBlackBox.h.

Referenced by bbAddToExecutionList(), bbExecute(), and ComplexBlackBox().


The documentation for this class was generated from the following files:

Generated on Wed Nov 12 11:38:39 2008 for BBTK by  doxygen 1.5.6