[Liblas-commits] hg-main-tree: remove lint

liblas-commits at liblas.org liblas-commits at liblas.org
Sun Aug 14 10:47:13 EDT 2011


details:   http://hg.libpc.orghg-main-tree/rev/88a27955763a
changeset: 1083:88a27955763a
user:      Howard Butler <hobu.inc at gmail.com>
date:      Sun Aug 14 09:39:01 2011 -0500
description:
remove lint
Subject: hg-main-tree: remove lint

details:   http://hg.libpc.orghg-main-tree/rev/3a38aae82004
changeset: 1084:3a38aae82004
user:      Howard Butler <hobu.inc at gmail.com>
date:      Sun Aug 14 09:45:31 2011 -0500
description:
remove lint
Subject: hg-main-tree: merge

details:   http://hg.libpc.orghg-main-tree/rev/5d97ff43883b
changeset: 1085:5d97ff43883b
user:      Howard Butler <hobu.inc at gmail.com>
date:      Sun Aug 14 09:47:06 2011 -0500
description:
merge

diffstat:

 include/pdal/StageBase.hpp                  |  42 +++++++++-----------------
 include/pdal/drivers/faux/Reader.hpp        |   7 ++-
 include/pdal/drivers/faux/Writer.hpp        |   7 ++-
 include/pdal/drivers/las/Reader.hpp         |   7 ++-
 include/pdal/drivers/las/Writer.hpp         |   5 +-
 include/pdal/drivers/liblas/Reader.hpp      |   5 +-
 include/pdal/drivers/liblas/Writer.hpp      |   5 +-
 include/pdal/drivers/oci/Reader.hpp         |   6 ++-
 include/pdal/drivers/oci/Writer.hpp         |   8 +++-
 include/pdal/drivers/qfit/Reader.hpp        |   6 +-
 include/pdal/drivers/terrasolid/Reader.hpp  |   6 +-
 include/pdal/filters/ByteSwapFilter.hpp     |   5 +-
 include/pdal/filters/CacheFilter.hpp        |   5 +-
 include/pdal/filters/Chipper.hpp            |   5 +-
 include/pdal/filters/ColorFilter.hpp        |   6 ++-
 include/pdal/filters/CropFilter.hpp         |   5 +-
 include/pdal/filters/DecimationFilter.hpp   |   6 ++-
 include/pdal/filters/MosaicFilter.hpp       |   6 ++-
 include/pdal/filters/ReprojectionFilter.hpp |   6 ++-
 include/pdal/filters/ScalingFilter.hpp      |  10 +++++-
 src/drivers/faux/Reader.cpp                 |   6 +--
 src/drivers/faux/Writer.cpp                 |   7 +---
 src/drivers/las/Reader.cpp                  |   9 +---
 src/drivers/las/Writer.cpp                  |   7 +---
 src/drivers/liblas/Reader.cpp               |   7 +---
 src/drivers/liblas/Writer.cpp               |   7 +---
 src/drivers/oci/Reader.cpp                  |   6 +--
 src/drivers/oci/Writer.cpp                  |  46 ++++++++++++++--------------
 src/drivers/qfit/Reader.cpp                 |   7 +---
 src/drivers/terrasolid/Reader.cpp           |   6 +--
 src/filters/ByteSwapFilter.cpp              |   7 +---
 src/filters/CacheFilter.cpp                 |   5 +--
 src/filters/Chipper.cpp                     |   6 +--
 src/filters/ColorFilter.cpp                 |   7 +---
 src/filters/CropFilter.cpp                  |   7 +---
 src/filters/DecimationFilter.cpp            |   7 +---
 src/filters/MosaicFilter.cpp                |   6 +--
 src/filters/ReprojectionFilter.cpp          |   6 +--
 src/filters/ScalingFilter.cpp               |  11 +-----
 test/unit/LasWriterTest.cpp                 |  10 +++--
 test/unit/MosaicFilterTest.cpp              |   2 +-
 test/unit/OptionsTest.cpp                   |   5 ++-
 test/unit/Support.cpp                       |   9 +++++
 test/unit/Support.hpp                       |  14 +++-----
 44 files changed, 173 insertions(+), 195 deletions(-)

diffs (truncated from 1129 to 300 lines):

