[Liblas-commits] hg-main-tree: stubbed in Option-based ctor for all Stages; added...

liblas-commits at liblas.org liblas-commits at liblas.org
Wed Jul 13 23:22:08 EDT 2011


details:   http://hg.libpc.orghg-main-tree/rev/15701f62af89
changeset: 858:15701f62af89
user:      Michael P. Gerlek <mpg at flaxen.com>
date:      Wed Jul 13 19:38:29 2011 -0700
description:
stubbed in Option-based ctor for all Stages; added new StageBase class; work on StageFactory class
Subject: hg-main-tree: cut/paste error

details:   http://hg.libpc.orghg-main-tree/rev/b64cf11b4788
changeset: 859:b64cf11b4788
user:      Michael P. Gerlek <mpg at flaxen.com>
date:      Wed Jul 13 20:21:34 2011 -0700
description:
cut/paste error
Subject: hg-main-tree: piepline builder work

details:   http://hg.libpc.orghg-main-tree/rev/76841e1d4454
changeset: 860:76841e1d4454
user:      Michael P. Gerlek <mpg at flaxen.com>
date:      Wed Jul 13 20:21:56 2011 -0700
description:
piepline builder work

diffstat:

 include/pdal/MultiFilter.hpp                |   2 +-
 include/pdal/PipelineManager.hpp            |  16 ++--
 include/pdal/Stage.hpp                      |  31 ++++++++--
 include/pdal/StageFactory.hpp               |  12 ++--
 include/pdal/Writer.hpp                     |  14 +---
 include/pdal/drivers/faux/Reader.hpp        |   1 +
 include/pdal/drivers/faux/Writer.hpp        |   3 +-
 include/pdal/drivers/las/Reader.hpp         |   1 +
 include/pdal/drivers/las/Writer.hpp         |   3 +-
 include/pdal/drivers/liblas/Reader.hpp      |   1 +
 include/pdal/drivers/liblas/Writer.hpp      |   3 +-
 include/pdal/drivers/oci/Reader.hpp         |   6 +-
 include/pdal/drivers/oci/Writer.hpp         |   5 +-
 include/pdal/drivers/qfit/Reader.hpp        |   2 +-
 include/pdal/drivers/terrasolid/Reader.hpp  |   1 +
 include/pdal/filters/ByteSwapFilter.hpp     |   5 +-
 include/pdal/filters/CacheFilter.hpp        |   1 +
 include/pdal/filters/Chipper.hpp            |   7 ++
 include/pdal/filters/ColorFilter.hpp        |   1 +
 include/pdal/filters/CropFilter.hpp         |   1 +
 include/pdal/filters/DecimationFilter.hpp   |   1 +
 include/pdal/filters/MosaicFilter.hpp       |   3 +-
 include/pdal/filters/ReprojectionFilter.hpp |   1 +
 include/pdal/filters/ScalingFilter.hpp      |   1 +
 src/MultiFilter.cpp                         |   2 +-
 src/PipelineManager.cpp                     |  40 ++-----------
 src/Stage.cpp                               |  42 ++++++++++----
 src/StageFactory.cpp                        |  83 +++++++++++++++++++++++++---
 src/Writer.cpp                              |   8 +-
 src/drivers/faux/Reader.cpp                 |   7 ++
 src/drivers/faux/Writer.cpp                 |   9 ++-
 src/drivers/las/Reader.cpp                  |   7 ++
 src/drivers/las/Writer.cpp                  |  11 +++-
 src/drivers/liblas/Reader.cpp               |   7 ++
 src/drivers/liblas/Writer.cpp               |  12 +++-
 src/drivers/oci/Reader.cpp                  |  10 +++-
 src/drivers/oci/Writer.cpp                  |  13 ++++-
 src/drivers/qfit/Reader.cpp                 |   2 +-
 src/drivers/terrasolid/Reader.cpp           |  10 +++
 src/filters/ByteSwapFilter.cpp              |   9 ++-
 src/filters/CacheFilter.cpp                 |   8 ++
 src/filters/ColorFilter.cpp                 |   7 ++
 src/filters/CropFilter.cpp                  |   8 ++
 src/filters/DecimationFilter.cpp            |   9 +++
 src/filters/MosaicFilter.cpp                |   9 ++-
 src/filters/ReprojectionFilter.cpp          |   7 ++
 src/filters/ScalingFilter.cpp               |   6 ++
 test/unit/PipelineManagerTest.cpp           |   7 ++-
 test/unit/StageFactoryTest.cpp              |  19 ++++++-
 49 files changed, 359 insertions(+), 115 deletions(-)

diffs (truncated from 1217 to 300 lines):

