| 222 | |
| 223 | |
| 224 | PipelineManager::ExecResult PipelineManager::execute(ExecMode mode) |
| 225 | { |
| 226 | ExecResult result; |
| 227 | |
| 228 | validateStageOptions(); |
| 229 | Stage *s = getStage(); |
| 230 | if (!s) |
| 231 | return result; |
| 232 | |
| 233 | if (mode == ExecMode::PreferStream) |
| 234 | { |
| 235 | // If a pipeline isn't streamable before being prepared, it's not |
| 236 | // going to become streamable, so just run it or fail. |
| 237 | if (!s->pipelineStreamable()) |
| 238 | { |
| 239 | mode = ExecMode::Standard; |
| 240 | goto next; |
| 241 | } |
| 242 | |
| 243 | // After prepare a pipeline that was streamable might become |
| 244 | // non-streamable due to some options. |
| 245 | s->prepare(m_streamTable); |
| 246 | if (!s->pipelineStreamable()) |
| 247 | { |
| 248 | // Note that in this case we've prepared the stream |
| 249 | // table and will then prepare the standard table, |
| 250 | // but that can't be helped. |
| 251 | mode = ExecMode::Standard; |
| 252 | goto next; |
| 253 | } |
| 254 | // We can stream. |
| 255 | s->execute(m_streamTable); |
| 256 | result.m_mode = ExecMode::Stream; |
| 257 | return result; |
| 258 | } |
| 259 | |
| 260 | next: |
| 261 | if (mode == ExecMode::Stream) |
| 262 | { |
| 263 | if (s->pipelineStreamable()) |
| 264 | { |
| 265 | s->prepare(m_streamTable); |
| 266 | s->execute(m_streamTable); |
| 267 | result.m_mode = ExecMode::Stream; |
| 268 | } |
| 269 | } |
| 270 | else if (mode == ExecMode::Standard) |
| 271 | { |
| 272 | s->prepare(m_table); |
| 273 | m_viewSet = s->execute(m_table); |
| 274 | point_count_t cnt = 0; |
| 275 | for (auto pi = m_viewSet.begin(); pi != m_viewSet.end(); ++pi) |
| 276 | { |
| 277 | PointViewPtr view = *pi; |
| 278 | cnt += view->size(); |
| 279 | } |
| 280 | result = { ExecMode::Standard, cnt }; |
| 281 | } |
no test coverage detected