File tree Expand file tree Collapse file tree 12 files changed +153
-153
lines changed
Expand file tree Collapse file tree 12 files changed +153
-153
lines changed Original file line number Diff line number Diff line change @@ -7,7 +7,7 @@ set(SOURCES
77 Pipeline.cpp
88 PointLayout.cpp
99 PointView.cpp
10- PointViewCollection .cpp
10+ PointViewIterator .cpp
1111)
1212
1313set (HEADERS
@@ -16,7 +16,7 @@ set(HEADERS
1616 Pipeline.h
1717 PointLayout.h
1818 PointView.h
19- PointViewCollection .h
19+ PointViewIterator .h
2020)
2121
2222set (DEPENDENCIES
Original file line number Diff line number Diff line change @@ -28,7 +28,7 @@ namespace pdal
2828
2929 namespace capi
3030 {
31- class PointViewCollection ;
31+ class PointViewIterator ;
3232 using Pipeline = std::unique_ptr<pdal::PipelineExecutor>;
3333 using PointView = pdal::PointViewPtr;
3434 }
@@ -46,7 +46,7 @@ typedef void* PDALPointLayoutPtr;
4646// / A pointer to a C++ pdal::capi::PointView object
4747typedef void * PDALPointViewPtr;
4848
49- // / A pointer to a C++ pdal::capi::PointViewCollection object
50- typedef void * PDALPointViewCollectionPtr ;
49+ // / A pointer to a C++ pdal::capi::PointViewIterator object
50+ typedef void * PDALPointViewIteratorPtr ;
5151
5252#endif /* PDAL_CAPI_FORWARD_H */
Original file line number Diff line number Diff line change 33 */
44
55#include " Pipeline.h"
6- #include " PointViewCollection .h"
6+ #include " PointViewIterator .h"
77
88#include < pdal/PipelineExecutor.hpp>
99
@@ -172,18 +172,18 @@ namespace pdal
172172 return ptr && ptr->get () && ptr->get ()->validate ();
173173 }
174174
175- PDALPointViewCollectionPtr PDALGetPointViews (PDALPipelinePtr pipeline)
175+ PDALPointViewIteratorPtr PDALGetPointViews (PDALPipelinePtr pipeline)
176176 {
177177 Pipeline *ptr = reinterpret_cast <Pipeline *>(pipeline);
178- pdal::capi::PointViewCollection *views = nullptr ;
178+ pdal::capi::PointViewIterator *views = nullptr ;
179179
180180 if (ptr && ptr->get ())
181181 {
182182 auto &v = ptr->get ()->getManagerConst ().views ();
183183
184184 if (!v.empty ())
185185 {
186- views = new pdal::capi::PointViewCollection (v);
186+ views = new pdal::capi::PointViewIterator (v);
187187 }
188188 }
189189
Original file line number Diff line number Diff line change @@ -116,7 +116,7 @@ namespace pdal
116116 * @param pipeline The pipeline
117117 * @return A pointer to a point view collection or nullptr if no point views are available
118118 */
119- PDAL_C_API PDALPointViewCollectionPtr PDALGetPointViews (PDALPipelinePtr pipeline);
119+ PDAL_C_API PDALPointViewIteratorPtr PDALGetPointViews (PDALPipelinePtr pipeline);
120120
121121#ifdef __cplusplus
122122
Load Diff This file was deleted.
Original file line number Diff line number Diff line change 1+ /*
2+ * Copyright (c) Simverge Software LLC - All Rights Reserved
3+ */
4+ #include " PointViewIterator.h"
5+
6+ namespace pdal
7+ {
8+ namespace capi
9+ {
10+ PointViewIterator::PointViewIterator (const pdal::PointViewSet& views) :
11+ mViews (views)
12+ {
13+ reset ();
14+ }
15+
16+ bool PointViewIterator::hasNext () const
17+ {
18+ return (mItr != mViews .cend ());
19+ }
20+
21+ const pdal::PointViewPtr PointViewIterator::next ()
22+ {
23+ return hasNext () ? *(mItr ++) : nullptr ;
24+ }
25+
26+ void PointViewIterator::reset ()
27+ {
28+ mItr = mViews .cbegin ();
29+ }
30+
31+
32+ extern " C"
33+ {
34+ bool PDALHasNextPointView (PDALPointViewIteratorPtr collection)
35+ {
36+ auto ptr = reinterpret_cast <pdal::capi::PointViewIterator *>(collection);
37+ return ptr && ptr->hasNext ();
38+ }
39+
40+ PDALPointViewPtr PDALGetNextPointView (PDALPointViewIteratorPtr collection)
41+ {
42+ auto ptr = reinterpret_cast <pdal::capi::PointViewIterator *>(collection);
43+ PDALPointViewPtr view = nullptr ;
44+
45+ if (ptr)
46+ {
47+ pdal::PointViewPtr v = ptr->next ();
48+
49+ if (v)
50+ {
51+ view = new pdal::PointViewPtr (std::move (v));
52+ }
53+ }
54+
55+ return view;
56+ }
57+
58+ void PDALResetPointViewIterator (PDALPointViewIteratorPtr collection)
59+ {
60+ auto ptr = reinterpret_cast <pdal::capi::PointViewIterator *>(collection);
61+
62+ if (ptr)
63+ {
64+ ptr->reset ();
65+ }
66+ }
67+
68+ void PDALDisposePointViewIterator (PDALPointViewIteratorPtr collection)
69+ {
70+ auto ptr = reinterpret_cast <pdal::capi::PointViewIterator *>(collection);
71+
72+ if (ptr)
73+ {
74+ delete ptr;
75+ ptr = nullptr ;
76+ collection = nullptr ;
77+ }
78+ }
79+
80+ }
81+
82+ }
83+ }
Original file line number Diff line number Diff line change 11/*
22 * Copyright (c) Simverge Software LLC - All Rights Reserved
33 */
4- #ifndef PDAL_CAPI_POINTVIEWCOLLECTION_H
5- #define PDAL_CAPI_POINTVIEWCOLLECTION_H
4+ #ifndef PDAL_CAPI_PointViewIterator_H
5+ #define PDAL_CAPI_PointViewIterator_H
66
77#include " Forward.h"
88
@@ -13,10 +13,10 @@ namespace pdal
1313{
1414 namespace capi
1515 {
16- class PDAL_C_API PointViewCollection
16+ class PDAL_C_API PointViewIterator
1717 {
1818 public:
19- PointViewCollection (const pdal::PointViewSet& views);
19+ PointViewIterator (const pdal::PointViewSet& views);
2020 bool hasNext () const ;
2121 const pdal::PointViewPtr next ();
2222 void reset ();
@@ -32,13 +32,13 @@ namespace pdal
3232#include < stdbool.h> // for bool
3333#endif /* __cplusplus */
3434
35- PDAL_C_API bool PDALHasNextPointView (PDALPointViewCollectionPtr collection);
35+ PDAL_C_API bool PDALHasNextPointView (PDALPointViewIteratorPtr collection);
3636
37- PDAL_C_API PDALPointViewPtr PDALGetNextPointView (PDALPointViewCollectionPtr collection);
37+ PDAL_C_API PDALPointViewPtr PDALGetNextPointView (PDALPointViewIteratorPtr collection);
3838
39- PDAL_C_API void PDALResetPointViewCollection (PDALPointViewCollectionPtr collection);
39+ PDAL_C_API void PDALResetPointViewIterator (PDALPointViewIteratorPtr collection);
4040
41- PDAL_C_API void PDALDisposePointViewCollection (PDALPointViewCollectionPtr collection);
41+ PDAL_C_API void PDALDisposePointViewIterator (PDALPointViewIteratorPtr collection);
4242#ifdef __cplusplus
4343 }
4444 }
Original file line number Diff line number Diff line change @@ -8,7 +8,7 @@ set(DEPENDENCIES pdal_c)
88set (TESTS
99 PipelineTest
1010 PointLayoutTest
11- PointViewCollectionTest
11+ PointViewIteratorTest
1212 PointViewTest
1313)
1414
Original file line number Diff line number Diff line change 1111#include <pdal/capi/Pipeline.h>
1212#include <pdal/capi/PointLayout.h>
1313#include <pdal/capi/PointView.h>
14- #include <pdal/capi/PointViewCollection .h>
14+ #include <pdal/capi/PointViewIterator .h>
1515
1616SUITE(PointLayoutTest);
1717
@@ -38,7 +38,7 @@ static void setupPointLayoutTest(void *arg)
3838
3939 if (gPipeline && PDALExecutePipeline(gPipeline))
4040 {
41- PDALPointViewCollectionPtr views = PDALGetPointViews(gPipeline);
41+ PDALPointViewIteratorPtr views = PDALGetPointViews(gPipeline);
4242
4343 if (PDALHasNextPointView(views))
4444 {
You can’t perform that action at this time.
0 commit comments