diff -r 23549d6e8f19 -r 76841e1d4454 include/pdal/MultiFilter.hpp
--- a/include/pdal/MultiFilter.hpp	Tue Jul 12 20:38:59 2011 -0700
+++ b/include/pdal/MultiFilter.hpp	Wed Jul 13 20:21:56 2011 -0700
@@ -47,7 +47,7 @@
 public:
     // entries may not be null
     // vector.size() must be > 0
-    MultiFilter(std::vector<const Stage*> prevStages, const Options& options);
+    MultiFilter(const std::vector<const Stage*> prevStages, const Options& options);
 
     const std::vector<const Stage*>& getPrevStages() const;
 
diff -r 23549d6e8f19 -r 76841e1d4454 include/pdal/PipelineManager.hpp
--- a/include/pdal/PipelineManager.hpp	Tue Jul 12 20:38:59 2011 -0700
+++ b/include/pdal/PipelineManager.hpp	Wed Jul 13 20:21:56 2011 -0700
@@ -62,15 +62,15 @@
     PipelineManager();
     ~PipelineManager();
 
-    boost::uint32_t addReader(const std::string& type, const Options&);
-    boost::uint32_t addFilter(const std::string& type, boost::uint32_t prevStage, const Options&);
-    boost::uint32_t addMultiFilter(const std::string& type, const std::vector<boost::uint32_t>& prevStages, const Options&);
-    boost::uint32_t addWriter(const std::string& type, boost::uint32_t prevStage, const Options&);
+    boost::shared_ptr<Reader> addReader(const std::string& type, const Options&);
+    boost::shared_ptr<Filter> addFilter(const std::string& type, const Stage& prevStage, const Options&);
+    boost::shared_ptr<MultiFilter> addMultiFilter(const std::string& type, const std::vector<const Stage*>& prevStages, const Options&);
+    boost::shared_ptr<Writer> addWriter(const std::string& type, const Stage& prevStage, const Options&);
     
-    boost::shared_ptr<Reader> getReader(boost::uint32_t);
-    boost::shared_ptr<Filter> getFilter(boost::uint32_t);
-    boost::shared_ptr<MultiFilter> getMultiFilter(boost::uint32_t);
-    boost::shared_ptr<Writer> getWriter(boost::uint32_t);
+    //boost::shared_ptr<Reader> getReader(boost::uint32_t);
+    //boost::shared_ptr<Filter> getFilter(boost::uint32_t);
+    //boost::shared_ptr<MultiFilter> getMultiFilter(boost::uint32_t);
+    //boost::shared_ptr<Writer> getWriter(boost::uint32_t);
 
 private:
     StageFactory m_factory;
diff -r 23549d6e8f19 -r 76841e1d4454 include/pdal/Stage.hpp
--- a/include/pdal/Stage.hpp	Tue Jul 12 20:38:59 2011 -0700
+++ b/include/pdal/Stage.hpp	Wed Jul 13 20:21:56 2011 -0700
@@ -54,11 +54,13 @@
 class StageBlockIterator;
 
 // every stage owns its own header, they are not shared
