[Liblas-commits] hg-main-tree: include guard typo

liblas-commits at liblas.org liblas-commits at liblas.org
Sat Jul 23 00:03:49 EDT 2011


details:   http://hg.libpc.orghg-main-tree/rev/6d870c14151e
changeset: 918:6d870c14151e
user:      Michael P. Gerlek <mpg at flaxen.com>
date:      Fri Jul 22 15:12:30 2011 -0700
description:
include guard typo
Subject: hg-main-tree: start turning back on stage factory, pipeline mangler

details:   http://hg.libpc.orghg-main-tree/rev/0ba29808a866
changeset: 919:0ba29808a866
user:      Michael P. Gerlek <mpg at flaxen.com>
date:      Fri Jul 22 21:03:36 2011 -0700
description:
start turning back on stage factory, pipeline mangler

diffstat:

 include/pdal/filters/ByteSwapFilter.hpp |    4 +-
 src/PipelineManager.cpp                 |   10 +-
 src/StageFactory.cpp                    |  100 +++++++++++++++++++------------
 test/unit/PipelineManagerTest.cpp       |   16 ++--
 test/unit/StageFactoryTest.cpp          |   56 ++++++++---------
 5 files changed, 104 insertions(+), 82 deletions(-)

diffs (truncated from 336 to 300 lines):

diff -r a3cb4cf5201a -r 0ba29808a866 include/pdal/filters/ByteSwapFilter.hpp
--- a/include/pdal/filters/ByteSwapFilter.hpp	Fri Jul 22 15:09:33 2011 -0700
+++ b/include/pdal/filters/ByteSwapFilter.hpp	Fri Jul 22 21:03:36 2011 -0700
@@ -32,8 +32,8 @@
 * OF SUCH DAMAGE.
 ****************************************************************************/
 
-#ifndef INCLUDED_FILTERS_CROPFILTER_HPP
-#define INCLUDED_FILTERS_CROPFILTER_HPP
+#ifndef INCLUDED_FILTERS_BYTESWAPFILTER_HPP
+#define INCLUDED_FILTERS_BYTESWAPFILTER_HPP
 
 #include <pdal/pdal.hpp>
 
