]> Creatis software - bbtk.git/blob - kernel/src/bbtkBlackBoxOutputConnector.cxx
d2ee80e74dec872efd777472318e9f46e7dcf3ae
[bbtk.git] / kernel / src / bbtkBlackBoxOutputConnector.cxx
1 /*=========================================================================
2                                                                                 
3   Program:   bbtk
4   Module:    $RCSfile: bbtkBlackBoxOutputConnector.cxx,v $
5   Language:  C++
6   Date:      $Date: 2008/04/09 11:16:57 $
7   Version:   $Revision: 1.3 $
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::BlackBoxOutputConnector : 
22  */
23
24 #include "bbtkBlackBoxOutputConnector.h"
25 #include "bbtkMessageManager.h"
26 #include "bbtkBlackBox.h"
27 //#include <algorithm>
28
29 namespace bbtk
30 {
31
32   BlackBoxOutputConnector::BlackBoxOutputConnector() 
33   // : mStatus(MODIFIED)
34   {
35     bbtkDebugMessage("Kernel",9,"BlackBoxOutputConnector::BlackBoxOutputConnector()"<<std::endl);
36   }
37
38   BlackBoxOutputConnector::~BlackBoxOutputConnector() 
39   {
40     bbtkDebugMessageInc("Kernel",9,
41                         "BlackBoxOutputConnector::~BlackBoxOutputConnector()"
42                         <<std::endl);
43     std::vector<Connection*>::iterator i;
44     for (i=mConnection.begin();i!=mConnection.end();++i) 
45       {
46         delete *i;
47       }
48     bbtkDebugDecTab("Kernel",9);
49   }
50
51   ///
52   void BlackBoxOutputConnector::SetConnection(Connection* c)
53   {
54     bbtkDebugMessage("Kernel",9,"BlackBoxOutputConnector::SetConnection("
55                      <<c<<")"<<std::endl);
56     mConnection.push_back(c);
57   }
58
59
60
61   ///
62   void BlackBoxOutputConnector::UnsetConnection(Connection* c)
63   {
64     bbtkDebugMessageInc("Kernel",9,"BlackBoxOutputConnector::UnsetConnection("
65                      <<c<<")"<<std::endl);
66
67     c->Check();
68     std::vector<Connection*>::iterator i
69       = find(mConnection.begin(),mConnection.end(),c);
70     if (i==mConnection.end())
71       {
72         bbtkInternalError("BlackBoxOutputConnector::UnsetConnection("<<c<<") : connection is absent from connections list");
73       }
74     mConnection.erase(i);
75
76     bbtkDebugDecTab("Kernel",9);
77   }
78
79
80   
81   void BlackBoxOutputConnector::SetModifiedStatus()
82   {
83     bbtkDebugMessageInc("Process",5,
84                         "BlackBoxOutputConnector::SetModifiedStatus()"
85                         <<std::endl);
86     std::vector<Connection*>::iterator i;
87     for (i=mConnection.begin();i!=mConnection.end();++i) 
88       {
89         (*i)->SetModifiedStatus();
90       }
91     
92     bbtkDebugDecTab("Process",5);
93     
94    }
95  
96
97
98 }
99 // namespace bbtk
100