bbtk::Connection Class Reference

DDD. More...

#include <bbtkConnection.h>

Inheritance diagram for bbtk::Connection:

Inheritance graph
[legend]
Collaboration diagram for bbtk::Connection:

Collaboration graph
[legend]

List of all members.

Public Types

typedef Connection Self
typedef boost::shared_ptr< SelfPointer
typedef boost::weak_ptr< SelfWeakPointer

Public Member Functions

std::string GetObjectName () const
std::string GetObjectInfo () const
size_t GetObjectSize () const
size_t GetObjectInternalSize () const
size_t GetObjectRecursiveSize () const
virtual IOStatus BackwardUpdate ()
 Dtor.
virtual void SetModifiedStatus ()
 Modified.
std::string GetFullName () const
BlackBoxPointer GetOriginalBlackBoxFrom () const
 Returns the original initial black box of the connection.
BlackBoxPointer GetOriginalBlackBoxTo () const
 Returns the origianl final black box of the connection.
const std::string & GetOriginalBlackBoxFromOutput () const
 Returns the original output of the initial black box of the connection.
const std::string & GetOriginalBlackBoxToInput () const
 Returns the original input of the final black box of the connection.
BlackBoxPointer GetBlackBoxFrom () const
 Returns the initial black box of the connection.
BlackBoxPointer GetBlackBoxTo () const
 Returns the final black box of the connection.
const std::string & GetBlackBoxFromOutput () const
 Returns the output of the initial black box of the connection.
const std::string & GetBlackBoxToInput () const
 Returns the input of the final black box of the connection.
void SetBlackBoxFrom (BlackBoxPointer b)
 Sets the initial black box of the connection.
void SetBlackBoxTo (BlackBoxPointer b)
 Sets the final black box of the connection.
void SetBlackBoxFromOutput (const std::string &o)
 Sets the output of the initial black box of the connection.
void SetBlackBoxToInput (const std::string &o)
 Sets the input of the final black box of the connection.
void Check () const
 Checks that the connection is ok (throws error if not).
long GetUseCount ()

Static Public Member Functions

static Pointer New (BlackBoxPointer from, const std::string &output, BlackBoxPointer to, const std::string &input, const FactoryPointer f)
static Pointer New (BlackBoxPointer from, const std::string &output, BlackBoxPointer to, const std::string &input)
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 ()

Protected Types

typedef Object Superclass

Protected Member Functions

 Connection ()
 Connection (const Connection &)
 ~Connection ()
 Dtor.
void TransferData ()
void LockThis ()
void UnLockThis ()
template<class U>
boost::shared_ptr< U > GetThisPointer () const

Static Protected Member Functions

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)

Protected Attributes

BlackBoxPointer mFrom
 Black box origin of the connection.
BlackBoxWeakPointer mOriginalFrom
std::string mOutput
 Output of mFrom which is connected.
std::string mOriginalOutput
BlackBoxPointer mTo
 Output connector of mFrom which is connected.
BlackBoxWeakPointer mOriginalTo
std::string mInput
 Input of mTo which is connected.
std::string mOriginalInput
BlackBoxPointer mAdaptor
 Input connector of mTo which is connected.
const FactoryWeakPointer mFactory
 The factory used to create adaptors.
bool mFromAny
 Is the connection input type is any<thing> ?
bool mToAny
 Is the connection output type is any<thing> ?
bool mDoDynamicCast
 Have to do dynamic_cast ?

Private Member Functions

 Connection (BlackBoxPointer from, const std::string &output, BlackBoxPointer to, const std::string &input, const FactoryPointer f)
 Ctor.
 Connection (BlackBoxPointer from, const std::string &output, BlackBoxPointer to, const std::string &input)
 Ctor.

Friends

struct Object::Deleter


Detailed Description

DDD.

Definition at line 69 of file bbtkConnection.h.


Member Typedef Documentation

typedef Connection bbtk::Connection::Self

Definition at line 71 of file bbtkConnection.h.

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

Reimplemented from bbtk::Object.

Definition at line 71 of file bbtkConnection.h.

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

Reimplemented from bbtk::Object.

Definition at line 71 of file bbtkConnection.h.

