1 /*=========================================================================
4 Module: $RCSfile: bbtkConnection.h,v $
6 Date: $Date: 2008/04/09 11:16:57 $
7 Version: $Revision: 1.5 $
9 Copyright (c) CREATIS (Centre de Recherche et d'Applications en Traitement de
10 l'Image). All rights reserved. See doc/license.txt or
11 http://www.creatis.insa-lyon.fr/Public/bbtk/License.html for details.
13 This software is distributed WITHOUT ANY WARRANTY; without even
14 the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
15 PURPOSE. See the above copyright notices for more information.
17 =========================================================================*/
20 *\brief Class bbtk::Connection
23 *\class bbtk::Connection
28 #ifndef __bbtkConnection_h__
29 #define __bbtkConnection_h__
31 #include "bbtkSystem.h"
43 const int MODIFIED = 0;
45 const int UPTODATE = 1;
47 const int UPDATING = 2;
50 class BlackBoxInputConnector;
51 class BlackBoxOutputConnector;
53 class BBTK_EXPORT Connection
57 Connection(BlackBox* from, const std::string& output,
58 BlackBox* to, const std::string& input,
65 /// Amont direction pipeline processing
66 /// 1) call bbBackwardUpdate(this) on the upstream box
67 /// 2) copies the upstream box output to the downstream box input adapting it if needed
68 virtual IOStatus BackwardUpdate();
70 /// Aval direction pipeline processing :
71 /// 1) copies the upstream box output to the downstream box input adapting it if needed
72 /// 2) call bbForwardUpdate(this) on the downstream box
73 // virtual void ForwardUpdate();
75 virtual void SetModifiedStatus();
76 std::string GetFullName() const;
78 /// Returns the original initial black box of the connection
79 BlackBox* GetOriginalBlackBoxFrom() const { return mOriginalFrom; }
80 /// Returns the origianl final black box of the connection
81 BlackBox* GetOriginalBlackBoxTo() const { return mOriginalTo; }
82 /// Returns the original output of the initial black box of the connection
83 const std::string& GetOriginalBlackBoxFromOutput() const { return mOriginalOutput; }
84 /// Returns the original input of the final black box of the connection
85 const std::string& GetOriginalBlackBoxToInput() const { return mOriginalInput; }
87 /// Returns the initial black box of the connection
88 BlackBox* GetBlackBoxFrom() const { return mFrom; }
89 /// Returns the final black box of the connection
90 BlackBox* GetBlackBoxTo() const { return mTo; }
91 /// Returns the output of the initial black box of the connection
92 const std::string& GetBlackBoxFromOutput() const { return mOutput; }
93 /// Returns the input of the final black box of the connection
94 const std::string& GetBlackBoxToInput() const { return mInput; }
96 /// Sets the initial black box of the connection
97 void SetBlackBoxFrom(BlackBox* b) { mFrom = b; }
98 /// Sets the final black box of the connection
99 void SetBlackBoxTo(BlackBox* b) { mTo = b; }
100 /// Sets the output of the initial black box of the connection
101 void SetBlackBoxFromOutput(const std::string& o) { mOutput = o; }
102 /// Sets the input of the final black box of the connection
103 void SetBlackBoxToInput(const std::string& o) { mInput = o; }
105 /// Checks that the connection is ok (throws error if not)
109 /// Black box origin of the connection
111 BlackBox* mOriginalFrom;
112 /// Output of mFrom which is connected
114 std::string mOriginalOutput;
115 /// Output connector of mFrom which is connected
116 // BlackBoxOutputConnector* mOutputConnector;
117 /// Black box destination of the connection
119 BlackBox* mOriginalTo;
120 /// Input of mTo which is connected
122 std::string mOriginalInput;
123 /// Input connector of mTo which is connected
124 // BlackBoxInputConnector* mInputConnector;
125 /// Adaptor black box if needed
128 /// The factory used to create adaptors
129 const Factory* mFactory;
131 /// Is the connection input type is any<thing> ?
134 /// Is the connection output type is any<thing> ?
138 /// Have to do dynamic_cast ?
141 /// Ctor with the black box from and to and their input and output
142 /// and a dummy int to differentiate from the public constructor.
143 /// Sets the members but does not test compatibility (used by bbtk::AdaptiveConnection)
144 // Connection(BlackBox* from, const std::string& output,
145 // BlackBox* to, const std::string& input, int );