diff -r 42e1b3e69f3f -r 5d97ff43883b include/pdal/StageBase.hpp
--- a/include/pdal/StageBase.hpp	Fri Aug 12 14:46:55 2011 -0500
+++ b/include/pdal/StageBase.hpp	Sun Aug 14 09:47:06 2011 -0500
@@ -84,39 +84,27 @@
     bool isVerbose() const; // true iff verbosity>0 
     boost::uint8_t getVerboseLevel() const; 
 
-    // For Name, Description, and DefaultOptions:
-    //   each concrete class should provide a static function s_getX() which returns a static object
-    //   each concrete class should provide a virtual getX() which returns s_getX()
-    // This is automated via the GenerateStatics() macro below.
+    // Everyone must implement this.  If you want to access the list of 
+    // options "statically", you are free to construct the stage with no
+    // arguments and cal getDefaultOptions() on it -- there is no need
+    // to call initialize(), so it should be a fast/safe operation.
+    virtual const Options getDefaultOptions() const = 0;
 
     // Use a dotted, XPath-style name for your 
     // stage.  For example, 'drivers.las.reader' or 'filters.crop'.  This 
     // XPath-style name will also correspond to an entry in the pdal::Options
     // tree for the given stage.
+    virtual std::string getName() const = 0;
+    virtual std::string getDescription() const = 0;
 
-    virtual const Options& getDefaultOptions() const = 0; // { return s_getDefaultOptions(); }
-    virtual const std::string& getName() const = 0; // { return s_getName(); }
-    virtual const std::string& getDescription() const = 0; // { return s_getDescription(); }
-    //static const Options& s_getDefaultOptions();
-    //static const std::string& s_getName();
-    //static const std::string& s_getDescription();
-    
-#define DECLARE_STATICS  \
-    public: \
-    static const Options& s_getDefaultOptions(); \
-    virtual const Options& getDefaultOptions() const;  \
-    static const std::string& s_getName();  \
-    virtual const std::string& getName() const;  \
-    static const std::string& s_getDescription();  \
-    virtual const std::string& getDescription() const;  \
-    private:
-
-#define IMPLEMENT_STATICS(T, name, description)  \
-    const Options& T::getDefaultOptions() const { return s_getDefaultOptions(); }  \
-    const std::string& T::s_getName() { static std::string s(name); return s; }  \
-    const std::string& T::getName() const { return s_getName(); }  \
-    const std::string& T::s_getDescription() { static std::string s(description); return s; }  \
-    const std::string& T::getDescription() const { return s_getDescription(); }
+    // For getName() and getDescription(), each stage provides a static and 
+    // a dynamic version of the function.  Each (concrete) stage should call 
+    // the following macro to create the functions for you.
+#define SET_STAGE_NAME(name, description)  \
+    static std::string s_getName() { return name; }  \
+    std::string getName() const { return name; }  \
+    static std::string s_getDescription() { return description; }  \
+    std::string getDescription() const { return description; }
 
 protected:
     Options& getOptions();
