Mercurial > hg > svcore
comparison transform/ModelTransformer.h @ 1211:5a1198083d9a piper
Pull out model creation into the transformer thread run(), so that all communications with the plugin server happen on a single thread. Then make the model accessor wait for them to be created (which still happens right at the start of processing) before returning.
author | Chris Cannam |
---|---|
date | Mon, 17 Oct 2016 14:18:23 +0100 |
parents | 6ea7761a418b |
children | 1b888a85983b |
comparison
equal
deleted
inserted
replaced
1210:584b2d7d7cd9 | 1211:5a1198083d9a |
---|---|
87 * Return the set of output models created by the transform or | 87 * Return the set of output models created by the transform or |
88 * transforms. Returns an empty list if any transform could not | 88 * transforms. Returns an empty list if any transform could not |
89 * be initialised; an error message may be available via | 89 * be initialised; an error message may be available via |
90 * getMessage() in this situation. | 90 * getMessage() in this situation. |
91 */ | 91 */ |
92 Models getOutputModels() { return m_outputs; } | 92 Models getOutputModels() { |
93 awaitOutputModels(); | |
94 return m_outputs; | |
95 } | |
93 | 96 |
94 /** | 97 /** |
95 * Return the set of output models, also detaching them from the | 98 * Return the set of output models, also detaching them from the |
96 * transformer so that they will not be deleted when the | 99 * transformer so that they will not be deleted when the |
97 * transformer is. The caller takes ownership of the models. | 100 * transformer is. The caller takes ownership of the models. |
98 */ | 101 */ |
99 Models detachOutputModels() { | 102 Models detachOutputModels() { |
103 awaitOutputModels(); | |
100 m_detached = true; | 104 m_detached = true; |
101 return getOutputModels(); | 105 return m_outputs; |
102 } | 106 } |
103 | 107 |
104 /** | 108 /** |
105 * Return any additional models that were created during | 109 * Return any additional models that were created during |
106 * processing. This might happen if, for example, a transform was | 110 * processing. This might happen if, for example, a transform was |
136 | 140 |
137 protected: | 141 protected: |
138 ModelTransformer(Input input, const Transform &transform); | 142 ModelTransformer(Input input, const Transform &transform); |
139 ModelTransformer(Input input, const Transforms &transforms); | 143 ModelTransformer(Input input, const Transforms &transforms); |
140 | 144 |
145 virtual void awaitOutputModels() = 0; | |
146 | |
141 Transforms m_transforms; | 147 Transforms m_transforms; |
142 Input m_input; // I don't own the model in this | 148 Input m_input; // I don't own the model in this |
143 Models m_outputs; // I own this, unless... | 149 Models m_outputs; // I own this, unless... |
144 bool m_detached; // ... this is true. | 150 bool m_detached; // ... this is true. |
145 bool m_detachedAdd; | 151 bool m_detachedAdd; |