typedef Object bbtk::Connection::Superclass [protected]

Definition at line 71 of file bbtkConnection.h.


Constructor & Destructor Documentation

bbtk::Connection::Connection (  )  [protected]

bbtk::Connection::Connection ( const Connection  )  [protected]

bbtk::Connection::~Connection (  )  [protected]

Dtor.

Definition at line 296 of file bbtkConnection.cxx.

References bbtkDebugMessage, bbtkInternalError, GetFullName(), mAdaptor, mFrom, mInput, mOutput, and mTo.

00297   {
00298     bbtkDebugMessage("object",2,
00299                      "==> Connection::~Connection() ["
00300                      <<GetFullName()<<"]"<<std::endl);
00301 
00302     if (mAdaptor) mAdaptor.reset();
00303     if (mFrom!=0) 
00304       {
00305         mFrom->bbDisconnectOutput(mOutput,this);
00306         //                                GetThisPointer<Connection>());
00307         mFrom.reset();
00308       }
00309     else 
00310       {
00311         bbtkInternalError("Connection::~Connection() : invalid initial box pointer");
00312       }
00313     if (mTo!=0) 
00314       {
00315         mTo->bbDisconnectInput(mInput,this);//   GetThisPointer<Connection>());
00316         mTo.reset();
00317       }
00318     else 
00319       {
00320         bbtkInternalError("Connection::~Connection() : invalid final box pointer");
00321       }
00322 
00323 
00324     bbtkDebugMessage("object",2,
00325                      "<== Connection::~Connection() ["
00326                      <<GetFullName()<<"]"<<std::endl);
00327   }

Here is the call graph for this function:

bbtk::Connection::Connection ( BlackBoxPointer  from,
const std::string &  output,
BlackBoxPointer  to,
const std::string &  input,
const FactoryPointer  f 
) [private]

Ctor.

bbtk::Connection::Connection ( BlackBoxPointer  from,
const std::string &  output,
BlackBoxPointer  to,
const std::string &  input 
) [private]

Ctor.


Member Function Documentation

std::string bbtk::Connection::GetObjectName (  )  const [virtual]

Reimplemented from bbtk::Object.

Definition at line 633 of file bbtkConnection.cxx.

References GetFullName().

00634   {
00635     std::string s("Connection '");
00636     s += GetFullName();
00637     s += "'";
00638     return s;
00639   }

Here is the call graph for this function:

std::string bbtk::Connection::GetObjectInfo (  )  const [virtual]

Reimplemented from bbtk::Object.

Definition at line 643 of file bbtkConnection.cxx.

References bbtk::i.

00644   {
00645     std::stringstream i;
00646     return i.str();
00647   }

size_t bbtk::Connection::GetObjectSize (  )  const [virtual]

Reimplemented from bbtk::Object.

Definition at line 651 of file bbtkConnection.cxx.

00652 {
00653   size_t s = Superclass::GetObjectSize();
00654   s += Connection::GetObjectInternalSize();
00655   return s;
00656   }

size_t bbtk::Connection::GetObjectInternalSize (  )  const [virtual]

Reimplemented from bbtk::Object.

Definition at line 659 of file bbtkConnection.cxx.

00660 {
00661   size_t s = sizeof(Connection);
00662   return s;
00663   }

size_t bbtk::Connection::GetObjectRecursiveSize (  )  const [virtual]

Reimplemented from bbtk::Object.

Definition at line 666 of file bbtkConnection.cxx.

00667   {
00668     size_t s = Superclass::GetObjectRecursiveSize();
00669     s += Connection::GetObjectInternalSize();
00670     return s;
00671   }

static Pointer bbtk::Connection::New ( BlackBoxPointer  from,
const std::string &  output,
BlackBoxPointer  to,
const std::string &  input,
const FactoryPointer  f 
) [static]

static Pointer bbtk::Connection::New ( BlackBoxPointer  from,
const std::string &  output,
BlackBoxPointer  to,
const std::string &  input 
) [static]

IOStatus bbtk::Connection::BackwardUpdate (  )  [virtual]

Dtor.

Backward Update.

Amont direction pipeline processing 1) call bbBackwardUpdate(this) on the upstream box 2) copies the upstream box output to the downstream box input adapting it if needed