diff -r 42e1b3e69f3f -r 5d97ff43883b include/pdal/drivers/faux/Reader.hpp
--- a/include/pdal/drivers/faux/Reader.hpp	Fri Aug 12 14:46:55 2011 -0500
+++ b/include/pdal/drivers/faux/Reader.hpp	Sun Aug 14 09:47:06 2011 -0500
@@ -65,8 +65,6 @@
 //
 class PDAL_DLL Reader : public pdal::Reader
 {
-    DECLARE_STATICS
-
 public:
     enum Mode
     {
@@ -76,11 +74,14 @@
     };
 
 public:
+    SET_STAGE_NAME("drivers.faux.reader", "Faux Reader")
+
     Reader(const Options& options);
     Reader(const Bounds<double>&, boost::uint64_t numPoints, Mode mode);
     Reader(const Bounds<double>&, boost::uint64_t numPoints, Mode mode, const std::vector<Dimension>& dimensions);
-
+    
     virtual void initialize();
+    virtual const Options getDefaultOptions() const;
     
     Mode getMode() const;
     
diff -r 42e1b3e69f3f -r 5d97ff43883b include/pdal/drivers/faux/Writer.hpp
--- a/include/pdal/drivers/faux/Writer.hpp	Fri Aug 12 14:46:55 2011 -0500
+++ b/include/pdal/drivers/faux/Writer.hpp	Sun Aug 14 09:47:06 2011 -0500
@@ -51,12 +51,13 @@
 //
 class PDAL_DLL Writer : public pdal::Writer
 {
-    DECLARE_STATICS
+public:
+    SET_STAGE_NAME("drivers.faux.writer", "Faux Writer")
 
-public:
     Writer(Stage& prevStage, const Options&);
-
+    
     virtual void initialize();
+    virtual const Options getDefaultOptions() const;
 
     // retrieve the summary info
     double getMinX() const { return m_minimumX; }
diff -r 42e1b3e69f3f -r 5d97ff43883b include/pdal/drivers/las/Reader.hpp
--- a/include/pdal/drivers/las/Reader.hpp	Fri Aug 12 14:46:55 2011 -0500
+++ b/include/pdal/drivers/las/Reader.hpp	Sun Aug 14 09:47:06 2011 -0500
@@ -55,13 +55,14 @@
 
 class PDAL_DLL LasReader : public LasReaderBase
 {
-    DECLARE_STATICS
+public:
+    SET_STAGE_NAME("drivers.las.reader", "Las Reader")
 
-public:
     LasReader(const Options&);
     LasReader(const std::string& filename);
-
+    
     virtual void initialize();
+    virtual const Options getDefaultOptions() const;
 
     const std::string& getFileName() const;
 
diff -r 42e1b3e69f3f -r 5d97ff43883b include/pdal/drivers/las/Writer.hpp
--- a/include/pdal/drivers/las/Writer.hpp	Fri Aug 12 14:46:55 2011 -0500
+++ b/include/pdal/drivers/las/Writer.hpp	Sun Aug 14 09:47:06 2011 -0500
@@ -53,14 +53,15 @@
 
 class PDAL_DLL LasWriter : public Writer
 {
-    DECLARE_STATICS
+public:
+    SET_STAGE_NAME("drivers.las.writer", "Las Writer")
 
-public:
     LasWriter(Stage& prevStage, const Options&);
     LasWriter(Stage& prevStage, std::ostream*);
     ~LasWriter();
 
     virtual void initialize();
+    virtual const Options getDefaultOptions() const;
 
     void setFormatVersion(boost::uint8_t majorVersion, boost::uint8_t minorVersion);
     void setPointFormat(PointFormat);
diff -r 42e1b3e69f3f -r 5d97ff43883b include/pdal/drivers/liblas/Reader.hpp
--- a/include/pdal/drivers/liblas/Reader.hpp	Fri Aug 12 14:46:55 2011 -0500
+++ b/include/pdal/drivers/liblas/Reader.hpp	Sun Aug 14 09:47:06 2011 -0500
@@ -55,14 +55,15 @@
 
 class PDAL_DLL LiblasReader : public pdal::drivers::las::LasReaderBase
 {
-    DECLARE_STATICS
+public:
+    SET_STAGE_NAME("drivers.liblas.reader", "Liblas Reader")
 
-public:
     LiblasReader(const Options&);
     LiblasReader(const std::string& filename);
     ~LiblasReader();
 
     virtual void initialize();
+    virtual const Options getDefaultOptions() const;
 
     const std::string& getFileName() const;
 
diff -r 42e1b3e69f3f -r 5d97ff43883b include/pdal/drivers/liblas/Writer.hpp
--- a/include/pdal/drivers/liblas/Writer.hpp	Fri Aug 12 14:46:55 2011 -0500
+++ b/include/pdal/drivers/liblas/Writer.hpp	Sun Aug 14 09:47:06 2011 -0500
@@ -53,14 +53,15 @@
 // we default to LAS 1.2, point format 0
 class PDAL_DLL LiblasWriter : public Writer
 {
-    DECLARE_STATICS
+public:
+    SET_STAGE_NAME("drivers.liblas.writer", "Liblas Writer")
 
-public:
     LiblasWriter(Stage& prevStage, const Options&);
     LiblasWriter(Stage& prevStage, std::ostream*);
     ~LiblasWriter();
 
     virtual void initialize();
+    virtual const Options getDefaultOptions() const;
 
     void setFormatVersion(boost::uint8_t majorVersion, boost::uint8_t minorVersion);
     void setPointFormat(::pdal::drivers::las::PointFormat);
diff -r 42e1b3e69f3f -r 5d97ff43883b include/pdal/drivers/oci/Reader.hpp
--- a/include/pdal/drivers/oci/Reader.hpp	Fri Aug 12 14:46:55 2011 -0500
+++ b/include/pdal/drivers/oci/Reader.hpp	Sun Aug 14 09:47:06 2011 -0500
@@ -51,12 +51,14 @@
 
 class PDAL_DLL Reader : public pdal::Reader
 {
-    DECLARE_STATICS
+public:
+    SET_STAGE_NAME("drivers.oci.reader", "OCI Reader")
 
-public:
     Reader(const Options&);
     ~Reader();
+
     virtual void initialize();
+    virtual const Options getDefaultOptions() const;
  
     bool supportsIterator (StageIteratorType t) const
     {   
diff -r 42e1b3e69f3f -r 5d97ff43883b include/pdal/drivers/oci/Writer.hpp
--- a/include/pdal/drivers/oci/Writer.hpp	Fri Aug 12 14:46:55 2011 -0500
+++ b/include/pdal/drivers/oci/Writer.hpp	Sun Aug 14 09:47:06 2011 -0500
@@ -49,12 +49,14 @@
 
 class PDAL_DLL Writer : public pdal::Writer
 {
-    DECLARE_STATICS
+public:
+    SET_STAGE_NAME("drivers.oci.writer", "OCI Writer")
 
-public:
     Writer(Stage& prevStage, const Options&);
     ~Writer();
+
     virtual void initialize();
+    virtual const Options getDefaultOptions() const;
 
     void run(std::ostringstream const& command);
     inline void setBounds(pdal::Bounds<double> bounds) {m_bounds = bounds; }
@@ -101,7 +103,7 @@
     
     template<typename T> T getDefaultedOption(std::string const& option_name) const
     {
-        T default_value = Writer::s_getDefaultOptions().getOption<T>(option_name).getValue();
+        T default_value = getDefaultOptions().getOption<T>(option_name).getValue();
         return getOptions().getValueOrDefault<T>(option_name, default_value);
     }
     
diff -r 42e1b3e69f3f -r 5d97ff43883b include/pdal/drivers/qfit/Reader.hpp
--- a/include/pdal/drivers/qfit/Reader.hpp	Fri Aug 12 14:46:55 2011 -0500
+++ b/include/pdal/drivers/qfit/Reader.hpp	Sun Aug 14 09:47:06 2011 -0500
@@ -119,17 +119,17 @@
 
 class PDAL_DLL Reader : public pdal::Reader
 {
-    DECLARE_STATICS
+public:
+    SET_STAGE_NAME("drivers.qfit.reader", "QFIT Reader")
 
-public:
     Reader(const Options& options);
     ~Reader();
     
     virtual void initialize();
+    virtual const Options getDefaultOptions() const;
 
     std::string getFileName() const;
 
- 
     bool supportsIterator (StageIteratorType t) const
     {   
         if (t == StageIterator_Sequential ) return true;
diff -r 42e1b3e69f3f -r 5d97ff43883b include/pdal/drivers/terrasolid/Reader.hpp
--- a/include/pdal/drivers/terrasolid/Reader.hpp	Fri Aug 12 14:46:55 2011 -0500
+++ b/include/pdal/drivers/terrasolid/Reader.hpp	Sun Aug 14 09:47:06 2011 -0500
@@ -127,18 +127,18 @@
 
 class PDAL_DLL Reader : public pdal::Reader
 {
-    DECLARE_STATICS
+public:
+    SET_STAGE_NAME("drivers.terrasolid.reader", "TerraSolid Reader")
 
-public:
     Reader(const Options&);
     Reader(OptionsOld& options);
     ~Reader();
     
     virtual void initialize();
+    virtual const Options getDefaultOptions() const;
 
     std::string getFileName() const;
 
- 
     bool supportsIterator (StageIteratorType t) const
     {   
         if (t == StageIterator_Sequential ) return true;
diff -r 42e1b3e69f3f -r 5d97ff43883b include/pdal/filters/ByteSwapFilter.hpp
--- a/include/pdal/filters/ByteSwapFilter.hpp	Fri Aug 12 14:46:55 2011 -0500
+++ b/include/pdal/filters/ByteSwapFilter.hpp	Sun Aug 14 09:47:06 2011 -0500
@@ -54,13 +54,14 @@
 // updates the header accordingly
 class PDAL_DLL ByteSwapFilter : public Filter
 {
-    DECLARE_STATICS
+public:
+    SET_STAGE_NAME("filters.byteswap", "Crop Filter")
 
-public:


More information about the Liblas-commits mailing list