Mercurial > hg > svcore
comparison transform/ModelTransformer.h @ 874:862fe7b20df7 tony_integration
Merge from tonioni branch
author | Chris Cannam |
---|---|
date | Tue, 28 Jan 2014 15:01:54 +0000 |
parents | 418cd2064769 |
children | 47aa3aeb687b |
comparison
equal
deleted
inserted
replaced
862:786ee8d1f30e | 874:862fe7b20df7 |
---|---|
38 class ModelTransformer : public Thread | 38 class ModelTransformer : public Thread |
39 { | 39 { |
40 public: | 40 public: |
41 virtual ~ModelTransformer(); | 41 virtual ~ModelTransformer(); |
42 | 42 |
43 typedef std::vector<Model *> Models; | |
44 | |
43 class Input { | 45 class Input { |
44 public: | 46 public: |
45 Input(Model *m) : m_model(m), m_channel(-1) { } | 47 Input(Model *m) : m_model(m), m_channel(-1) { } |
46 Input(Model *m, int c) : m_model(m), m_channel(c) { } | 48 Input(Model *m, int c) : m_model(m), m_channel(c) { } |
47 | 49 |
74 * Return the input channel spec for the transform. | 76 * Return the input channel spec for the transform. |
75 */ | 77 */ |
76 int getInputChannel() { return m_input.getChannel(); } | 78 int getInputChannel() { return m_input.getChannel(); } |
77 | 79 |
78 /** | 80 /** |
79 * Return the output model created by the transform. Returns a | 81 * Return the set of output models created by the transform or |
80 * null model if the transform could not be initialised; an error | 82 * transforms. Returns an empty list if any transform could not |
81 * message may be available via getMessage() in this situation. | 83 * be initialised; an error message may be available via |
84 * getMessage() in this situation. | |
82 */ | 85 */ |
83 Model *getOutputModel() { return m_output; } | 86 Models getOutputModels() { return m_outputs; } |
84 | 87 |
85 /** | 88 /** |
86 * Return the output model, also detaching it from the transformer | 89 * Return the set of output models, also detaching them from the |
87 * so that it will not be deleted when the transformer is. The | 90 * transformer so that they will not be deleted when the |
88 * caller takes ownership of the model. | 91 * transformer is. The caller takes ownership of the models. |
89 */ | 92 */ |
90 Model *detachOutputModel() { m_detached = true; return m_output; } | 93 Models detachOutputModels() { m_detached = true; return m_outputs; } |
91 | 94 |
92 /** | 95 /** |
93 * Return a warning or error message. If getOutputModel returned | 96 * Return a warning or error message. If getOutputModel returned |
94 * a null pointer, this should contain a fatal error message for | 97 * a null pointer, this should contain a fatal error message for |
95 * the transformer; otherwise it may contain a warning to show to | 98 * the transformer; otherwise it may contain a warning to show to |
97 */ | 100 */ |
98 QString getMessage() const { return m_message; } | 101 QString getMessage() const { return m_message; } |
99 | 102 |
100 protected: | 103 protected: |
101 ModelTransformer(Input input, const Transform &transform); | 104 ModelTransformer(Input input, const Transform &transform); |
105 ModelTransformer(Input input, const Transforms &transforms); | |
102 | 106 |
103 Transform m_transform; | 107 Transforms m_transforms; |
104 Input m_input; // I don't own the model in this | 108 Input m_input; // I don't own the model in this |
105 Model *m_output; // I own this, unless... | 109 Models m_outputs; // I own this, unless... |
106 bool m_detached; // ... this is true. | 110 bool m_detached; // ... this is true. |
107 bool m_abandoned; | 111 bool m_abandoned; |
108 QString m_message; | 112 QString m_message; |
109 }; | 113 }; |
110 | 114 |