Definition at line 332 of file bbtkConnection.cxx.

References bbtkDebugMessage, GetFullName(), mAdaptor, mFrom, bbtk::MODIFIED, TransferData(), and bbtk::UPTODATE.

Referenced by bbtk::BlackBoxInputConnector::BackwardUpdate().

00333   {
00334     bbtkDebugMessage("process",5,
00335                      "===> Connection::BackwardUpdate() ["
00336                      <<GetFullName()<<"]"<<std::endl);
00337 
00338     IOStatus s = UPTODATE;
00339     s = mFrom->bbBackwardUpdate(GetThisPointer<Connection>());
00340 
00341     TransferData();
00342 
00343     if (mAdaptor && (s==MODIFIED)) mAdaptor->bbSetModifiedStatus();
00344 
00345     bbtkDebugMessage("process",5,
00346                      "<=== Connection::BackwardUpdate() ["
00347                      <<GetFullName()<<"]"<<std::endl);
00348     return s;
00349   }

Here is the call graph for this function:

Here is the caller graph for this function:

void bbtk::Connection::SetModifiedStatus (  )  [virtual]

Modified.

Aval direction pipeline processing : 1) copies the upstream box output to the downstream box input adapting it if needed 2) call bbForwardUpdate(this) on the downstream box

Definition at line 486 of file bbtkConnection.cxx.

References bbtkDebugMessage, GetFullName(), mAdaptor, mInput, and mTo.

00487   {
00488     bbtkDebugMessage("modified",2,
00489                      "==> Connection::SetModifiedStatus() ["
00490                      <<GetFullName()<<"]"<<std::endl);
00491     
00492     if (mAdaptor) mAdaptor->bbSetModifiedStatus();
00493     
00494     mTo->bbSetModifiedStatus(  mTo->bbGetInputConnectorMap().find(mInput)->second );
00495     
00496     /*
00497     bbtkDebugMessage("modified",2,
00498                      "==> Connection::SetModifiedStatus() ["
00499                      <<GetFullName()<<"]"<<std::endl);
00500     */
00501   }

Here is the call graph for this function:

std::string bbtk::Connection::GetFullName (  )  const

Definition at line 506 of file bbtkConnection.cxx.

References mFrom, mInput, mOriginalFrom, mOriginalInput, mOriginalOutput, mOriginalTo, mOutput, and mTo.

Referenced by BackwardUpdate(), bbtk::ComplexBlackBox::bbConnectInput(), bbtk::BlackBox::bbConnectInput(), bbtk::ComplexBlackBox::bbConnectOutput(), bbtk::BlackBox::bbConnectOutput(), bbtk::BlackBox::bbDisconnectInput(), bbtk::BlackBox::bbDisconnectOutput(), Check(), GetObjectName(), SetModifiedStatus(), TransferData(), and ~Connection().

00506                                           {
00507     if (mFrom && mTo) 
00508       {
00509         std::string res = mFrom->bbGetName()+"."+mOutput+"--"
00510           +mTo->bbGetName()+"."+mInput;
00511         if ((!mOriginalFrom.expired()) && (!mOriginalTo.expired()) &&
00512             ((mFrom!=mOriginalFrom.lock())||(mTo!=mOriginalTo.lock())))
00513           {
00514             res += "("+mOriginalFrom.lock()->bbGetName()
00515               +"."+mOriginalOutput+"--"
00516               + mOriginalTo.lock()->bbGetName()+"."+mOriginalInput+")";
00517           }
00518         return res;
00519       }
00520     return "***Invalid Connection***";
00521   }

Here is the caller graph for this function:

BlackBoxPointer bbtk::Connection::GetOriginalBlackBoxFrom (  )  const [inline]

Returns the original initial black box of the connection.

Definition at line 99 of file bbtkConnection.h.

Referenced by bbtk::BlackBox::bbShowRelations(), bbtk::ComplexBlackBox::bbWriteDotFileBlackBox(), and bbtk::BlackBox::bbWriteDotFileBlackBox().

00099 { return mOriginalFrom.lock(); }

Here is the caller graph for this function:

