]> Creatis software - bbtk.git/blob - kernel/src/bbtkBlackBoxOutputConnector.h
Feature #1774
[bbtk.git] / kernel / src / bbtkBlackBoxOutputConnector.h
1 /*
2  # ---------------------------------------------------------------------
3  #
4  # Copyright (c) CREATIS (Centre de Recherche en Acquisition et Traitement de l'Image
5  #                        pour la SantÈ)
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
9  #
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.
16  #
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
21  #  liability.
22  #
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  # ------------------------------------------------------------------------ */
26
27
28 /*=========================================================================
29   Program:   bbtk
30   Module:    $RCSfile: bbtkBlackBoxOutputConnector.h,v $
31   Language:  C++
32   Date:      $Date: 2012/11/16 08:49:01 $
33   Version:   $Revision: 1.11 $
34 =========================================================================*/
35
36                                                                        
37
38
39 /**
40  *  \file 
41  *  \brief Class bbtk::BlackBoxOutputConnector : 
42  */
43 /**
44  * \class bbtk::BlackBoxOutputConnector
45  * \brief 
46  */
47  
48 #ifndef __bbtkBlackBoxOutputConnector_h__
49 #define __bbtkBlackBoxOutputConnector_h__
50
51 #include "bbtkPimpl.h"
52 #include "bbtkConnection.h"
53 #include "bbtkBlackBox.h"
54 #include "bbtkMessageManager.h"
55 #include <vector>
56
57
58 namespace bbtk
59 {
60
61  
62   class BBTK_EXPORT BlackBoxOutputConnector 
63   {
64   public:
65  
66   
67     typedef BlackBox::OutputChangeCallbackType OutputChangeCallbackType;
68
69     /// Ctor
70     BlackBoxOutputConnector(BlackBoxPointer b);
71     /// Dtor
72     ~BlackBoxOutputConnector();
73
74     /// Sets a connection
75     void SetConnection(Connection* c);
76     /// Unsets the connection 
77     void UnsetConnection(Connection* c);
78     /// The type of vector of output connections
79     typedef std::vector<Connection*> ConnectionVector;
80     /// Returns the vector of connection plugged into this output (const)
81     const ConnectionVector& GetConnectionVector() const;
82     
83     /// Returns the status of the input 
84     IOStatus GetStatus() const;
85     /// Sets the status of the input 
86     void SetStatus( IOStatus s );
87     
88     /// Signals the change observers that the output has changed
89     void SignalChange( BlackBox::Pointer box, const std::string& output );
90
91
92     /// Adds the function f to the list of functions to call when 
93     /// the output changes.
94     void AddChangeObserver(OutputChangeCallbackType f); 
95
96     /// Removes the function f from the list of functions to call when 
97     /// the output changes (TO WRITE)
98     void RemoveChangeObserver(OutputChangeCallbackType f); 
99
100       /// Private implementation
101     BBTK_DECLARE_PIMPL(BlackBoxOutputConnector);
102     
103   private:
104     /// Purposedly not implemented
105     BlackBoxOutputConnector(const BlackBoxOutputConnector&);
106
107   };
108   
109 }
110 // namespace bbtk
111 #endif