]> Creatis software - bbtk.git/blob - kernel/src/bbtkBlackBoxOutputConnector.cxx
Recreated the complete cvs tree because the project architecture deeply changed
[bbtk.git] / kernel / src / bbtkBlackBoxOutputConnector.cxx
1 /*=========================================================================
2                                                                                 
3   Program:   bbtk
4   Module:    $RCSfile: bbtkBlackBoxOutputConnector.cxx,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 /**
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("Core",9,"BlackBoxOutputConnector::BlackBoxOutputConnector()"<<std::endl);
36   }
37
38   BlackBoxOutputConnector::~BlackBoxOutputConnector() 
39   {
40     bbtkDebugMessageInc("Core",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("Core",9);
49   }
50
51   ///
52   void BlackBoxOutputConnector::SetConnection(Connection* c)
53   {
54     bbtkDebugMessage("Core",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("Core",9,"BlackBoxOutputConnector::UnsetConnection("
65                      <<c<<")"<<std::endl);
66
67     std::vector<Connection*>::iterator i;
68     for (i=mConnection.begin();i!=mConnection.end();++i) 
69       {
70         if ( *i == c) break;
71       }
72     //= std::find(mConnection,c);
73     if (i==mConnection.end())
74       {
75         bbtkError("no connexion "<<c);
76       }
77     mConnection.erase(i);
78
79     bbtkDebugDecTab("Core",9);
80   }
81
82
83   
84   void BlackBoxOutputConnector::SetModifiedStatus()
85   {
86     bbtkDebugMessageInc("Process",5,
87                         "BlackBoxOutputConnector::SetModifiedStatus()"
88                         <<std::endl);
89     std::vector<Connection*>::iterator i;
90     for (i=mConnection.begin();i!=mConnection.end();++i) 
91       {
92         (*i)->SetModifiedStatus();
93       }
94     
95     bbtkDebugDecTab("Process",5);
96     
97    }
98  
99
100
101 }
102 // namespace bbtk
103