#include <bbtkBlackBoxOutputConnector.h>
Classes | |
class | Pimpl |
The Pimpl. More... | |
Public Types | |
typedef BlackBox::OutputChangeCallbackType | OutputChangeCallbackType |
typedef std::vector< Connection * > | ConnectionVector |
The type of vector of output connections. | |
Public Member Functions | |
BlackBoxOutputConnector (BlackBoxPointer b) | |
Ctor. | |
~BlackBoxOutputConnector () | |
Dtor. | |
void | SetConnection (Connection *c) |
Sets a connection. | |
void | UnsetConnection (Connection *c) |
Unsets the connection. | |
const ConnectionVector & | GetConnectionVector () const |
Returns the vector of connection plugged into this output (const). | |
IOStatus | GetStatus () const |
Returns the status of the input. | |
void | SetStatus (IOStatus s) |
Sets the status of the input. | |
void | SignalChange (BlackBox::Pointer box, const std::string &output) |
Signals the change observers that the output has changed. | |
void | AddChangeObserver (OutputChangeCallbackType f) |
void | RemoveChangeObserver (OutputChangeCallbackType f) |
Private Member Functions | |
void | PimplConstruct () |
void | PimplCopyConstruct (const BlackBoxOutputConnector &) |
void | PimplDestruct () |
BlackBoxOutputConnector (const BlackBoxOutputConnector &) | |
Purposedly not implemented. | |
Private Attributes | |
Pimpl * | p |
Definition at line 55 of file bbtkBlackBoxOutputConnector.h.
typedef std::vector<Connection*> bbtk::BlackBoxOutputConnector::ConnectionVector |
The type of vector of output connections.
Definition at line 72 of file bbtkBlackBoxOutputConnector.h.
Definition at line 60 of file bbtkBlackBoxOutputConnector.h.
bbtk::BlackBoxOutputConnector::BlackBoxOutputConnector | ( | BlackBoxPointer | b | ) |
Ctor.
bbtk::BlackBoxOutputConnector::~BlackBoxOutputConnector | ( | ) |
Dtor.
Definition at line 83 of file bbtkBlackBoxOutputConnector.cxx.
References bbtkDebugMessage, bbtk::BlackBoxOutputConnector::Pimpl::mConnection, p, and PimplDestruct().
00084 { 00085 bbtkDebugMessage("kernel",9, 00086 "[DEAD BOX] ==> ~BlackBoxOutputConnector()" 00087 <<std::endl); 00088 /* 00089 ConnectionVector::iterator i; 00090 for (i=mConnection.begin(); 00091 i!=mConnection.end(); 00092 ++i) 00093 (*i) = Connection::WeakPointer(); 00094 */ 00095 p->mConnection.clear(); 00096 PimplDestruct(); 00097 00098 bbtkDebugMessage("kernel",9, 00099 "[DEAD BOX] <== ~BlackBoxOutputConnector()" 00100 <<std::endl); 00101 }
bbtk::BlackBoxOutputConnector::BlackBoxOutputConnector | ( | const BlackBoxOutputConnector & | ) | [private] |
Purposedly not implemented.
void bbtk::BlackBoxOutputConnector::AddChangeObserver | ( | OutputChangeCallbackType | f | ) |
Adds the function f to the list of functions to call when the output changes.
Definition at line 209 of file bbtkBlackBoxOutputConnector.cxx.
References bbtk::BlackBoxOutputConnector::Pimpl::mChangeSignal, and p.
Referenced by bbtk::BlackBox::bbAddOutputObserver().
00210 { 00211 // std::cout << "BlackBoxOutputConnector::AddChangeObserver" << std::endl; 00212 p->mChangeSignal.connect(f); 00213 }
const BlackBoxOutputConnector::ConnectionVector & bbtk::BlackBoxOutputConnector::GetConnectionVector | ( | ) | const |
Returns the vector of connection plugged into this output (const).
Definition at line 158 of file bbtkBlackBoxOutputConnector.cxx.
References bbtk::BlackBoxOutputConnector::Pimpl::mConnection, and p.
00159 { 00160 return p->mConnection; 00161 }
IOStatus bbtk::BlackBoxOutputConnector::GetStatus | ( | ) | const |
Returns the status of the input.
Definition at line 166 of file bbtkBlackBoxOutputConnector.cxx.
References bbtk::BlackBoxOutputConnector::Pimpl::mStatus, and p.
void bbtk::BlackBoxOutputConnector::PimplConstruct | ( | ) | [private] |
Definition at line 66 of file bbtkBlackBoxOutputConnector.cxx.
void bbtk::BlackBoxOutputConnector::PimplCopyConstruct | ( | const BlackBoxOutputConnector & | o | ) | [private] |
Definition at line 66 of file bbtkBlackBoxOutputConnector.cxx.
void bbtk::BlackBoxOutputConnector::PimplDestruct | ( | ) | [private] |
Definition at line 66 of file bbtkBlackBoxOutputConnector.cxx.
References bbtkDebugMessage.
Referenced by ~BlackBoxOutputConnector().
void bbtk::BlackBoxOutputConnector::RemoveChangeObserver | ( | OutputChangeCallbackType | f | ) |
Removes the function f from the list of functions to call when the output changes (TO WRITE)
Removes the function f from the list of functions to call when the output changes (TO WRITE)
Definition at line 219 of file bbtkBlackBoxOutputConnector.cxx.
References bbtkError.
00220 { 00221 bbtkError("BlackBoxOutputConnector::RemoveChangeObserver not implemented"); 00222 00223 //mChangeSignal.disconnect(f); 00224 }
void bbtk::BlackBoxOutputConnector::SetConnection | ( | Connection * | c | ) |
Sets a connection.
Definition at line 106 of file bbtkBlackBoxOutputConnector.cxx.
References bbtkDebugMessage, bbtk::BlackBoxOutputConnector::Pimpl::mBox, bbtk::BlackBoxOutputConnector::Pimpl::mConnection, and p.
00107 { 00108 bbtkDebugMessage("kernel",9, 00109 "["<<p->mBox.lock()->bbGetName() 00110 <<"] BlackBoxOutputConnector::SetConnection(" 00111 <<c<<")"<<std::endl); 00112 p->mConnection.push_back(c); 00113 // AddChangeObserver(boost::bind(&Connection::SignalChange,c)); 00114 }
void bbtk::BlackBoxOutputConnector::SetStatus | ( | IOStatus | s | ) |
Sets the status of the input.
Definition at line 174 of file bbtkBlackBoxOutputConnector.cxx.
References bbtk::BlackBoxOutputConnector::Pimpl::mStatus, and p.
void bbtk::BlackBoxOutputConnector::SignalChange | ( | BlackBox::Pointer | box, | |
const std::string & | output | |||
) |
Signals the change observers that the output has changed.
Definition at line 181 of file bbtkBlackBoxOutputConnector.cxx.
References bbtkDebugMessage, bbtk::GetIOStatusString(), bbtk::BlackBoxOutputConnector::Pimpl::mChangeSignal, bbtk::OUTOFDATE, and p.
00183 { 00184 IOStatus s = OUTOFDATE; //mStatus; 00185 //if (s==UPTODATE) s=MODIFIED; 00186 00187 bbtkDebugMessage("change",2, 00188 "["<<box->bbGetName() 00189 <<"] ==> BlackBoxOutputConnector::SignalChange('" 00190 <<output<<"','"<<GetIOStatusString(s)<<"') [" 00191 <<this<<"]" 00192 <<std::endl); 00193 00194 // std::cout<<"BlackBoxOutputConnector::SignalChange(" 00195 // <<box->bbGetName()<<",'" 00196 // <<output<<"')"<<std::endl; 00197 p->mChangeSignal(box,output,s); 00198 00199 bbtkDebugMessage("change",2, 00200 "["<<box->bbGetName() 00201 <<"] <== BlackBoxOutputConnector::SignalChange('" 00202 <<output<<"','"<<GetIOStatusString(s)<<"') [" 00203 <<this<<"]" 00204 <<std::endl); 00205 }
void bbtk::BlackBoxOutputConnector::UnsetConnection | ( | Connection * | c | ) |
Unsets the connection.
Definition at line 119 of file bbtkBlackBoxOutputConnector.cxx.
References bbtkDebugMessage, bbtkInternalError, bbtk::i, bbtk::BlackBoxOutputConnector::Pimpl::mBox, bbtk::BlackBoxOutputConnector::Pimpl::mConnection, and p.
00120 { 00121 bbtkDebugMessage("kernel",9,"["<<p->mBox.lock()->bbGetName() 00122 <<"] BlackBoxOutputConnector::UnsetConnection(" 00123 <<c<<")"<<std::endl); 00124 00125 if (!c) 00126 { 00127 bbtkInternalError(p->mBox.lock()->bbGetFullName() 00128 <<": BlackBoxOutputConnector::UnsetConnection(" 00129 <<c<<") : invalid connection"); 00130 00131 } 00132 // c->Check(); 00133 //Connection::WeakPointer w(c); 00134 ConnectionVector::iterator i; 00135 // = find(mConnection.begin(),mConnection.end(),c); 00136 for (i=p->mConnection.begin(); 00137 i!=p->mConnection.end(); 00138 ++i) 00139 { 00140 if (*i==c) break; 00141 } 00142 if (i==p->mConnection.end()) 00143 { 00144 bbtkInternalError(p->mBox.lock()->bbGetFullName() 00145 <<": BlackBoxOutputConnector::UnsetConnection(" 00146 <<c 00147 <<") : connection is absent from connections list"); 00148 } 00149 p->mConnection.erase(i); 00150 // RemoveChangeObserver(boost::bind(&Connection::SignalChange,c)); 00151 00152 00153 }
Pimpl* bbtk::BlackBoxOutputConnector::p [private] |
Definition at line 94 of file bbtkBlackBoxOutputConnector.h.
Referenced by AddChangeObserver(), GetConnectionVector(), GetStatus(), SetConnection(), SetStatus(), SignalChange(), UnsetConnection(), and ~BlackBoxOutputConnector().