BlackBoxPointer bbtk::Connection::GetOriginalBlackBoxTo (  )  const [inline]

Returns the origianl final black box of the connection.

Definition at line 101 of file bbtkConnection.h.

Referenced by bbtk::ComplexBlackBox::bbWriteDotFileBlackBox(), and bbtk::BlackBox::bbWriteDotFileBlackBox().

00101 { return mOriginalTo.lock(); }

Here is the caller graph for this function:

const std::string& bbtk::Connection::GetOriginalBlackBoxFromOutput (  )  const [inline]

Returns the original output of the initial black box of the connection.

Definition at line 103 of file bbtkConnection.h.

Referenced by bbtk::BlackBox::bbShowRelations(), bbtk::ComplexBlackBox::bbWriteDotFileBlackBox(), and bbtk::BlackBox::bbWriteDotFileBlackBox().

00103 { return mOriginalOutput; }

Here is the caller graph for this function:

const std::string& bbtk::Connection::GetOriginalBlackBoxToInput (  )  const [inline]

Returns the original input of the final black box of the connection.

Definition at line 105 of file bbtkConnection.h.

Referenced by bbtk::ComplexBlackBox::bbWriteDotFileBlackBox(), and bbtk::BlackBox::bbWriteDotFileBlackBox().

00105 { return mOriginalInput; }

Here is the caller graph for this function:

BlackBoxPointer bbtk::Connection::GetBlackBoxFrom (  )  const [inline]

Returns the initial black box of the connection.

Definition at line 108 of file bbtkConnection.h.

00108 { return mFrom; }

BlackBoxPointer bbtk::Connection::GetBlackBoxTo (  )  const [inline]

Returns the final black box of the connection.

Definition at line 110 of file bbtkConnection.h.

00110 { return mTo; }

const std::string& bbtk::Connection::GetBlackBoxFromOutput (  )  const [inline]

Returns the output of the initial black box of the connection.

Definition at line 112 of file bbtkConnection.h.

00112 { return mOutput; }

const std::string& bbtk::Connection::GetBlackBoxToInput (  )  const [inline]

Returns the input of the final black box of the connection.

Definition at line 114 of file bbtkConnection.h.

00114 { return mInput; }

void bbtk::Connection::SetBlackBoxFrom ( BlackBoxPointer  b  )  [inline]

Sets the initial black box of the connection.

Definition at line 117 of file bbtkConnection.h.

Referenced by bbtk::ComplexBlackBox::bbConnectOutput().

00117 { mFrom = b; }

Here is the caller graph for this function:

void bbtk::Connection::SetBlackBoxTo ( BlackBoxPointer  b  )  [inline]

Sets the final black box of the connection.

Definition at line 119 of file bbtkConnection.h.

Referenced by bbtk::ComplexBlackBox::bbConnectInput().

00119 { mTo = b; }

Here is the caller graph for this function:

void bbtk::Connection::SetBlackBoxFromOutput ( const std::string &  o  )  [inline]

Sets the output of the initial black box of the connection.

Definition at line 121 of file bbtkConnection.h.

Referenced by bbtk::ComplexBlackBox::bbConnectOutput().

00121 { mOutput = o; }

Here is the caller graph for this function:

void bbtk::Connection::SetBlackBoxToInput ( const std::string &  o  )  [inline]

Sets the input of the final black box of the connection.

Definition at line 123 of file bbtkConnection.h.

Referenced by bbtk::ComplexBlackBox::bbConnectInput().

00123 { mInput = o; }

Here is the caller graph for this function:

void bbtk::Connection::Check (  )  const

Checks that the connection is ok (throws error if not).

Definition at line 525 of file bbtkConnection.cxx.

References bbtkError, bbtkMessage, GetFullName(), bbtk::i, mFrom, mInput, mOutput, and mTo.

