comparison transform/ModelTransformer.h @ 877:b109b88bfa85 tonioni

Callback handler for additional models at end of processing
author Chris Cannam
date Wed, 29 Jan 2014 15:58:15 +0000
parents 47aa3aeb687b
children 6ea7761a418b
comparison
equal deleted inserted replaced
876:47aa3aeb687b 877:b109b88bfa85
81 * Return the set of output models created by the transform or 81 * Return the set of output models created by the transform or
82 * transforms. Returns an empty list if any transform could not 82 * transforms. Returns an empty list if any transform could not
83 * be initialised; an error message may be available via 83 * be initialised; an error message may be available via
84 * getMessage() in this situation. 84 * getMessage() in this situation.
85 */ 85 */
86 Models getOutputModels(); 86 Models getOutputModels() { return m_outputs; }
87 87
88 /** 88 /**
89 * Return the set of output models, also detaching them from the 89 * Return the set of output models, also detaching them from the
90 * transformer so that they will not be deleted when the 90 * transformer so that they will not be deleted when the
91 * transformer is. The caller takes ownership of the models. 91 * transformer is. The caller takes ownership of the models.
92 */ 92 */
93 Models detachOutputModels() { m_detached = true; return getOutputModels(); } 93 Models detachOutputModels() {
94 m_detached = true;
95 return getOutputModels();
96 }
97
98 /**
99 * Return any additional models that were created during
100 * processing. This might happen if, for example, a transform was
101 * configured to split a multi-bin output into separate single-bin
102 * models as it processed. These should not be queried until after
103 * the transform has completed.
104 */
105 virtual Models getAdditionalOutputModels() { return Models(); }
106
107 /**
108 * Return true if the current transform is one that may produce
109 * additional models (to be retrieved through
110 * getAdditionalOutputModels above).
111 */
112 virtual bool willHaveAdditionalOutputModels() { return false; }
113
114 /**
115 * Return the set of additional models, also detaching them from
116 * the transformer. The caller takes ownership of the models.
117 */
118 virtual Models detachAdditionalOutputModels() {
119 m_detachedAdd = true;
120 return getAdditionalOutputModels();
121 }
94 122
95 /** 123 /**
96 * Return a warning or error message. If getOutputModel returned 124 * Return a warning or error message. If getOutputModel returned
97 * a null pointer, this should contain a fatal error message for 125 * a null pointer, this should contain a fatal error message for
98 * the transformer; otherwise it may contain a warning to show to 126 * the transformer; otherwise it may contain a warning to show to
102 130
103 protected: 131 protected:
104 ModelTransformer(Input input, const Transform &transform); 132 ModelTransformer(Input input, const Transform &transform);
105 ModelTransformer(Input input, const Transforms &transforms); 133 ModelTransformer(Input input, const Transforms &transforms);
106 134
107 /**
108 * Return any additional models that were created during
109 * processing. This might happen if, for example, a transform was
110 * configured to split a multi-bin output into separate single-bin
111 * models as it processed.
112 */
113 virtual Models getAdditionalOutputModels() { return Models(); }
114
115 Transforms m_transforms; 135 Transforms m_transforms;
116 Input m_input; // I don't own the model in this 136 Input m_input; // I don't own the model in this
117 Models m_outputs; // I own this, unless... 137 Models m_outputs; // I own this, unless...
118 bool m_detached; // ... this is true. 138 bool m_detached; // ... this is true.
139 bool m_detachedAdd;
119 bool m_abandoned; 140 bool m_abandoned;
120 QString m_message; 141 QString m_message;
121 }; 142 };
122 143
123 #endif 144 #endif