svcore
1.9
ModelTransformer.h
Go to the documentation of this file.
1
/* -*- c-basic-offset: 4 indent-tabs-mode: nil -*- vi:set ts=8 sts=4 sw=4: */
2
3
/*
4
Sonic Visualiser
5
An audio file viewer and annotation editor.
6
Centre for Digital Music, Queen Mary, University of London.
7
This file copyright 2006 Chris Cannam.
8
9
This program is free software; you can redistribute it and/or
10
modify it under the terms of the GNU General Public License as
11
published by the Free Software Foundation; either version 2 of the
12
License, or (at your option) any later version. See the file
13
COPYING included with this distribution for more information.
14
*/
15
16
#ifndef _TRANSFORMER_H_
17
#define _TRANSFORMER_H_
18
19
#include "
base/Thread.h
"
20
21
#include "
data/model/Model.h
"
22
23
#include "
Transform.h
"
24
38
class
ModelTransformer
:
public
Thread
39
{
40
public
:
41
virtual
~ModelTransformer
();
42
43
typedef
std::vector<Model *>
Models
;
44
45
class
Input
{
46
public
:
47
Input
(
Model
*m) :
m_model
(m),
m_channel
(-1) { }
48
Input
(
Model
*m,
int
c) :
m_model
(m),
m_channel
(c) { }
49
50
Model
*
getModel
()
const
{
return
m_model
; }
51
void
setModel
(
Model
*m) {
m_model
= m; }
52
53
int
getChannel
()
const
{
return
m_channel
; }
54
void
setChannel
(
int
c) {
m_channel
= c; }
55
56
protected
:
57
Model
*
m_model
;
58
int
m_channel
;
59
};
60
68
void
abandon
() {
m_abandoned
=
true
; }
69
73
Model
*
getInputModel
() {
return
m_input
.
getModel
(); }
74
78
int
getInputChannel
() {
return
m_input
.
getChannel
(); }
79
86
Models
getOutputModels
() {
return
m_outputs
; }
87
93
Models
detachOutputModels
() {
94
m_detached
=
true
;
95
return
getOutputModels
();
96
}
97
105
virtual
Models
getAdditionalOutputModels
() {
return
Models
(); }
106
112
virtual
bool
willHaveAdditionalOutputModels
() {
return
false
; }
113
118
virtual
Models
detachAdditionalOutputModels
() {
119
m_detachedAdd
=
true
;
120
return
getAdditionalOutputModels
();
121
}
122
129
QString
getMessage
()
const
{
return
m_message
; }
130
131
protected
:
132
ModelTransformer
(
Input
input,
const
Transform
&transform);
133
ModelTransformer
(
Input
input,
const
Transforms
&transforms);
134
135
Transforms
m_transforms
;
136
Input
m_input
;
// I don't own the model in this
137
Models
m_outputs
;
// I own this, unless...
138
bool
m_detached
;
// ... this is true.
139
bool
m_detachedAdd
;
140
bool
m_abandoned
;
141
QString
m_message
;
142
};
143
144
#endif
ModelTransformer::abandon
void abandon()
Hint to the processing thread that it should give up, for example because the process is going to exi...
Definition:
ModelTransformer.h:68
ModelTransformer::getInputChannel
int getInputChannel()
Return the input channel spec for the transform.
Definition:
ModelTransformer.h:78
ModelTransformer::Input::getModel
Model * getModel() const
Definition:
ModelTransformer.h:50
ModelTransformer::ModelTransformer
ModelTransformer(Input input, const Transform &transform)
Definition:
ModelTransformer.cpp:18
PortType::Input
static const int Input
Definition:
RealTimePluginInstance.h:63
Transforms
std::vector< Transform > Transforms
Definition:
Transform.h:200
ModelTransformer::getMessage
QString getMessage() const
Return a warning or error message.
Definition:
ModelTransformer.h:129
ModelTransformer::Input
Definition:
ModelTransformer.h:45
Model.h
ModelTransformer::Input::setChannel
void setChannel(int c)
Definition:
ModelTransformer.h:54
ModelTransformer::detachOutputModels
Models detachOutputModels()
Return the set of output models, also detaching them from the transformer so that they will not be de...
Definition:
ModelTransformer.h:93
ModelTransformer::Input::Input
Input(Model *m, int c)
Definition:
ModelTransformer.h:48
Transform.h
ModelTransformer::m_message
QString m_message
Definition:
ModelTransformer.h:141
ModelTransformer::Models
std::vector< Model * > Models
Definition:
ModelTransformer.h:43
ModelTransformer::detachAdditionalOutputModels
virtual Models detachAdditionalOutputModels()
Return the set of additional models, also detaching them from the transformer.
Definition:
ModelTransformer.h:118
ModelTransformer::m_outputs
Models m_outputs
Definition:
ModelTransformer.h:137
ModelTransformer::m_transforms
Transforms m_transforms
Definition:
ModelTransformer.h:135
Thread.h
ModelTransformer::m_detached
bool m_detached
Definition:
ModelTransformer.h:138
ModelTransformer::Input::setModel
void setModel(Model *m)
Definition:
ModelTransformer.h:51
Model
Model is the base class for all data models that represent any sort of data on a time scale based on ...
Definition:
Model.h:35
ModelTransformer::Input::Input
Input(Model *m)
Definition:
ModelTransformer.h:47
ModelTransformer::getAdditionalOutputModels
virtual Models getAdditionalOutputModels()
Return any additional models that were created during processing.
Definition:
ModelTransformer.h:105
ModelTransformer::willHaveAdditionalOutputModels
virtual bool willHaveAdditionalOutputModels()
Return true if the current transform is one that may produce additional models (to be retrieved throu...
Definition:
ModelTransformer.h:112
Transform
Definition:
Transform.h:34
ModelTransformer::m_detachedAdd
bool m_detachedAdd
Definition:
ModelTransformer.h:139
ModelTransformer::Input::m_model
Model * m_model
Definition:
ModelTransformer.h:57
ModelTransformer::getOutputModels
Models getOutputModels()
Return the set of output models created by the transform or transforms.
Definition:
ModelTransformer.h:86
Thread
Definition:
Thread.h:24
ModelTransformer
A ModelTransformer turns one data model into another.
Definition:
ModelTransformer.h:38
ModelTransformer::m_input
Input m_input
Definition:
ModelTransformer.h:136
ModelTransformer::m_abandoned
bool m_abandoned
Definition:
ModelTransformer.h:140
ModelTransformer::getInputModel
Model * getInputModel()
Return the input model for the transform.
Definition:
ModelTransformer.h:73
ModelTransformer::Input::m_channel
int m_channel
Definition:
ModelTransformer.h:58
ModelTransformer::~ModelTransformer
virtual ~ModelTransformer()
Definition:
ModelTransformer.cpp:36
ModelTransformer::Input::getChannel
int getChannel() const
Definition:
ModelTransformer.h:53
transform
ModelTransformer.h
Generated by
1.8.15