00526   {
00527     bbtkMessage("debug",1,"** Checking Connection "<<(void*)this<<" ["<<GetFullName()<<"]"
00528                 <<std::endl);
00529     if (mFrom==0) 
00530       {
00531         bbtkMessage("debug",2," - From = 0"<<std::endl);
00532       }
00533     else
00534       {
00535         bbtkMessage("debug",2," - From : "<<mFrom->bbGetFullName()<<std::endl);
00536         if (!mFrom->bbHasOutput(mOutput))
00537           {
00538             bbtkError("** Checking Connection "<<(void*)this
00539                        <<" ["<<GetFullName()<<"] : "
00540                       << mFrom->bbGetFullName()<<" does not have output '"
00541                       <<mOutput<<"'");
00542           }     
00543         bbtkMessage("debug",2," - From : Output '"<<mOutput<<"' exists"<<std::endl);
00544         BlackBox::OutputConnectorMapType::const_iterator i 
00545           = mFrom->bbGetOutputConnectorMap().find(mOutput);
00546         if (i== mFrom->bbGetOutputConnectorMap().end())
00547           {
00548              bbtkError("** Checking Connection "<<(void*)this
00549                        <<" ["<<GetFullName()<<"] : "
00550                        <<mFrom->bbGetFullName()<<" output '"
00551                        <<mOutput<<"' is not in OutputConnectorMap");
00552           }
00553         bbtkMessage("debug",2," - From : Output '"<<mOutput
00554                     <<"' is in OutputConnectorMap"<<std::endl);
00555 
00556         std::vector< Connection* >::const_iterator j;
00557         /*
00558         for (j  = i->second->GetConnectionVector().begin();
00559              j != i->second->GetConnectionVector().end();
00560              ++j)
00561           {
00562             if ((*j)==this) break;
00563           }
00564         */
00565         j = find(i->second->GetConnectionVector().begin(),
00566                  i->second->GetConnectionVector().end(),
00567                  this);
00568        
00569         if (j==i->second->GetConnectionVector().end())
00570           {
00571             bbtkError("** Checking Connection "<<(void*)this
00572                       <<" ["<<GetFullName()<<"] : "
00573                       << "Connection ["<<GetFullName()<<"] : "
00574                       <<" OutputConnector '"
00575                       <<mOutput<<"' of "<<mFrom->bbGetFullName()
00576                       <<" does not point to this connection");
00577             
00578           }
00579         bbtkMessage("debug",2," - From : This connection is in OutputConnector connection vector"<<std::endl);
00580         bbtkMessage("debug",2," * Box from : Check successfull"<<std::endl);
00581 
00582       }
00583 
00584     if (mTo==0) 
00585       {
00586         bbtkMessage("debug",2," - To   = 0"<<std::endl);
00587       }
00588     else
00589       {
00590         bbtkMessage("debug",2," - To   : "<<mTo->bbGetName()<<std::endl);
00591         //      std::cout << mTo << std::endl;
00592         //      std::cout << mTo->bbGetDescriptor() << std::endl;
00593         //      std::cout << mTo->bbGetDescriptor()->GetTypeName() << std::endl;
00594         //      mTo->bbGetFullName();
00595         bbtkMessage("debug",2," - To   : "<<mTo->bbGetFullName()<<std::endl);
00596         if (!mTo->bbHasInput(mInput))
00597           {
00598             bbtkError("** Checking Connection "<<(void*)this
00599                       <<" ["<<GetFullName()<<"] : "
00600                       <<mTo->bbGetFullName()<<" does not have input '"
00601                       <<mInput<<"'");
00602           }     
00603         bbtkMessage("debug",2," - To   : Input '"<<mInput<<"' exists"<<std::endl);
00604         BlackBox::InputConnectorMapType::const_iterator i 
00605           = mTo->bbGetInputConnectorMap().find(mInput);
00606         if (i== mTo->bbGetInputConnectorMap().end())
00607           {
00608              bbtkError("** Checking Connection "<<(void*)this
00609                        <<" ["<<GetFullName()<<"] : "
00610                        <<mTo->bbGetFullName()<<" input '"
00611                        <<mInput<<"' is not in InputConnectorMap");
00612           }
00613         bbtkMessage("debug",2," - To   : Input '"<<mInput
00614                     <<"' is in InputConnectorMap"<<std::endl);
00615 
00616         if (i->second->GetConnection()==0)
00617           {
00618             bbtkError("** Checking Connection "<<(void*)this
00619                       <<" ["<<GetFullName()<<"] : "
00620                       <<"Connection "<<GetFullName()<<" : "
00621                       <<" InputConnector '"
00622                       <<mInput<<"' of "<<mTo->bbGetFullName()
00623                       <<" does not point to this connection");
00624     
00625           }
00626         bbtkMessage("debug",2," - To   : This connection is in InputConnector connection vector"<<std::endl);
00627         bbtkMessage("debug",2," * Box to   : Check successfull"<<std::endl);
00628 
00629       }
00630   }

