CLAM-Development
1.4.0
Main Page
Related Pages
Modules
Namespaces
Classes
Files
File List
File Members
src
Flow
Controls
OutControl.hxx
Go to the documentation of this file.
1
/*
2
* Copyright (c) 2001-2004 MUSIC TECHNOLOGY GROUP (MTG)
3
* UNIVERSITAT POMPEU FABRA
4
*
5
*
6
* This program is free software; you can redistribute it and/or modify
7
* it under the terms of the GNU General Public License as published by
8
* the Free Software Foundation; either version 2 of the License, or
9
* (at your option) any later version.
10
*
11
* This program is distributed in the hope that it will be useful,
12
* but WITHOUT ANY WARRANTY; without even the implied warranty of
13
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14
* GNU General Public License for more details.
15
*
16
* You should have received a copy of the GNU General Public License
17
* along with this program; if not, write to the Free Software
18
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
19
*
20
*/
21
22
#ifndef _OutControl_
23
#define _OutControl_
24
25
#include <string>
26
#include <list>
27
#include <typeinfo>
28
#include "
Assert.hxx
"
29
#include "
InControl.hxx
"
30
#include "
OutControlBase.hxx
"
31
32
namespace
CLAM {
33
class
Processing;
34
39
template
<
class
ControlDataType>
40
class
OutControl
:
public
OutControlBase
41
{
42
// This is required to solve the parsing problem with iterators.
43
typedef
InControl<ControlDataType>
PeerInControl
;
44
typedef
std::list< PeerInControl * > ProperInControlList;
45
46
47
public
:
48
OutControl
(
const
std::string &name =
"unnamed typed in control"
,
Processing
* proc = 0);
49
50
void
SendControl
(
const
ControlDataType& val);
51
bool
IsLinkable
(
const
InControlBase
& in);
52
virtual
const
std::type_info &
GetTypeId
()
const
53
{
54
return
typeid
(ControlDataType);
55
};
56
};
57
58
template
<
class
ControlDataType>
59
OutControl<ControlDataType>::OutControl
(
const
std::string &name,
Processing
* proc)
60
:
OutControlBase
(name,proc)
61
{
62
}
63
64
template
<
class
ControlDataType>
65
void
OutControl<ControlDataType>::SendControl
(
const
ControlDataType& val)
66
{
67
typename
std::list< InControlBase * >::iterator it;
68
69
for
(it=mLinks.begin(); it!=mLinks.end(); it++)
70
{
71
InControl<ControlDataType>
* control =
static_cast<
InControl<ControlDataType>
*
>
(*it);
72
control->
DoControl
(val);
73
}
74
}
75
76
template
<
class
ControlDataType>
77
bool
OutControl<ControlDataType>::IsLinkable
(
const
InControlBase
& in)
78
{
79
return
typeid
(ControlDataType) == in.
GetTypeId
();
80
81
}
82
83
typedef
OutControl<float>
FloatOutControl
;
84
85
}
// END NAMESPACE CLAM
86
87
88
#endif //_OutControl_
89
Generated by
1.8.1