CLAM-Development
1.4.0
Main Page
Related Pages
Modules
Namespaces
Classes
Files
File List
File Members
src
Flow
Controls
OutControlBase.hxx
Go to the documentation of this file.
1
#ifndef BaseOutControl_hxx
2
#define BaseOutControl_hxx
3
4
#include <string>
5
#include <list>
6
#include <typeinfo>
7
#include <CLAM/Assert.hxx>
8
#include <CLAM/InControlBase.hxx>
9
10
11
namespace
CLAM {
12
class
Processing;
13
class
InControlBase;
20
class
OutControlBase
21
{
22
std::string mName;
23
Processing
* mProcessing;
24
protected
:
25
typedef
std::list<InControlBase*>
Peers
;
27
Peers
mLinks
;
29
OutControlBase
(
const
OutControlBase
& toBeCopied ) {}
30
public
:
36
OutControlBase
(
const
std::string &name,
Processing
* proc = 0);
42
virtual
~OutControlBase
();
44
const
std::string&
GetName
()
const
{
return
mName; }
46
Processing
*
GetProcessing
()
const
{
return
mProcessing; }
48
bool
IsConnected
() {
return
not
mLinks
.empty(); }
50
bool
IsConnectedTo
(
InControlBase
& in)
51
{
52
Peers::iterator it;
53
for
(it=
mLinks
.begin(); it!=
mLinks
.end(); it++)
54
if
((*it) == &in)
return
true
;
55
return
false
;
56
}
57
virtual
const
std::type_info&
GetTypeId
()
const
= 0;
64
virtual
bool
IsLinkable
(
const
InControlBase
& in) = 0;
69
void
AddLink
(
InControlBase
& in)
70
{
71
CLAM_ASSERT
(
IsLinkable
(in),
72
"Connecting controls which are not linkable (different types?). "
73
"You can use IsLinkable before connecting to ensure that they are compatible."
);
74
mLinks
.push_back(&in);
75
in.
OutControlInterface_AddLink
(*
this
);
76
}
81
void
RemoveLink
(
InControlBase
& in)
82
{
83
CLAM_ASSERT
(
IsConnectedTo
(in),
84
"Removing a control connection that doesn't exist."
85
"You can check that with IsConnectedTo to ensure that this condition is meet."
);
86
mLinks
.remove( &in );
87
in.
OutControlInterface_RemoveLink
(*
this
);
88
}
89
Peers::iterator
BeginInControlsConnected
();
90
Peers::iterator
EndInControlsConnected
();
91
};
92
}
// END NAMESPACE CLAM
93
#endif // BaseOutControl_hxx
Generated by
1.8.1