Here is the call graph for this function:

void bbtk::Connection::TransferData (  )  [protected]

Ctor with the black box from and to and their input and output and a dummy int to differentiate from the public constructor. Sets the members but does not test compatibility (used by bbtk::AdaptiveConnection)

Transfers the data from the source output to the target input doing necessary conversions (adaptation or pointer cast)

Definition at line 374 of file bbtkConnection.cxx.

References bbtkDebugMessage, bbtkDebugMessageInc, bbtkError, GetFullName(), bbtk::HumanTypeName(), mAdaptor, mFactory, mFrom, mFromAny, mInput, mOutput, mTo, and mToAny.

Referenced by BackwardUpdate().

00375   {
00376     bbtkDebugMessageInc("data",3,
00377                         "Connection::TransferData() ["
00378                         <<GetFullName()<<"]"<<std::endl);
00379     
00380     
00381     // If an adaptor was created we need to adapt the data
00382     if (mAdaptor) 
00383       {
00384         mAdaptor->bbSetInput("In",mFrom->bbGetOutput(mOutput),false);
00385         mAdaptor->bbExecute();
00386         // LG : Connection Update does not set mTo as modified
00387         mTo->bbSetInput(mInput, mAdaptor->bbGetOutput("Out"),false);
00388         
00389       }
00390     // If no adaptor but source type is an any and target is not an any
00391     else if ( mFromAny && (! mToAny) )
00392       {
00393         bbtkDebugMessage("data",3,
00394                          " * Source type is an "
00395                          <<HumanTypeName<Data>()
00396                          <<" which contains a <"
00397                          <<HumanTypeName(mFrom->bbGetOutput(mOutput).type())
00398                          <<">"<<std::endl);
00399         bbtkDebugMessage("data",3,
00400                          " * Target type is <"
00401                          <<HumanTypeName(mTo->bbGetInputType(mInput))
00402                          <<">"<<std::endl);
00403         
00404         // 1) Test strict type matching between any content and target
00405         if (mFrom->bbGetOutput(mOutput)
00406             .contains( mTo->bbGetInputType(mInput) ) )
00407           {
00408             bbtkDebugMessage("data",3,
00409                              " -> Equal types : transfer ok"<<std::endl);
00410             mTo->bbSetInput( mInput, 
00411                              mFrom->bbGetOutput(mOutput),
00412                              false);
00413           }
00414         else 
00415           {
00416             // 2) Look for an adaptor
00417             bbtk::BlackBox::Pointer adaptor;
00418             try 
00419               {
00420                 adaptor = mFactory.lock()
00421                   ->NewAdaptor(mFrom->bbGetOutput(mOutput).type(),
00422                                mTo->bbGetInputType(mInput),
00423                                "");
00424               }
00425             catch (...)
00426               {
00427               }
00428             if (adaptor)  
00429               {
00430                 bbtkDebugMessage("data",3," -> Adaptor found : using it"
00431                                  <<std::endl);
00432                   adaptor->bbSetInput("In",mFrom->bbGetOutput(mOutput),false);
00433                 adaptor->bbExecute();
00434                 // LG : Connection Update does not set mTo as modified
00435                 mTo->bbSetInput(mInput, adaptor->bbGetOutput("Out"),false);
00436                 //      adaptor->bbDelete();
00437               }
00438             // 3) If no adaptor found but the any content is a pointer
00439             //    and target type is also a pointer : we try run-time cast
00440             else if ( (mFrom->bbGetOutput(mOutput).contains_pointer()) &&
00441                       (mTo->bbGetDescriptor()->GetInputDescriptor(mInput)
00442                        ->IsPointerType()) )
00443               {
00444                 bbtkDebugMessage("data",3,
00445                                  " -> No adaptor found but source and target types are both pointers : trying up or down cast"<<std::endl);
00446                 
00447                 void* nptr = 
00448                   mFrom->bbGetOutput(mOutput)
00449                   .get_pointer_to(mTo->bbGetInput(mInput).pointed_type());
00450                 if (!nptr)  
00451                   {
00452                     bbtkError("Connection '"
00453                               <<GetFullName()
00454                               <<"' : <"
00455                               <<HumanTypeName(mFrom->bbGetOutput(mOutput).type())
00456                               <<"> to <"
00457                               <<HumanTypeName(mTo->bbGetInputType(mInput))
00458                               <<"> : no adaptor available and run-time up and down cast failed");
00459                   }
00460                 mTo->bbBruteForceSetInputPointer(mInput, nptr, false);
00461               }
00462             // 4) Nothing worked : error
00463             else 
00464               {
00465                 bbtkError("Connection '"<<GetFullName()<<"' "
00466                           <<"no adaptor found to convert <"
00467                           <<HumanTypeName(mFrom->bbGetOutput(mOutput).type())
00468                           <<"> to <"
00469                           <<HumanTypeName(mTo->bbGetInputType(mInput))<<">");
00470               }
00471           }
00472       }
00473     // EO : mFromAny && ! mToAny
00474     // Default case : types are the same; we use simple get-set
00475     else 
00476       {
00477         // LG : Connection Update does not set mTo as modified
00478         mTo->bbSetInput(mInput, mFrom->bbGetOutput(mOutput),false);
00479       }
00480 
00481   }