-class PDAL_DLL Stage
+
+// Stage and Writer both derive from StageBase
+class PDAL_DLL StageBase
 {
 public:
-    Stage(const Options& options);
-    virtual ~Stage();
+    StageBase(const Options& options);
+    virtual ~StageBase();
 
     const Options& getOptions() const;
 
@@ -69,7 +71,25 @@
     // tree for the given stage.
     virtual const std::string& getName() const = 0;
     virtual const std::string& getDescription() const = 0;
-    
+
+protected:
+    Options& getOptions();
+
+private:
+    Options m_options;
+
+    StageBase& operator=(const StageBase&); // not implemented
+    StageBase(const StageBase&); // not implemented
+};
+
+
+// Reader and Filter both derive from Stage
+class PDAL_DLL Stage : public StageBase
+{
+public:
+    Stage(const Options& options);
+    virtual ~Stage();
+   
     // core properties of all stages
     const Schema& getSchema() const;
     virtual boost::uint64_t getNumPoints() const;
@@ -89,7 +109,6 @@
     void dump() const;
 
 protected:
-    Options& getOptions();
 
     // setters for the core properties
     Schema& getSchemaRef();
@@ -106,8 +125,6 @@
     void setCoreProperties(const Stage&);
 
 private:
-    Options m_options;
-
     Schema m_schema;
     boost::uint64_t m_numPoints;
     PointCountType m_pointCountType;
diff -r 23549d6e8f19 -r 76841e1d4454 include/pdal/StageFactory.hpp
--- a/include/pdal/StageFactory.hpp	Tue Jul 12 20:38:59 2011 -0700
+++ b/include/pdal/StageFactory.hpp	Wed Jul 13 20:21:56 2011 -0700
@@ -59,17 +59,17 @@
 {
 public:
     typedef Reader* readerCreatorFunction(const Options&);
-    typedef Filter* filterCreatorFunction(boost::uint32_t prevStage, const Options&);
-    typedef MultiFilter* multifilterCreatorFunction(const std::vector<boost::uint32_t>& prevStage, const Options&);
-    typedef Writer* writerCreatorFunction(boost::uint32_t prevStage, const Options&);
+    typedef Filter* filterCreatorFunction(const Stage& prevStage, const Options&);
+    typedef MultiFilter* multifilterCreatorFunction(const std::vector<const Stage*>& prevStage, const Options&);
+    typedef Writer* writerCreatorFunction(const Stage& prevStage, const Options&);
 
 public:
     StageFactory();
 
     boost::shared_ptr<Reader> createReader(const std::string& type, const Options& options);
-    boost::shared_ptr<Filter> createFilter(const std::string& type, boost::uint32_t prevStage, const Options& options);
-    boost::shared_ptr<MultiFilter> createMultiFilter(const std::string& type, const std::vector<boost::uint32_t>& prevStage, const Options& options);
-    boost::shared_ptr<Writer> createWriter(const std::string& type, boost::uint32_t prevStage, const Options& options);
+    boost::shared_ptr<Filter> createFilter(const std::string& type, const Stage& prevStage, const Options& options);
+    boost::shared_ptr<MultiFilter> createMultiFilter(const std::string& type, const std::vector<const Stage*>& prevStage, const Options& options);
+    boost::shared_ptr<Writer> createWriter(const std::string& type, const Stage& prevStage, const Options& options);
 
     void registerReader(const std::string& type, readerCreatorFunction* f);
     void registerFilter(const std::string& type, filterCreatorFunction* f);
diff -r 23549d6e8f19 -r 76841e1d4454 include/pdal/Writer.hpp
--- a/include/pdal/Writer.hpp	Tue Jul 12 20:38:59 2011 -0700
+++ b/include/pdal/Writer.hpp	Wed Jul 13 20:21:56 2011 -0700
@@ -37,6 +37,7 @@
 
 #include <pdal/pdal.hpp>
 #include <pdal/Options.hpp>
+#include <pdal/Stage.hpp>
 
 #include <string>
 
@@ -46,10 +47,10 @@
 class Stage;
 class PointBuffer;
 
-class PDAL_DLL Writer
+class PDAL_DLL Writer : public StageBase
 {
 public:
-    Writer(Stage& prevStage, const Options& options);
+    Writer(const Stage& prevStage, const Options& options);
     virtual ~Writer() {}
 
     // size of the PointBuffer buffer to use
@@ -61,8 +62,6 @@
     // actually written.
     boost::uint64_t write(boost::uint64_t targetNumPointsToWrite);
 
-    const Options& getOptions() const;
-
 protected:
     // this is called once before the loop with the writeBuffer calls
     virtual void writeBegin() = 0;
@@ -73,17 +72,14 @@
     // called once, after the writeBuffer calls
     virtual void writeEnd() = 0;
 
-    Stage& getPrevStage();
+    const Stage& getPrevStage();
 
     // these two are valid for use after writeBegin has been called
     boost::uint64_t m_actualNumPointsWritten;
     boost::uint64_t m_targetNumPointsToWrite;
 
-    Options& getOptions();
-
 private:
-    Options m_options;
-    Stage& m_prevStage;
+    const Stage& m_prevStage;
     boost::uint32_t m_chunkSize;
     static const boost::uint32_t s_defaultChunkSize;
 
diff -r 23549d6e8f19 -r 76841e1d4454 include/pdal/drivers/faux/Reader.hpp
--- a/include/pdal/drivers/faux/Reader.hpp	Tue Jul 12 20:38:59 2011 -0700
+++ b/include/pdal/drivers/faux/Reader.hpp	Wed Jul 13 20:21:56 2011 -0700
@@ -74,6 +74,7 @@
     };
 
 public:
+    Reader(const Options& options);
     Reader(const Bounds<double>&, int numPoints, Mode mode);
     Reader(const Bounds<double>&, int numPoints, Mode mode, const std::vector<Dimension>& dimensions);
 
diff -r 23549d6e8f19 -r 76841e1d4454 include/pdal/drivers/faux/Writer.hpp
--- a/include/pdal/drivers/faux/Writer.hpp	Tue Jul 12 20:38:59 2011 -0700
+++ b/include/pdal/drivers/faux/Writer.hpp	Wed Jul 13 20:21:56 2011 -0700
@@ -52,7 +52,8 @@
 class PDAL_DLL Writer : public pdal::Writer
 {
 public:
-    Writer(Stage& prevStage);
+    Writer(const Stage& prevStage, const Options& options);
+    Writer(const Stage& prevStage);
 
     const std::string& getDescription() const;
     const std::string& getName() const;
diff -r 23549d6e8f19 -r 76841e1d4454 include/pdal/drivers/las/Reader.hpp
--- a/include/pdal/drivers/las/Reader.hpp	Tue Jul 12 20:38:59 2011 -0700
+++ b/include/pdal/drivers/las/Reader.hpp	Wed Jul 13 20:21:56 2011 -0700
@@ -56,6 +56,7 @@
 class PDAL_DLL LasReader : public LasReaderBase
 {
 public:
+    LasReader(const Options& options);
     LasReader(const std::string& filename);
 
     const std::string& getDescription() const;
diff -r 23549d6e8f19 -r 76841e1d4454 include/pdal/drivers/las/Writer.hpp
--- a/include/pdal/drivers/las/Writer.hpp	Tue Jul 12 20:38:59 2011 -0700
+++ b/include/pdal/drivers/las/Writer.hpp	Wed Jul 13 20:21:56 2011 -0700
@@ -53,7 +53,8 @@
 class PDAL_DLL LasWriter : public Writer
 {
 public:
-    LasWriter(Stage& prevStage, std::ostream&);
+    LasWriter(const Stage& prevStage, const Options& options);
+    LasWriter(const Stage& prevStage, std::ostream&);
     ~LasWriter();
 
     const std::string& getDescription() const;
diff -r 23549d6e8f19 -r 76841e1d4454 include/pdal/drivers/liblas/Reader.hpp
--- a/include/pdal/drivers/liblas/Reader.hpp	Tue Jul 12 20:38:59 2011 -0700
+++ b/include/pdal/drivers/liblas/Reader.hpp	Wed Jul 13 20:21:56 2011 -0700
@@ -56,6 +56,7 @@
 class PDAL_DLL LiblasReader : public pdal::drivers::las::LasReaderBase
 {
 public:
+    LiblasReader(const Options& options);
     LiblasReader(const std::string& filename);
     ~LiblasReader();
 
diff -r 23549d6e8f19 -r 76841e1d4454 include/pdal/drivers/liblas/Writer.hpp
--- a/include/pdal/drivers/liblas/Writer.hpp	Tue Jul 12 20:38:59 2011 -0700
+++ b/include/pdal/drivers/liblas/Writer.hpp	Wed Jul 13 20:21:56 2011 -0700
@@ -53,7 +53,8 @@
 class PDAL_DLL LiblasWriter : public Writer
 {
 public:
-    LiblasWriter(Stage& prevStage, std::ostream&);
+    LiblasWriter(const Stage& prevStage, const Options& options);
+    LiblasWriter(const Stage& prevStage, std::ostream&);
     ~LiblasWriter();
 
     const std::string& getDescription() const;
diff -r 23549d6e8f19 -r 76841e1d4454 include/pdal/drivers/oci/Reader.hpp
--- a/include/pdal/drivers/oci/Reader.hpp	Tue Jul 12 20:38:59 2011 -0700
+++ b/include/pdal/drivers/oci/Reader.hpp	Wed Jul 13 20:21:56 2011 -0700
@@ -37,7 +37,7 @@
 
 #include <pdal/pdal.hpp>
 
-#include <pdal/Stage.hpp>
+#include <pdal/Reader.hpp>
 #include <pdal/drivers/oci/common.hpp>
 
 #include <boost/scoped_ptr.hpp>
@@ -48,11 +48,11 @@
 namespace pdal { namespace drivers { namespace oci {
 
 
-
-class PDAL_DLL Reader : public pdal::Stage
+class PDAL_DLL Reader : public pdal::Reader
 {
 
 public:
+    Reader(const Options& options);
     Reader(OptionsOld& options);
     ~Reader();
     
diff -r 23549d6e8f19 -r 76841e1d4454 include/pdal/drivers/oci/Writer.hpp
--- a/include/pdal/drivers/oci/Writer.hpp	Tue Jul 12 20:38:59 2011 -0700
+++ b/include/pdal/drivers/oci/Writer.hpp	Wed Jul 13 20:21:56 2011 -0700
@@ -51,7 +51,8 @@
 {
     
 public:
-    Writer(Stage& prevStage, OptionsOld& options);
+    Writer(const Stage& prevStage, const Options& options);
+    Writer(const Stage& prevStage, OptionsOld& options);
     ~Writer();
     
     const std::string& getDescription() const;
@@ -111,7 +112,7 @@
     bool isSolid() const;
     // PointBuffer& ConstructBuffer(const PointBuffer& input) const;
     
-    Stage& m_stage;
+    const Stage& m_stage;


More information about the Liblas-commits mailing list