diff -r a3cb4cf5201a -r 0ba29808a866 src/PipelineManager.cpp
--- a/src/PipelineManager.cpp	Fri Jul 22 15:09:33 2011 -0700
+++ b/src/PipelineManager.cpp	Fri Jul 22 21:03:36 2011 -0700
@@ -160,8 +160,8 @@
 Filter* PipelineManager::parseFilter(const boost::property_tree::ptree& tree)
 {
     Options options;
-    std::string type;
-    Stage* prevStage;
+    std::string type = "";
+    Stage* prevStage = NULL;
 
     boost::property_tree::ptree::const_iterator iter = tree.begin();
     while (iter != tree.end())
@@ -208,7 +208,7 @@
 MultiFilter* PipelineManager::parseMultiFilter(const boost::property_tree::ptree& tree)
 {
     Options options;
-    std::string type;
+    std::string type = "";
     std::vector<const Stage*> prevStages;
 
     boost::property_tree::ptree::const_iterator iter = tree.begin();
@@ -259,8 +259,8 @@
 Writer* PipelineManager::parseWriter(const boost::property_tree::ptree& tree)
 {
     Options options;
-    std::string type;
-    Stage* prevStage;
+    std::string type = "";
+    Stage* prevStage = NULL;
 
     boost::property_tree::ptree::const_iterator iter = tree.begin();
     while (iter != tree.end())
diff -r a3cb4cf5201a -r 0ba29808a866 src/StageFactory.cpp
--- a/src/StageFactory.cpp	Fri Jul 22 15:09:33 2011 -0700
+++ b/src/StageFactory.cpp	Fri Jul 22 21:03:36 2011 -0700
@@ -68,29 +68,41 @@
 namespace pdal
 {
 
-Reader* create_drivers_faux_reader(const Options& options) { return 0;}//new pdal::drivers::faux::Reader(options); }
+#define MAKE_READER_CREATOR(T, FullT) \
+    Reader* create_##T(const Options& options) { return new FullT(options); }
 
-Reader* create_drivers_las_reader(const Options& options) { return 0;}//new pdal::drivers::las::LasReader(options); }
-Reader* create_drivers_liblas_reader(const Options& options) { return 0;}//new pdal::drivers::liblas::LiblasReader(options); }
-Reader* create_drivers_oci_reader(const Options& options) { return 0;}//new pdal::drivers::oci::Reader(options); }
-Reader* create_drivers_qfit_reader(const Options& options) { return 0;}//new pdal::drivers::qfit::Reader(options); }
-Reader* create_drivers_terrasolid_reader(const Options& options) { return 0;}//new pdal::drivers::terrasolid::Reader(options); }
+#define MAKE_FILTER_CREATOR(T, FullT) \
+    Filter* create_##T(const Stage& prevStage, const Options& options) { return new FullT(prevStage, options); }
 
-Writer* create_drivers_faux_writer(const Stage& prevStage, const Options& options) { return 0;}//new pdal::drivers::faux::Writer(prevStage, options); }
-Writer* create_drivers_las_writer(const Stage& prevStage, const Options& options) { return 0;}//new pdal::drivers::las::LasWriter(prevStage, options); }
-Writer* create_drivers_liblas_writer(const Stage& prevStage, const Options& options) { return 0;}//new pdal::drivers::liblas::LiblasWriter(prevStage, options); }
-Writer* create_drivers_oci_writer(const Stage& prevStage, const Options& options) { return 0;}//new pdal::drivers::oci::Writer(prevStage, options); }
+#define MAKE_MULTIFILTER_CREATOR(T, FullT) \
+    MultiFilter* create_##T(const std::vector<const Stage*>& prevStages, const Options& options) { return new FullT(prevStages, options); }
 
-Filter* create_filters_byteswapfilter(const Stage& prevStage, const Options& options) { return 0;}//new pdal::filters::ByteSwapFilter(prevStage, options); }
-Filter* create_filters_cachefilter(const Stage& prevStage, const Options& options) { return 0;}//new pdal::filters::CacheFilter(prevStage, options); }
-Filter* create_filters_chipper(const Stage& prevStage, const Options& options) { return 0;}//new pdal::filters::Chipper(prevStage, options); }
-Filter* create_filters_colorfilter(const Stage& prevStage, const Options& options) { return 0;}//new pdal::filters::ColorFilter(prevStage, options); }
-Filter* create_filters_cropfilter(const Stage& prevStage, const Options& options) { return 0;}//new pdal::filters::CropFilter(prevStage, options); }
-Filter* create_filters_decimationfilter(const Stage& prevStage, const Options& options) { return 0;}//new pdal::filters::DecimationFilter(prevStage, options); }
-Filter* create_filters_reprojectionfilter(const Stage& prevStage, const Options& options) { return 0;}//new pdal::filters::ReprojectionFilter(prevStage, options); }
-Filter* create_filters_scalingfilter(const Stage& prevStage, const Options& options) { return 0;}//new pdal::filters::ScalingFilter(prevStage, options); }
+#define MAKE_WRITER_CREATOR(T, FullT) \
+    Writer* create_##T(const Stage& prevStage, const Options& options) { return new FullT(prevStage, options); }
 
-MultiFilter* create_filters_mosaicfilter(const std::vector<const Stage*>& prevStages, const Options& options) { return 0;}//new pdal::filters::MosaicFilter(prevStages, options); }
+MAKE_READER_CREATOR(FauxReader, pdal::drivers::faux::Reader)
+MAKE_READER_CREATOR(LasReader, pdal::drivers::las::LasReader);
+MAKE_READER_CREATOR(LiblasReader, pdal::drivers::liblas::LiblasReader)
+MAKE_READER_CREATOR(OciReader, pdal::drivers::oci::Reader)
+MAKE_READER_CREATOR(QfitReader, pdal::drivers::qfit::Reader)
+MAKE_READER_CREATOR(TerrasolidReader, pdal::drivers::terrasolid::Reader)
+
+MAKE_FILTER_CREATOR(ByteSwapFilter, pdal::filters::ByteSwapFilter)
+MAKE_FILTER_CREATOR(CacheFilter, pdal::filters::CacheFilter)
+MAKE_FILTER_CREATOR(Chipper, pdal::filters::Chipper)
+MAKE_FILTER_CREATOR(ColorFilter, pdal::filters::ColorFilter)
+MAKE_FILTER_CREATOR(CropFilter, pdal::filters::CropFilter)
+MAKE_FILTER_CREATOR(DecimationFilter, pdal::filters::DecimationFilter)
+MAKE_FILTER_CREATOR(ReprojectionFilter, pdal::filters::ReprojectionFilter)
+MAKE_FILTER_CREATOR(ScalingFilter, pdal::filters::ScalingFilter)
+
+MAKE_MULTIFILTER_CREATOR(MosaicFilter, pdal::filters::MosaicFilter)
+
+MAKE_WRITER_CREATOR(FauxWriter, pdal::drivers::faux::Writer)
+MAKE_WRITER_CREATOR(LasWriter, pdal::drivers::las::LasWriter)
+MAKE_WRITER_CREATOR(LiblasWriter, pdal::drivers::liblas::LiblasWriter)
+MAKE_WRITER_CREATOR(OciWriter, pdal::drivers::oci::Writer)
+
 
 
 StageFactory::StageFactory()
@@ -200,40 +212,52 @@
 
 void StageFactory::registerKnownReaders()
 {
-    registerReader("drivers.faux.reader", create_drivers_faux_reader);
-    registerReader("drivers.las.reader", create_drivers_las_reader);
-    registerReader("drivers.liblas.reader", create_drivers_liblas_reader);
-    registerReader("drivers.oci.reader", create_drivers_oci_reader);
-    registerReader("drivers.qfit.reader", create_drivers_qfit_reader);
-    registerReader("drivers.terrasolid.reader", create_drivers_terrasolid_reader);
+#define REGISTER_READER(T, FullT) \
+    registerReader(FullT::s_getName(), create_##T)
+
+    REGISTER_READER(FauxReader, pdal::drivers::faux::Reader);
+    REGISTER_READER(LasReader, pdal::drivers::las::LasReader);
+    REGISTER_READER(LiblasReader, pdal::drivers::liblas::LiblasReader);
+    REGISTER_READER(OciReader, pdal::drivers::oci::Reader);
+    REGISTER_READER(QfitReader, pdal::drivers::qfit::Reader);
+    REGISTER_READER(TerrasolidReader, pdal::drivers::terrasolid::Reader);
 }
 
 
 void StageFactory::registerKnownFilters()
 {
-    registerFilter("filters.byteswap", create_filters_byteswapfilter);
-    registerFilter("filters.cache", create_filters_cachefilter);
-    registerFilter("filters.chipper", create_filters_chipper);
-    registerFilter("filters.color", create_filters_colorfilter);
-    registerFilter("filters.crop", create_filters_cropfilter);
-    registerFilter("filters.decimation", create_filters_decimationfilter);
-    registerFilter("filters.reprojection", create_filters_reprojectionfilter);
-    registerFilter("filters.scaling", create_filters_scalingfilter);
+#define REGISTER_FILTER(T, FullT) \
+    registerFilter(FullT::s_getName(), create_##T)
+
+    REGISTER_FILTER(ByteSwapFilter, pdal::filters::ByteSwapFilter);
+    REGISTER_FILTER(CacheFilter, pdal::filters::CacheFilter);
+    REGISTER_FILTER(Chipper, pdal::filters::Chipper);
+    REGISTER_FILTER(ColorFilter, pdal::filters::ColorFilter);
+    REGISTER_FILTER(CropFilter, pdal::filters::CropFilter);
+    REGISTER_FILTER(DecimationFilter, pdal::filters::DecimationFilter);
+    REGISTER_FILTER(ReprojectionFilter, pdal::filters::ReprojectionFilter);
+    REGISTER_FILTER(ScalingFilter, pdal::filters::ScalingFilter);
 }
 
 
 void StageFactory::registerKnownMultiFilters()
 {
-    registerMultiFilter("filters.mosaic", create_filters_mosaicfilter);
+#define REGISTER_MULTIFILTER(T, FullT) \
+    registerMultiFilter(FullT::s_getName(), create_##T)
+    
+    REGISTER_MULTIFILTER(MosaicFilter, pdal::filters::MosaicFilter);
 }
 
 
 void StageFactory::registerKnownWriters()
 {
-    registerWriter("drivers.faux.writer", create_drivers_faux_writer);
-    registerWriter("drivers.las.writer", create_drivers_las_writer);
-    registerWriter("drivers.liblas.writer", create_drivers_liblas_writer);
-    registerWriter("drivers.oci.writer", create_drivers_oci_writer);
+#define REGISTER_WRITER(T, FullT) \
+    registerWriter(FullT::s_getName(), create_##T)
+
+    REGISTER_WRITER(FauxWriter, pdal::drivers::faux::Writer);
+    REGISTER_WRITER(LasWriter, pdal::drivers::las::LasWriter);
+    REGISTER_WRITER(LiblasWriter, pdal::drivers::liblas::LiblasWriter);
+    REGISTER_WRITER(OciWriter, pdal::drivers::oci::Writer);
 }
 
 
diff -r a3cb4cf5201a -r 0ba29808a866 test/unit/PipelineManagerTest.cpp
--- a/test/unit/PipelineManagerTest.cpp	Fri Jul 22 15:09:33 2011 -0700
+++ b/test/unit/PipelineManagerTest.cpp	Fri Jul 22 21:03:36 2011 -0700
@@ -51,19 +51,19 @@
 BOOST_AUTO_TEST_CASE(PipelineManagerTest_test1)
 {
     PipelineManager mgr;
-#if 0
+
     Options optsR;
     optsR.add("filename", Support::datapath("1.2-with-color.las"), "file to read from");
-    Reader* reader = mgr.addReader("drivers.las.reader", optsR);
+    //Reader* reader = mgr.addReader("drivers.las.reader", optsR);
 
     Options optsF;
     optsF.add("bounds", Bounds<double>(0,0,0,1,1,1), "crop bounds");
-    Filter* filter = mgr.addFilter("filters.crop", *reader, optsF);
+    //Filter* filter = mgr.addFilter("filters.crop", *reader, optsF);
 
     Options optsW;
     optsW.add("filename", "temp.las", "file to write to");
-    Writer* writer = mgr.addWriter("drivers.las.writer", *filter, optsW);
-#endif
+    //Writer* writer = mgr.addWriter("drivers.las.writer", *filter, optsW);
+
     return;
 }
 
@@ -71,9 +71,9 @@
 BOOST_AUTO_TEST_CASE(PipelineManagerTest_test2)
 {
     PipelineManager mgr;
-#if 0
-    mgr.readXml(Support::datapath("pipeline1.xml"));
-#endif
+
+    //mgr.readXml(Support::datapath("pipeline1.xml"));
+
     return;
 }
 
diff -r a3cb4cf5201a -r 0ba29808a866 test/unit/StageFactoryTest.cpp
--- a/test/unit/StageFactoryTest.cpp	Fri Jul 22 15:09:33 2011 -0700
+++ b/test/unit/StageFactoryTest.cpp	Fri Jul 22 21:03:36 2011 -0700
@@ -55,33 +55,31 @@
 {
     StageFactory factory;
 
-#if 0
     Options optsR;
     optsR.add("filename", Support::datapath("1.2-with-color.las"), "file to read from");
-    Reader* ptrR = factory.createReader("drivers.las.reader", optsR);
-    BOOST_CHECK(ptrR->getName() == "drivers.las.reader");
+    //Reader* ptrR = factory.createReader("drivers.las.reader", optsR);
+    //BOOST_CHECK(ptrR->getName() == "drivers.las.reader");
 
     Options optsF;
     optsF.add("bounds", Bounds<double>(0,0,0,1,1,1), "crop bounds");
-    Filter* ptrF = factory.createFilter("filters.crop", *ptrR, optsF);
-    BOOST_CHECK(ptrF->getName() == "filters.crop");
+    //Filter* ptrF = factory.createFilter("filters.crop", *ptrR, optsF);
+    //BOOST_CHECK(ptrF->getName() == "filters.crop");
 
     Options optsM;
     std::vector<const Stage*> stages;
-    stages.push_back(ptrR);
-    MultiFilter* ptrM = factory.createMultiFilter("filters.mosaic", stages, optsM);
-    BOOST_CHECK(ptrM->getName() == "filters.mosaic");
+    //stages.push_back(ptrR);
+    //MultiFilter* ptrM = factory.createMultiFilter("filters.mosaic", stages, optsM);
+    //BOOST_CHECK(ptrM->getName() == "filters.mosaic");
 
     Options optsW;
     optsW.add("filename", "temp.las", "file to write to");
-    Writer* ptrW = factory.createWriter("drivers.las.writer", *ptrF, optsW);
-    BOOST_CHECK(ptrW->getName() == "drivers.las.writer");
-#endif
+    //Writer* ptrW = factory.createWriter("drivers.las.writer", *ptrF, optsW);
+    //BOOST_CHECK(ptrW->getName() == "drivers.las.writer");
 
     return;
 }
 
-#if 0
+
 static int s_demoflag = 0;
 static Reader* demoReaderCreator(const Options& options)
 {
@@ -127,12 +125,12 @@
     Writer* writer = new pdal::drivers::las::LasWriter(prev, optsW);
     return writer;
 }
-#endif
 
-BOOST_AUTO_TEST_CASE(test2)
+
+BOOST_AUTO_TEST_CASE(StageFactoryTest_test2)
 {
     StageFactory factory;
-#if 0
+
     factory.registerReader("demoR", demoReaderCreator);
     factory.registerFilter("demoF", demoFilterCreator);
     factory.registerMultiFilter("demoM", demoMultiFilterCreator);
@@ -141,33 +139,33 @@
     s_demoflag = 0;
     Options optsR;
     optsR.add("flag",11,"my flag");
-    Stage* reader = factory.createReader("demoR", optsR);
-    BOOST_CHECK(reader->getName() == "drivers.las.reader");
-    BOOST_CHECK(s_demoflag == 11);
+    //Stage* reader = factory.createReader("demoR", optsR);
+    //BOOST_CHECK(reader->getName() == "drivers.las.reader");
+    //BOOST_CHECK(s_demoflag == 11);
 
     s_demoflag = 0;


More information about the Liblas-commits mailing list