Here is the call graph for this function:

Here is the caller graph for this function:

long bbtk::Object::GetUseCount (  )  [inline, inherited]

Definition at line 63 of file bbtkObject.h.

00063 { return mThisPointer.use_count(); }

void bbtk::Object::InsertInObjectList ( Pointer  p  )  [static, inherited]

Definition at line 59 of file bbtkObject.cxx.

References bbtkDebugMessage, and bbtk::Object::mgObjectList.

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::RemoveFromObjectList ( WeakPointer  p  )  [static, inherited]

Definition at line 80 of file bbtkObject.cxx.

References bbtkDebugMessage, and bbtk::Object::mgObjectList.

00081   { 
00082     bbtkDebugMessage("object",9,"##> Object::RemoveFromObjectList()"
00083                      <<std::endl);
00084     mgObjectList.erase(p);
00085 
00086   }

void bbtk::Object::InsertInPackageList ( Pointer  p  )  [static, inherited]

Definition at line 69 of file bbtkObject.cxx.

References bbtkDebugMessage, and bbtk::Object::mgPackageList.

00070   { 
00071     bbtkDebugMessage("object",9,"##> Object::InsertInPackageList(\""
00072                      <<p->GetObjectName()<<"\" ["<<p<<"])"<<std::endl);
00073     boost::weak_ptr<Object> w(p);
00074     mgPackageList.insert(w); 
00075   }

void bbtk::Object::ReleasePackages (  )  [static, inherited]

Definition at line 213 of file bbtkObject.cxx.

References bbtkDebugMessage, bbtk::i, and bbtk::Object::mgPackageList.

00214   {
00215     bbtkDebugMessage("object",1,"##> Object::ReleasePackages()"<<std::endl);
00216     // Release package pointers
00217     ObjectListType::iterator i;
00218     for (i = mgPackageList.begin();
00219          i!= mgPackageList.end();
00220          ++i)
00221       {
00222         if (i->use_count() != 0) 
00223           { 
00224             bbtkDebugMessage("object",1,"##> Releasing package '"<<
00225                              i->lock()->GetThisPointer<Package>()->GetName()
00226                              <<"'"<<std::endl);
00227             //      Object::Pointer p(i->lock());
00228             Package::WeakPointer w(i->lock()->GetThisPointer<Package>());
00229             Package::Release(w);
00230             /*
00231             if (p->GetObjectName().find(name) != std::string::npos ) 
00232               {
00233                 std::cout << n << "/" << mgObjectList.size() << " ";
00234                 PrintObjectInfo(p);
00235                 m += p->GetObjectSize();
00236                 n++;
00237               }
00238             */
00239           }
00240       }  
00241 
00242   }

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().

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. destroyed without removing itself from the living objects list ! (this is just an implementation error not a memory leak)"<<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. destroyed without removing themselves from the living objects list ! (this is just an implementation error not a memory leak)"<<std::endl;
00150       }
00151     std::cout
00152       << "============ EO Living bbtk::Object pointers ========="<<std::endl;
00153         
00154   }

