]> Creatis software - bbtk.git/blob - kernel/src/bbtkBlackBoxInputConnector.h
788fb4a12cd64d8240a42f2a81ebbcf2f3b3c670
[bbtk.git] / kernel / src / bbtkBlackBoxInputConnector.h
1 /*=========================================================================
2                                                                                 
3   Program:   bbtk
4   Module:    $RCSfile: bbtkBlackBoxInputConnector.h,v $
5   Language:  C++
6   Date:      $Date: 2008/04/18 12:59:15 $
7   Version:   $Revision: 1.2 $
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 /**
20  *  \file 
21  *  \brief Class bbtk::BlackBoxInputConnector : 
22  */
23 /**
24  * \class bbtk::BlackBoxInputConnector
25  * \brief 
26  */
27  
28 #ifndef __bbtkBlackBoxInputConnector_h__
29 #define __bbtkBlackBoxInputConnector_h__
30
31 #include "bbtkConnection.h"
32 #include <vector>
33
34 namespace bbtk
35 {
36
37   class BlackBox;
38   BBTK_FORWARD_DECLARE_POINTER(BlackBox);
39
40   class BBTK_EXPORT BlackBoxInputConnector 
41   {
42   public:
43      
44     /// Ctor
45     BlackBoxInputConnector(BlackBoxPointer b);
46     /// Dtor
47     ~BlackBoxInputConnector();    
48     /// Sets a connection
49     void SetConnection(Connection::Pointer c);
50     /// Unsets the connection 
51     /// The parameter is USELESS today but would be useful if we allow multiple connections on inputs
52     void UnsetConnection(Connection::Pointer c);
53   
54     IOStatus BackwardUpdate();
55
56     /// Returns the connection plugged into this input (const)
57     Connection::Pointer GetConnection() const { return mConnection.lock(); }
58     /// Returns true iff a connection is connected to it
59     bool IsConnected() const { return (mConnection.lock() != 0); }
60     /// Returns the status of the input (UPTODATE | MODIFIED)
61     const IOStatus& GetStatus() const { return mStatus; }
62     ///
63     BlackBoxPointer GetBlackBox() const { return mBox.lock(); } 
64   private:
65     /// 
66     BlackBoxWeakPointer mBox;
67     /// The connection plugged into the input
68     Connection::WeakPointer mConnection;
69     /// The status of the input (UPTODATE | MODIFIED)
70     IOStatus mStatus;
71   };
72   
73 }
74 // namespace bbtk
75 #endif