File tree Expand file tree Collapse file tree 3 files changed +77
-0
lines changed
Expand file tree Collapse file tree 3 files changed +77
-0
lines changed Original file line number Diff line number Diff line change 3636#include < pdal/util/Utils.hpp>
3737#include < pdal/PipelineWriter.hpp>
3838#include < pdal/Stage.hpp>
39+ #include < pdal/pdal_types.hpp>
3940
4041#undef min
4142
@@ -271,6 +272,40 @@ extern "C"
271272 return result;
272273 }
273274
275+ bool PDALExecutePipelineAsStream (PDALPipelinePtr pipeline)
276+ {
277+ Pipeline *ptr = reinterpret_cast <Pipeline *>(pipeline);
278+
279+ if (ptr)
280+ {
281+ try
282+ {
283+ PipelineManager::ExecResult exec = ptr->manager ->execute (ExecMode::Stream);
284+ ptr->m_executed = true ;
285+ return true ;
286+ }
287+ catch (const std::exception &e)
288+ {
289+ printf (" Found error while executing pipeline: %s" , e.what ());
290+ return false ;
291+ }
292+ }
293+ return false ;
294+ }
295+
296+ bool PDALPipelineIsStreamable (PDALPipelinePtr pipeline)
297+ {
298+ Pipeline *ptr = reinterpret_cast <Pipeline *>(pipeline);
299+
300+ if (ptr)
301+ {
302+ return ptr->manager ->pipelineStreamable ();
303+ }
304+ return false ;
305+ }
306+
307+
308+
274309 bool PDALValidatePipeline (PDALPipelinePtr pipeline)
275310 {
276311 Pipeline *ptr = reinterpret_cast <Pipeline *>(pipeline);
Original file line number Diff line number Diff line change @@ -136,6 +136,22 @@ PDALC_API int PDALGetPipelineLogLevel(PDALPipelinePtr pipeline);
136136 */
137137PDALC_API int64_t PDALExecutePipeline (PDALPipelinePtr pipeline);
138138
139+ /* *
140+ * Executes a pipeline as a streamable pipeline. Will run as non-streamed pipeline if the pipeline is not streamable.
141+ *
142+ * @param pipeline The pipeline
143+ * @return The total number of points produced by the pipeline
144+ */
145+ PDALC_API bool PDALExecutePipelineAsStream (PDALPipelinePtr pipeline);
146+
147+ /* *
148+ * Determines if a pipeline is streamable
149+ *
150+ * @param pipeline The pipeline
151+ * @return Whether the pipeline is streamable
152+ */
153+ PDALC_API bool PDALPipelineIsStreamable (PDALPipelinePtr pipeline);
154+
139155/* *
140156 * Validates a pipeline.
141157 *
Original file line number Diff line number Diff line change @@ -344,6 +344,31 @@ TEST testPDALExecutePipeline(void)
344344 PASS();
345345}
346346
347+ TEST testPDALExecutePipelineStream(void)
348+ {
349+ PDALPipelinePtr pipeline = PDALCreatePipeline(gPipelineJson);
350+ ASSERT(pipeline);
351+
352+ bool isStreamable = PDALPipelineIsStreamable(pipeline);
353+
354+ ASSERT_EQ(isStreamable, true);
355+
356+ bool result = PDALExecutePipelineAsStream(pipeline);
357+
358+ ASSERT_EQ(result, true);
359+
360+ result = PDALExecutePipelineAsStream(NULL);
361+
362+ ASSERT_EQ(result, false);
363+
364+ isStreamable = PDALPipelineIsStreamable(NULL);
365+
366+ ASSERT_EQ(isStreamable, false);
367+
368+ PDALDisposePipeline(pipeline);
369+ PASS();
370+ }
371+
347372TEST testPDALValidatePipeline(void)
348373{
349374 bool valid = PDALValidatePipeline(NULL);
@@ -369,6 +394,7 @@ GREATEST_SUITE(test_pdalc_pipeline)
369394
370395 RUN_TEST(testPDALCreateAndDisposePipeline);
371396 RUN_TEST(testPDALExecutePipeline);
397+ RUN_TEST(testPDALExecutePipelineStream);
372398 RUN_TEST(testPDALGetSetPipelineLog);
373399 RUN_TEST(testPDALGetPipelineAsString);
374400 RUN_TEST(testPDALGetPipelineMetadata);
You can’t perform that action at this time.
0 commit comments