Here is the call graph for this function:

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   }

Here is the caller graph for this function:

static long bbtk::Object::GetObjectsCount (  )  [inline, static, inherited]

Definition at line 75 of file bbtkObject.h.

00075 { return mgObjectList.size(); }

void bbtk::Object::LockThis (  )  [inline, protected, inherited]

Definition at line 88 of file bbtkObject.h.

00088 { mThisPointerLocked = mThisPointer.lock(); }   

void bbtk::Object::UnLockThis (  )  [inline, protected, inherited]

Definition at line 89 of file bbtkObject.h.

00089 { mThisPointerLocked = Pointer(); }

template<class U>
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     }

template<class U>
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.

Referenced by bbtk::Executer::Executer(), bbtk::Interpreter::Init(), bbtk::Transcriptor::New(), bbtk::Package::New(), bbtk::Interpreter::New(), bbtk::Factory::New(), and bbtk::Executer::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     }                                                                   

Here is the caller graph for this function:

template<class U, class D>
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.

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     }                                                                   


Friends And Related Function Documentation

friend struct Object::Deleter [friend]

Definition at line 71 of file bbtkConnection.h.


Member Data Documentation

BlackBoxPointer bbtk::Connection::mFrom [protected]

Black box origin of the connection.

Definition at line 130 of file bbtkConnection.h.

Referenced by BackwardUpdate(), Check(), GetFullName(), TransferData(), and ~Connection().

BlackBoxWeakPointer bbtk::Connection::mOriginalFrom [protected]

Definition at line 131 of file bbtkConnection.h.

Referenced by GetFullName().

std::string bbtk::Connection::mOutput [protected]

Output of mFrom which is connected.

Definition at line 133 of file bbtkConnection.h.

Referenced by Check(), GetFullName(), TransferData(), and ~Connection().

std::string bbtk::Connection::mOriginalOutput [protected]

Definition at line 134 of file bbtkConnection.h.

Referenced by GetFullName().

BlackBoxPointer bbtk::Connection::mTo [protected]

Output connector of mFrom which is connected.

Black box destination of the connection

Definition at line 138 of file bbtkConnection.h.

Referenced by Check(), GetFullName(), SetModifiedStatus(), TransferData(), and ~Connection().

BlackBoxWeakPointer bbtk::Connection::mOriginalTo [protected]

Definition at line 139 of file bbtkConnection.h.

Referenced by GetFullName().

std::string bbtk::Connection::mInput [protected]

Input of mTo which is connected.

Definition at line 141 of file bbtkConnection.h.

Referenced by Check(), GetFullName(), SetModifiedStatus(), TransferData(), and ~Connection().

std::string bbtk::Connection::mOriginalInput [protected]

Definition at line 142 of file bbtkConnection.h.

Referenced by GetFullName().

BlackBoxPointer bbtk::Connection::mAdaptor [protected]

Input connector of mTo which is connected.

Adaptor black box if needed

Definition at line 146 of file bbtkConnection.h.

Referenced by BackwardUpdate(), SetModifiedStatus(), TransferData(), and ~Connection().

const FactoryWeakPointer bbtk::Connection::mFactory [protected]

The factory used to create adaptors.

Definition at line 149 of file bbtkConnection.h.

Referenced by TransferData().

bool bbtk::Connection::mFromAny [protected]

Is the connection input type is any<thing> ?

Definition at line 152 of file bbtkConnection.h.

Referenced by TransferData().

bool bbtk::Connection::mToAny [protected]

Is the connection output type is any<thing> ?

Definition at line 155 of file bbtkConnection.h.

Referenced by TransferData().

bool bbtk::Connection::mDoDynamicCast [protected]

Have to do dynamic_cast ?

Definition at line 159 of file bbtkConnection.h.


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

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