]> Creatis software - bbtk.git/blob - kernel/src/bbtkConnection.h
Recreated the complete cvs tree because the project architecture deeply changed
[bbtk.git] / kernel / src / bbtkConnection.h
1 /*=========================================================================
2                                                                                 
3   Program:   bbtk
4   Module:    $RCSfile: bbtkConnection.h,v $
5   Language:  C++
6   Date:      $Date: 2008/01/22 15:02:00 $
7   Version:   $Revision: 1.1.1.1 $
8                                                                                 
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.
12                                                                                 
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.
16                                                                                 
17 =========================================================================*/
18 /**
19  *\file
20  *\brief Class bbtk::Connection
21  */
22 /**
23  *\class bbtk::Connection
24  *\brief DDD
25  *
26  */
27
28 #ifndef __bbtkConnection_h__
29 #define __bbtkConnection_h__
30
31 #include "bbtkSystem.h"
32 #include <string>
33
34 namespace bbtk
35 {
36   /// 
37   typedef int IOStatus;
38   /// 
39   const int MODIFIED = 0;
40   /// 
41   const int UPTODATE = 1;
42   /// 
43   const int UPDATING = 2;
44  
45
46
47
48   class BlackBox;
49   class BlackBoxInputConnector;
50   class BlackBoxOutputConnector;
51
52
53
54   class BBTK_EXPORT Connection
55   {
56   public:
57     /// Ctor 
58     Connection(BlackBox* from, const std::string& output,
59                BlackBox* to, const std::string& input   );
60     /// Dtor
61     ~Connection();
62
63     /// Amont direction pipeline processing
64     /// 1) call bbBackwardUpdate(this) on the amont box
65     /// 2) copies the amont box output to the aval box input adapting it if needed
66     virtual IOStatus BackwardUpdate();
67
68     /// Aval direction pipeline processing :
69     /// 1) copies the amont box output to the aval box input adapting it if needed
70     /// 2) call bbForwardUpdate(this) on the aval box
71     //    virtual void ForwardUpdate();
72
73
74     virtual void SetModifiedStatus();
75     std::string GetFullName() const; 
76
77     /// Returns the initial black box of the connection
78     BlackBox* GetBlackBoxFrom() const { return mFrom; }
79     /// Returns the final black box of the connection
80     BlackBox* GetBlackBoxTo() const { return mTo; }
81     /// Returns the output of the initial black box of the connection
82     const std::string& GetBlackBoxFromOutput() const { return mOutput; }
83     /// Returns the input of the final black box of the connection
84     const std::string& GetBlackBoxToInput() const { return mInput; }
85
86     
87
88   protected:
89     /// Black box origin of the connection
90     BlackBox* mFrom;
91     /// Output of mFrom which is connected
92     std::string mOutput;
93     /// Output connector of mFrom which is connected
94     //  BlackBoxOutputConnector* mOutputConnector;
95     /// Black box destination of the connection
96     BlackBox* mTo;
97     /// Input of mTo which is connected
98     std::string mInput;
99     /// Input connector of mTo which is connected
100     //  BlackBoxInputConnector* mInputConnector;
101     /// Adaptor black box if needed
102     BlackBox* mAdaptor;
103
104     /// Is the connection input type is any<thing> ?
105     bool mFromAny;
106
107     /// Is the connection output type is any<thing> ?
108     bool mToAny;
109
110
111     /// Have to do dynamic_cast ?
112     bool mDoDynamicCast;
113
114   
115     /// Ctor with the black box from and to and their input and output
116     /// and a dummy int to differentiate from the public constructor.
117     /// Sets the members but does not test compatibility (used by bbtk::AdaptiveConnection)
118     //  Connection(BlackBox* from, const std::string& output,
119     //         BlackBox* to, const std::string& input, int   );
120     
121     void TransferData(); 
122   };
123
124
125 }// namespace bbtk
126
127
128
129 #endif
130