]> Creatis software - bbtk.git/blob - kernel/src/bbtkBlackBoxOutputConnector.cxx
*** empty log message ***
[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/22 14:30:25 $
7   Version:   $Revision: 1.5 $
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     bbtkDebugMessage("Kernel",9,
41                      "==> BlackBoxOutputConnector::~BlackBoxOutputConnector()"
42                      <<std::endl);
43     /*
44     ConnectionVector::iterator i;
45     for (i=mConnection.begin();
46          i!=mConnection.end();
47          ++i)
48       (*i) = Connection::WeakPointer();
49     */
50     mConnection.clear();
51     bbtkDebugMessage("Kernel",9,
52                      "<== BlackBoxOutputConnector::~BlackBoxOutputConnector()"
53                      <<std::endl);
54   }
55
56   ///
57   void BlackBoxOutputConnector::SetConnection(Connection* c)
58   {
59     bbtkDebugMessage("Kernel",9,"BlackBoxOutputConnector::SetConnection("
60                      <<c<<")"<<std::endl);
61     mConnection.push_back(c);
62   }
63
64
65
66   ///
67   void BlackBoxOutputConnector::UnsetConnection(Connection* c)
68   {
69     bbtkDebugMessageInc("Kernel",9,"BlackBoxOutputConnector::UnsetConnection("
70                      <<c<<")"<<std::endl);
71
72     if (!c) 
73       {
74         bbtkInternalError("BlackBoxOutputConnector::UnsetConnection("<<c<<") : invalid connection");
75
76       }
77     //    c->Check();
78     //Connection::WeakPointer w(c);
79     ConnectionVector::iterator i;
80     //  = find(mConnection.begin(),mConnection.end(),c);
81     for (i=mConnection.begin();
82          i!=mConnection.end();
83          ++i)
84       {
85         if (*i==c) break;
86       }
87     if (i==mConnection.end())
88       {
89         bbtkInternalError("BlackBoxOutputConnector::UnsetConnection("<<c<<") : connection is absent from connections list");
90       }
91     mConnection.erase(i);
92
93     bbtkDebugDecTab("Kernel",9);
94   }
95
96
97   
98   void BlackBoxOutputConnector::SetModifiedStatus()
99   {
100     bbtkDebugMessageInc("Process",5,
101                         "BlackBoxOutputConnector::SetModifiedStatus()"
102                         <<std::endl);
103     ConnectionVector::iterator i;
104     for (i=mConnection.begin();i!=mConnection.end();++i) 
105       {
106         (*i)->SetModifiedStatus();
107       }
108     
109     bbtkDebugDecTab("Process",5);
110     
111    }
112  
113
114
115 }
116 // namespace bbtk
117