2 # ---------------------------------------------------------------------
4 # Copyright (c) CREATIS (Centre de Recherche en Acquisition et Traitement de l'Image
6 # Authors : Eduardo Davila, Frederic Cervenansky, Claire Mouton
7 # Previous Authors : Laurent Guigues, Jean-Pierre Roux
8 # CreaTools website : www.creatis.insa-lyon.fr/site/fr/creatools_accueil
10 # This software is governed by the CeCILL-B license under French law and
11 # abiding by the rules of distribution of free software. You can use,
12 # modify and/ or redistribute the software under the terms of the CeCILL-B
13 # license as circulated by CEA, CNRS and INRIA at the following URL
14 # http://www.cecill.info/licences/Licence_CeCILL-B_V1-en.html
15 # or in the file LICENSE.txt.
17 # As a counterpart to the access to the source code and rights to copy,
18 # modify and redistribute granted by the license, users are provided only
19 # with a limited warranty and the software's author, the holder of the
20 # economic rights, and the successive licensors have only limited
23 # The fact that you are presently reading this means that you have had
24 # knowledge of the CeCILL-B license and that you accept its terms.
25 # ------------------------------------------------------------------------ */
28 /*=========================================================================
30 Module: $RCSfile: bbtkBlackBoxInputConnector.cxx,v $
32 Date: $Date: 2012/11/16 08:49:01 $
33 Version: $Revision: 1.12 $
34 =========================================================================*/
39 * \brief Class bbtk::BlackBoxInputConnector :
41 #include "bbtkBlackBoxInputConnector.h"
42 #include "bbtkMessageManager.h"
43 #include "bbtkBlackBox.h"
48 //========================================================================
50 class BlackBoxInputConnector::Pimpl
53 Pimpl() : mConnection(0), mStatus(MODIFIED) {}
56 BlackBoxWeakPointer mBox;
57 /// The connection plugged into the input
58 Connection* mConnection;
59 /// The status of the input (UPTODATE | MODIFIED | OUTOFDATE)
63 //========================================================================
65 //========================================================================
66 BBTK_IMPL_PIMPL(BlackBoxInputConnector)
67 //========================================================================
70 //========================================================================
71 BlackBoxInputConnector::BlackBoxInputConnector(BlackBox::Pointer b)
72 //: mBox(b), mConnection(0), mStatus(MODIFIED)
74 bbtkDebugMessage("kernel",9,
76 <<"] BlackBoxInputConnector()"<<std::endl);
80 //========================================================================
82 //========================================================================
83 BlackBoxInputConnector::~BlackBoxInputConnector()
85 bbtkDebugMessage("kernel",9,
86 "[DEAD BOX] ~BlackBoxInputConnector()"
90 //========================================================================
92 //========================================================================
93 /// Returns the connection plugged into this input (const)
94 Connection* BlackBoxInputConnector::GetConnection() const
96 return p->mConnection;
98 //========================================================================
101 //========================================================================
102 /// Returns true iff a connection is connected to it
103 bool BlackBoxInputConnector::IsConnected() const
105 return (p->mConnection != 0);
107 //========================================================================
110 //========================================================================
111 /// Returns the status of the input
112 IOStatus BlackBoxInputConnector::GetStatus() const
116 //========================================================================
118 //========================================================================
119 /// Sets the status of the input
120 void BlackBoxInputConnector::SetStatus(IOStatus s)
124 //========================================================================
128 //========================================================================
129 /// Returns the black box which owns the connector
130 BlackBoxPointer BlackBoxInputConnector::GetBlackBox() const
132 return p->mBox.lock();
135 //========================================================================
137 //========================================================================
138 void BlackBoxInputConnector::SetConnection(Connection* c)
140 bbtkDebugMessage("kernel",9,
141 "["<<p->mBox.lock()->bbGetName()
142 <<"] BlackBoxInputConnector::SetConnection("<<c<<")"<<std::endl);
145 //========================================================================
147 //========================================================================
148 void BlackBoxInputConnector::UnsetConnection(Connection* c)
150 bbtkDebugMessage("kernel",9,
151 "["<<p->mBox.lock()->bbGetName()
152 <<"] BlackBoxInputConnector::UnsetConnection("
153 <<c<<")"<<std::endl);
156 //========================================================================
158 //========================================================================
159 void BlackBoxInputConnector::RecursiveExecute()
161 // If connected and OUTOFDATE : recursive update
162 // Post-update status is updated by the connection
163 // (either MODIFIED or OUTOFDATE)
164 if ( p->mConnection && (p->mStatus == OUTOFDATE) )
166 p->mConnection->RecursiveExecute();
170 if (!p->mBox.expired())
171 bbtkDebugMessage("process",5,"["<<p->mBox.lock()->bbGetName()
172 <<"] --> BlackBoxInputConnector::RecursiveExecute() : "
173 <<"No connection or input not Out-of-date : nothing to do"
176 bbtkDebugMessage("process",5,
177 "[DEAD BOX] --> BlackBoxInputConnector::RecursiveExecute() : "
178 <<"No connection or input not Out-of-date : nothing to do"
183 //========================================================================