From 760c6f46aec8d26eff3017b13080b3943d15fe7e Mon Sep 17 00:00:00 2001 From: Pete Gadomski Date: Thu, 1 May 2014 11:30:15 -0600 Subject: [PATCH 1/5] Remove returns from BOOST_AUTO_TEST_CASEs These returns are not needed for the tests to run properly, and their inconsistent use could cause confusion down the road. Fixes #337. --- test/unit/BoundsTest.cpp | 12 ------ test/unit/ConfigTest.cpp | 4 -- test/unit/DimensionTest.cpp | 4 -- test/unit/EnvironmentTest.cpp | 4 -- test/unit/FileUtilsTest.cpp | 10 ----- test/unit/GDALUtilsTest.cpp | 6 --- test/unit/LogTest.cpp | 11 ------ test/unit/MetadataTest.cpp | 10 ----- test/unit/OptionsTest.cpp | 18 --------- test/unit/PipelineManagerTest.cpp | 4 -- test/unit/PointBufferCacheTest.cpp | 2 - test/unit/PointBufferTest.cpp | 38 ------------------- test/unit/RangeTest.cpp | 8 ---- test/unit/SchemaLayoutTest.cpp | 2 - test/unit/SchemaTest.cpp | 10 ----- test/unit/SpatialReferenceTest.cpp | 22 ----------- test/unit/StageFactoryTest.cpp | 4 -- test/unit/StreamFactoryTest.cpp | 6 --- test/unit/Support.cpp | 2 - test/unit/SupportTest.cpp | 8 ---- test/unit/ThreadTest.cpp | 4 -- test/unit/UserCallbackTest.cpp | 2 - test/unit/UtilsTest.cpp | 7 ---- test/unit/VectorTest.cpp | 3 -- test/unit/apps/pc2pcTest.cpp | 6 --- test/unit/apps/pcinfoTest.cpp | 6 --- test/unit/apps/pcpipelineTest.cpp | 4 -- test/unit/drivers/buffer/BufferReaderTest.cpp | 5 --- test/unit/drivers/caris/CarisReaderTest.cpp | 2 - test/unit/drivers/faux/FauxReaderTest.cpp | 14 ------- test/unit/drivers/faux/FauxWriterTest.cpp | 7 ---- test/unit/drivers/las/LasReaderTest.cpp | 18 --------- test/unit/drivers/las/LasWriterTest.cpp | 12 ------ test/unit/drivers/nitf/NitfReaderTest.cpp | 4 -- test/unit/drivers/nitf/NitfWriterTest.cpp | 6 --- .../drivers/pipeline/PipelineReaderTest.cpp | 12 ------ .../drivers/pipeline/PipelineWriterTest.cpp | 5 --- test/unit/drivers/qfit/QFITReaderTest.cpp | 2 - test/unit/drivers/sbet/SbetReaderTest.cpp | 8 ---- test/unit/drivers/sqlite/Writer.cpp | 2 - .../terrasolid/TerraSolidReaderTest.cpp | 3 -- test/unit/drivers/text/TextWriterTest.cpp | 5 --- test/unit/filters/ByteSwapFilterTest.cpp | 2 - test/unit/filters/CacheFilterTest.cpp | 10 ----- test/unit/filters/ChipperTest.cpp | 2 - test/unit/filters/ColorFilterTest.cpp | 2 - test/unit/filters/ColorizationFilterTest.cpp | 3 -- test/unit/filters/CropFilterTest.cpp | 4 -- test/unit/filters/DecimationFilterTest.cpp | 6 --- test/unit/filters/HexbinFilterTest.cpp | 4 -- .../filters/InPlaceReprojectionFilterTest.cpp | 6 --- test/unit/filters/MosaicFilterTest.cpp | 5 --- test/unit/filters/PCLBlockFilterTest.cpp | 4 -- test/unit/filters/ScalingFilterTest.cpp | 6 --- test/unit/filters/SelectorFilterTest.cpp | 2 - test/unit/filters/SplitterTest.cpp | 2 - test/unit/filters/StatsFilterTest.cpp | 12 ------ test/unit/plang/PLangTest.cpp | 26 ------------- test/unit/plang/PredicateFilterTest.cpp | 14 ------- test/unit/plang/ProgrammableFilterTest.cpp | 4 -- 60 files changed, 436 deletions(-) diff --git a/test/unit/BoundsTest.cpp b/test/unit/BoundsTest.cpp index 81006fa30c..ee17a1ab7a 100644 --- a/test/unit/BoundsTest.cpp +++ b/test/unit/BoundsTest.cpp @@ -218,8 +218,6 @@ BOOST_AUTO_TEST_CASE(test_grow) r4.grow(ptHi); Bounds r5(-1,-2,20,201); BOOST_CHECK(r4 == r5); - - return; } @@ -257,8 +255,6 @@ BOOST_AUTO_TEST_CASE(test_output) BOOST_CHECK_EQUAL(out2, "([1, 101], [2, 102])"); BOOST_CHECK_EQUAL(out3, "([1.1, 101.1], [2.2, 102.2], [3.3, 103.3])"); - - return; } @@ -277,8 +273,6 @@ BOOST_AUTO_TEST_CASE(BoundsTest_ptree) const std::string ref = xml_header + "<0>1101<1>2102"; BOOST_CHECK_EQUAL(ref, out1); - - return; } @@ -297,8 +291,6 @@ BOOST_AUTO_TEST_CASE(test_input) Bounds empty2; empty2_s >> empty2; BOOST_CHECK_EQUAL(true, empty2.empty()); - - return; } @@ -308,16 +300,12 @@ BOOST_AUTO_TEST_CASE(test_lexicalcast_whitespace) const Bounds b2 = boost::lexical_cast< Bounds >("([1, 101], [2, 102], [3, 103])"); BOOST_CHECK_EQUAL(b1, b2); - - return; } BOOST_AUTO_TEST_CASE(test_wkt) { const Bounds b(1.1,2.2,3.3,101.1,102.2,103.3); BOOST_CHECK_EQUAL(b.toWKT(1), "POLYGON ((1.1 2.2, 1.1 102.2, 101.1 102.2, 101.1 2.2, 1.1 2.2))"); - - return; } BOOST_AUTO_TEST_SUITE_END() diff --git a/test/unit/ConfigTest.cpp b/test/unit/ConfigTest.cpp index e0644416eb..34bee6a04e 100644 --- a/test/unit/ConfigTest.cpp +++ b/test/unit/ConfigTest.cpp @@ -65,8 +65,6 @@ BOOST_AUTO_TEST_CASE(test_3rdparty_libs) #else BOOST_CHECK(!laszip); #endif - - return; } BOOST_AUTO_TEST_CASE(test_version) @@ -87,8 +85,6 @@ BOOST_AUTO_TEST_CASE(test_version) int bignum = GetVersionInteger(); BOOST_CHECK(bignum > 0); - - return; } BOOST_AUTO_TEST_SUITE_END() diff --git a/test/unit/DimensionTest.cpp b/test/unit/DimensionTest.cpp index 84f6c5ff18..cafeffb625 100644 --- a/test/unit/DimensionTest.cpp +++ b/test/unit/DimensionTest.cpp @@ -151,9 +151,6 @@ BOOST_AUTO_TEST_CASE(DimensionTest_ptree) BOOST_CHECK_EQUAL(tree.get("namespace"), ""); BOOST_CHECK_EQUAL(tree.get("uuid"), "9bf8d966-0c0d-4c94-a14e-bce97e860bde"); - - - return; } @@ -166,7 +163,6 @@ BOOST_AUTO_TEST_CASE(DimensionTest_Interpretation) dimension::Interpretation interp = Dimension::getInterpretation(x.getInterpretationName()); BOOST_CHECK_EQUAL(interp, pdal::dimension::SignedInteger); - return; } diff --git a/test/unit/EnvironmentTest.cpp b/test/unit/EnvironmentTest.cpp index 4717197661..5961d792b3 100644 --- a/test/unit/EnvironmentTest.cpp +++ b/test/unit/EnvironmentTest.cpp @@ -54,8 +54,6 @@ BOOST_AUTO_TEST_CASE(EnvironmentTest_1) (void)python_env; #endif - - return; } boost::test_tools::predicate_result @@ -127,8 +125,6 @@ BOOST_AUTO_TEST_CASE(EnvironmentTest_rng) // } // // BOOST_CHECK(compare_uuids(e, f)); - - return; } diff --git a/test/unit/FileUtilsTest.cpp b/test/unit/FileUtilsTest.cpp index 73d8ef88de..19de41ccd5 100644 --- a/test/unit/FileUtilsTest.cpp +++ b/test/unit/FileUtilsTest.cpp @@ -90,8 +90,6 @@ BOOST_AUTO_TEST_CASE(test_readFileIntoString) const std::string ref = "Redistribution and use in source and binary forms, with or without modification..."; BOOST_CHECK(source == ref); - - return; } @@ -102,8 +100,6 @@ BOOST_AUTO_TEST_CASE(test_getcwd) const std::string cwd = FileUtils::getcwd(); BOOST_CHECK(cwd == "D:/dev/pdal/test/unit/"); #endif - - return; } @@ -149,8 +145,6 @@ BOOST_AUTO_TEST_CASE(test_toAbsolutePath) // check 1-arg version: make absolute when file is already absolute const string e = FileUtils::toAbsolutePath(drive+"/baz/foo.txt", drive+"/a/b/c/d"); compare_paths(e, drive + "/baz/foo.txt"); - - return; } @@ -163,8 +157,6 @@ BOOST_AUTO_TEST_CASE(test_getDirectory) // test relative case const std::string b = FileUtils::getDirectory("a/b/foo.txt"); compare_paths(b, "a/b/"); - - return; } @@ -177,8 +169,6 @@ BOOST_AUTO_TEST_CASE(test_isAbsolute) // test relative case const bool b = FileUtils::isAbsolutePath("a/b/foo.txt"); BOOST_CHECK(!b); - - return; } diff --git a/test/unit/GDALUtilsTest.cpp b/test/unit/GDALUtilsTest.cpp index b875343409..dc93d121ab 100644 --- a/test/unit/GDALUtilsTest.cpp +++ b/test/unit/GDALUtilsTest.cpp @@ -94,8 +94,6 @@ BOOST_AUTO_TEST_CASE(test_wrapped_vsifile_read) VSIFCloseL/*fclose*/(fp); pdal::FileUtils::deleteFile(tempfile); - - return; } @@ -146,8 +144,6 @@ BOOST_AUTO_TEST_CASE(GDALUtilsTest_test_vsifile_write) pdal::FileUtils::deleteFile(tempfile_a); pdal::FileUtils::deleteFile(tempfile_b); - - return; } @@ -208,8 +204,6 @@ BOOST_AUTO_TEST_CASE(test_wrapped_vsifile_subsequence) VSIFCloseL/*fclose*/(vsi_file); pdal::FileUtils::deleteFile(tempfile); - - return; } diff --git a/test/unit/LogTest.cpp b/test/unit/LogTest.cpp index 03a8f71fda..f27ddc3afc 100644 --- a/test/unit/LogTest.cpp +++ b/test/unit/LogTest.cpp @@ -85,9 +85,6 @@ BOOST_AUTO_TEST_CASE(test_one) { FileUtils::deleteFile(Support::temppath("mylog_one.txt")); } - - - return; } #ifdef PDAL_HAVE_PYTHON @@ -180,8 +177,6 @@ BOOST_AUTO_TEST_CASE(test_two_a) //FileUtils::deleteFile(Support::temppath("logtest_2.txt")); //FileUtils::deleteFile(Support::temppath("logtest_3.txt")); - - return; } @@ -286,8 +281,6 @@ BOOST_AUTO_TEST_CASE(test_two_b) { FileUtils::deleteFile(Support::temppath("logtest_test_two_b_3.txt")); } - - return; } @@ -352,10 +345,6 @@ BOOST_AUTO_TEST_CASE(test_three) { FileUtils::deleteFile(Support::temppath("mylog_three.txt")); } - - - - return; } #endif diff --git a/test/unit/MetadataTest.cpp b/test/unit/MetadataTest.cpp index a08036d6bd..4c5627c4a5 100644 --- a/test/unit/MetadataTest.cpp +++ b/test/unit/MetadataTest.cpp @@ -136,8 +136,6 @@ BOOST_AUTO_TEST_CASE(test_construction) m.setValue(u64); BOOST_CHECK_EQUAL(m.getValue(), 64u); BOOST_CHECK_EQUAL(m.getType(), "nonNegativeInteger"); - - return; } BOOST_AUTO_TEST_CASE(test_metadata_copy) @@ -170,8 +168,6 @@ BOOST_AUTO_TEST_CASE(test_metadata_copy) // pdal::Metadata m22 = b2.getEntry("m2"); // BOOST_CHECK_EQUAL(m22.getValue(), 1u); //BOOST_CHECK_THROW(m22.getValue(), boost::bad_get); - - return; } BOOST_AUTO_TEST_CASE(test_metadata_set) @@ -195,8 +191,6 @@ BOOST_AUTO_TEST_CASE(test_metadata_set) b.addMetadata("uuid", boost::uuids::nil_uuid()); - - return; } BOOST_AUTO_TEST_CASE(test_metadata_stage) @@ -222,8 +216,6 @@ BOOST_AUTO_TEST_CASE(test_metadata_stage) // boost::property_tree::write_xml(std::cout, pipeline_metadata.toPTree()); BOOST_CHECK_EQUAL(pipeline_metadata.toPTree().get_child("metadata").size(), 32u); - - return; } BOOST_AUTO_TEST_CASE(test_metadata_constructor_no_throw) @@ -231,8 +223,6 @@ BOOST_AUTO_TEST_CASE(test_metadata_constructor_no_throw) pdal::Bounds b; pdal::Metadata entry("name", b); - - return; } diff --git a/test/unit/OptionsTest.cpp b/test/unit/OptionsTest.cpp index 0ef5a0f629..02b156bbb3 100644 --- a/test/unit/OptionsTest.cpp +++ b/test/unit/OptionsTest.cpp @@ -62,8 +62,6 @@ BOOST_AUTO_TEST_CASE(test_static_options) BOOST_CHECK(!opts.hasOption("metes")); const boost::property_tree::ptree& pt = opts.toPTree(); BOOST_CHECK(pt.size() == 3); - - return; } @@ -95,8 +93,6 @@ BOOST_AUTO_TEST_CASE(test_option_writing) boost::property_tree::xml_parser::write_xml(ostr_s, tree_s); const std::string str_s = ostr_s.str(); BOOST_CHECK(str_s == ref_s); - - return; } @@ -121,8 +117,6 @@ BOOST_AUTO_TEST_CASE(test_option_reading) BOOST_CHECK(opt_from_ptree.getDescription() == "This is my integral option."); BOOST_CHECK(opt_from_ptree.getValue() == "17"); BOOST_CHECK(opt_from_ptree.getValue() == 17); - - return; } @@ -141,8 +135,6 @@ BOOST_AUTO_TEST_CASE(test_options_copy_ctor) BOOST_CHECK(copy.hasOption("my_int")); BOOST_CHECK(copy.hasOption("my_string")); - - return; } BOOST_AUTO_TEST_CASE(test_options_multi) @@ -164,8 +156,6 @@ BOOST_AUTO_TEST_CASE(test_options_multi) pdal::Option const& s = o->getOption("b"); BOOST_CHECK_EQUAL(s.getValue(), "2"); - - return; } BOOST_AUTO_TEST_CASE(test_options_writing) @@ -193,8 +183,6 @@ BOOST_AUTO_TEST_CASE(test_options_writing) BOOST_CHECK(val_s == "Yow."); BOOST_CHECK(desc_i == "This is my integral option."); BOOST_CHECK(desc_s == "This is my stringy option."); - - return; } @@ -211,8 +199,6 @@ BOOST_AUTO_TEST_CASE(test_options_reading) BOOST_CHECK(opt.getValue() == "17"); BOOST_CHECK(opt.getValue() == 17); - - return; } @@ -261,8 +247,6 @@ BOOST_AUTO_TEST_CASE(test_valid_options) BOOST_CHECK(options[1].getValue() == "nineteen"); } - - return; } @@ -298,8 +282,6 @@ BOOST_AUTO_TEST_CASE(Options_test_bool) BOOST_CHECK_EQUAL(bv, false); BOOST_CHECK_EQUAL(cv, true); BOOST_CHECK_EQUAL(dv, false); - - return; } diff --git a/test/unit/PipelineManagerTest.cpp b/test/unit/PipelineManagerTest.cpp index b7472bd627..3b9189de6a 100644 --- a/test/unit/PipelineManagerTest.cpp +++ b/test/unit/PipelineManagerTest.cpp @@ -70,8 +70,6 @@ BOOST_AUTO_TEST_CASE(PipelineManagerTest_test1) } FileUtils::deleteFile("temp.las"); - - return; } @@ -150,8 +148,6 @@ BOOST_AUTO_TEST_CASE(PipelineManagerTest_test2) } FileUtils::deleteFile("temp.las"); - - return; } BOOST_AUTO_TEST_SUITE_END() diff --git a/test/unit/PointBufferCacheTest.cpp b/test/unit/PointBufferCacheTest.cpp index fab7828516..e468b1dfd4 100644 --- a/test/unit/PointBufferCacheTest.cpp +++ b/test/unit/PointBufferCacheTest.cpp @@ -89,8 +89,6 @@ BOOST_AUTO_TEST_CASE(test1) BOOST_CHECK(lookupHits == 5); BOOST_CHECK(insertMisses == 4); BOOST_CHECK(insertHits == 0); - - return; } diff --git a/test/unit/PointBufferTest.cpp b/test/unit/PointBufferTest.cpp index 67f2f50885..67a470b8d0 100644 --- a/test/unit/PointBufferTest.cpp +++ b/test/unit/PointBufferTest.cpp @@ -56,8 +56,6 @@ BOOST_AUTO_TEST_CASE(test_ctor) BOOST_CHECK(data.getCapacity() == 10); BOOST_CHECK(data.getSchema() == schema); - - return; } @@ -305,8 +303,6 @@ BOOST_AUTO_TEST_CASE(PointBufferTest_ptree) const std::string ref = xml_header + "<0>100<1>210100"; BOOST_CHECK_EQUAL(ref, out1.substr(0, ref.length())); - - return; } @@ -367,8 +363,6 @@ BOOST_AUTO_TEST_CASE(PointBufferTest_ptree) // BOOST_CHECK_EQUAL(x1, x2); // // delete data; -// -// return; // } @@ -404,9 +398,6 @@ BOOST_AUTO_TEST_CASE(PointBufferTest_resetting) BOOST_CHECK_EQUAL(data.getBufferByteCapacity(), 5200u); BOOST_CHECK_EQUAL(data.getBufferByteLength(), 5200u); BOOST_CHECK_EQUAL(data.getCapacity(), 400u); - - - return; } @@ -451,8 +442,6 @@ BOOST_AUTO_TEST_CASE(PointBufferTest_copy_like_Dimensions) BOOST_CHECK_EQUAL(150, data_b.getField(x2, 150)); delete dimensions; - - return; } BOOST_AUTO_TEST_CASE(test_indexed) @@ -513,8 +502,6 @@ BOOST_AUTO_TEST_CASE(test_indexed) BOOST_CHECK_EQUAL(rids.size(), 11u); delete iter; - return; - } @@ -570,8 +557,6 @@ BOOST_AUTO_TEST_CASE(test_packing) // BOOST_CHECK_CLOSE(packed.getField(y2,7), 7 + 100, 0.000001); delete packed; - return; - } @@ -616,7 +601,6 @@ BOOST_AUTO_TEST_CASE(test_orientation) BOOST_CHECK_CLOSE(y, i + 100, 0.000001); BOOST_CHECK_EQUAL(c, 7u); } - return; } BOOST_AUTO_TEST_CASE(test_orientation_packing) @@ -666,11 +650,6 @@ BOOST_AUTO_TEST_CASE(test_orientation_packing) delete dims; delete packed; - - - - return; - } @@ -717,11 +696,6 @@ BOOST_AUTO_TEST_CASE(test_orientation_point_interleaved_flipping) BOOST_CHECK_EQUAL(flipped->getField(x2,8),8); BOOST_CHECK_CLOSE(flipped->getField(y2,7), 7 + 100, 0.000001); delete flipped; - - - - return; - } @@ -799,11 +773,6 @@ BOOST_AUTO_TEST_CASE(test_orientation_dimension_interleaved_flipping) delete flipped; delete again; - - - - return; - } @@ -893,8 +862,6 @@ BOOST_AUTO_TEST_CASE(test_copyLikeDimensions) } delete dims_offset; - return; - } BOOST_AUTO_TEST_CASE(test_copyLikeDimensions_All) @@ -1046,10 +1013,5 @@ BOOST_AUTO_TEST_CASE(PointBufferTest_dataStriding) } // delete dims; - - - - return; - } BOOST_AUTO_TEST_SUITE_END() diff --git a/test/unit/RangeTest.cpp b/test/unit/RangeTest.cpp index 9140c16520..8e5958a3a6 100644 --- a/test/unit/RangeTest.cpp +++ b/test/unit/RangeTest.cpp @@ -211,8 +211,6 @@ BOOST_AUTO_TEST_CASE(test_output) BOOST_CHECK(out1 == "[1, 2]"); BOOST_CHECK(out2 == "[1.1, 2.2]"); - - return; } @@ -230,8 +228,6 @@ BOOST_AUTO_TEST_CASE(RangeTest_ptree) const std::string ref = xml_header + "2356"; BOOST_CHECK_EQUAL(ref, out1); - - return; } @@ -244,8 +240,6 @@ BOOST_AUTO_TEST_CASE(test_input) const Range r(1.1,2.2); BOOST_CHECK(r == rr); - - return; } BOOST_AUTO_TEST_CASE(test_lexicalcast_whitespace) @@ -254,8 +248,6 @@ BOOST_AUTO_TEST_CASE(test_lexicalcast_whitespace) const Range b2 = boost::lexical_cast< Range >("[1, 101] "); BOOST_CHECK_EQUAL(b1, b2); - - return; } diff --git a/test/unit/SchemaLayoutTest.cpp b/test/unit/SchemaLayoutTest.cpp index 4bdc18e76e..801b7a0fec 100644 --- a/test/unit/SchemaLayoutTest.cpp +++ b/test/unit/SchemaLayoutTest.cpp @@ -111,8 +111,6 @@ BOOST_AUTO_TEST_CASE(SchemaLayoutTest_ptree) boost::algorithm::erase_all(out1, "\n"); boost::algorithm::erase_all(ref, "\n"); BOOST_CHECK_EQUAL(ref, out1); - - return; } #endif diff --git a/test/unit/SchemaTest.cpp b/test/unit/SchemaTest.cpp index 391caaa7a5..9d6e5b616c 100644 --- a/test/unit/SchemaTest.cpp +++ b/test/unit/SchemaTest.cpp @@ -96,8 +96,6 @@ BOOST_AUTO_TEST_CASE(SchemaTest_ptree) boost::algorithm::erase_all(ref, "\n"); BOOST_CHECK_EQUAL(ref, out1); - - return; } @@ -154,9 +152,6 @@ BOOST_AUTO_TEST_CASE(SchemaTest_orientation) s.appendDimension(y); BOOST_CHECK_EQUAL(s.getOrientation(), pdal::schema::POINT_INTERLEAVED); - - - return; } @@ -175,11 +170,6 @@ BOOST_AUTO_TEST_CASE(SchemaTest_pack) BOOST_CHECK_EQUAL(p.size(), 1); BOOST_CHECK_EQUAL(s.size(), 2); - - - - - return; } BOOST_AUTO_TEST_SUITE_END() diff --git a/test/unit/SpatialReferenceTest.cpp b/test/unit/SpatialReferenceTest.cpp index b092d75e16..f1109dcb3b 100644 --- a/test/unit/SpatialReferenceTest.cpp +++ b/test/unit/SpatialReferenceTest.cpp @@ -56,7 +56,6 @@ BOOST_AUTO_TEST_CASE(test_env_vars) BOOST_CHECK(pdal::FileUtils::fileExists(gdal_data)); BOOST_CHECK(pdal::FileUtils::fileExists(proj_lib)); #endif - return; } @@ -67,8 +66,6 @@ BOOST_AUTO_TEST_CASE(test_ctor) BOOST_CHECK(srs.getProj4() == ""); BOOST_CHECK(srs.getWKT() == ""); BOOST_CHECK(srs.empty()); - - return; } @@ -102,8 +99,6 @@ BOOST_AUTO_TEST_CASE(test_proj4_roundtrip) const std::string ret = ref.getProj4(); BOOST_CHECK(ret == proj4_out); } - - return; } @@ -123,8 +118,6 @@ BOOST_AUTO_TEST_CASE(test_userstring_roundtrip) BOOST_CHECK(ret_proj == proj4); BOOST_CHECK(ret_wkt == wkt); - - return; } @@ -146,8 +139,6 @@ BOOST_AUTO_TEST_CASE(test_read_srs) const std::string proj4 = "+proj=utm +zone=17 +datum=WGS84 +units=m +no_defs"; BOOST_CHECK(ret_proj4 == proj4); - - return; } @@ -163,8 +154,6 @@ BOOST_AUTO_TEST_CASE(test_vlr_sizes) BOOST_CHECK(vlrs.size() == boost::uint32_t(4)); BOOST_CHECK(vlrs[0].getLength() == boost::uint32_t(64)); - - return; } @@ -203,8 +192,6 @@ BOOST_AUTO_TEST_CASE(test_vertical_datum) // const std::string wkt2_ret = ref2.getWKT(pdal::SpatialReference::eCompoundOK); // BOOST_CHECK_EQUAL(wkt2_ret,wkt3); } - - return; } @@ -231,8 +218,6 @@ BOOST_AUTO_TEST_CASE(test_vertical_datum_notcompound) //BOOST_CHECK(vlrs_horizonly[1].getLength() == 16); //BOOST_CHECK(vlrs_horizonly[2].getLength() == 7); //BOOST_CHECK(vlrs_horizonly[3].getLength() == 511); - - return; } // Try writing a compound coordinate system to file and ensure we get back @@ -283,8 +268,6 @@ BOOST_AUTO_TEST_CASE(test_vertical_datums) // Cleanup pdal::FileUtils::deleteFile(tmpfile); - - return; } @@ -365,8 +348,6 @@ BOOST_AUTO_TEST_CASE(test_writing_vlr) // Cleanup pdal::FileUtils::deleteFile(tmpfile); - - return; } @@ -386,9 +367,6 @@ BOOST_AUTO_TEST_CASE(test_io) ss >> ref2; BOOST_CHECK(ref == ref2); - - - return; } #endif diff --git a/test/unit/StageFactoryTest.cpp b/test/unit/StageFactoryTest.cpp index c435a3b785..a81b50fcdb 100644 --- a/test/unit/StageFactoryTest.cpp +++ b/test/unit/StageFactoryTest.cpp @@ -90,8 +90,6 @@ BOOST_AUTO_TEST_CASE(StageFactoryTest_test1) delete reader; FileUtils::deleteFile("temp.las"); - - return; } @@ -190,8 +188,6 @@ BOOST_AUTO_TEST_CASE(StageFactoryTest_test2) delete reader; FileUtils::deleteFile("temp.las"); - - return; } diff --git a/test/unit/StreamFactoryTest.cpp b/test/unit/StreamFactoryTest.cpp index 45f9c3726a..1693c71782 100644 --- a/test/unit/StreamFactoryTest.cpp +++ b/test/unit/StreamFactoryTest.cpp @@ -84,8 +84,6 @@ BOOST_AUTO_TEST_CASE(test1) FileUtils::closeFile(ostreamname); FileUtils::deleteFile(wfilename); } - - return; } @@ -138,8 +136,6 @@ static void check_contents(std::istream& s) BOOST_CHECK(s.get() == -1); BOOST_CHECK(s.eof()); - - return; } @@ -194,8 +190,6 @@ BOOST_AUTO_TEST_CASE(test2) f.deallocate(s3); // f.deallocate(s2); // let the dtor do it for us } - - return; } BOOST_AUTO_TEST_SUITE_END() diff --git a/test/unit/Support.cpp b/test/unit/Support.cpp index eaec49606d..17bf219118 100644 --- a/test/unit/Support.cpp +++ b/test/unit/Support.cpp @@ -394,8 +394,6 @@ void Support::check_pN(const pdal::PointBuffer& data, BOOST_CHECK_EQUAL(g0, gref); BOOST_CHECK_EQUAL(b0, bref); } - - return; } diff --git a/test/unit/SupportTest.cpp b/test/unit/SupportTest.cpp index fd9067a062..6f38efb5dd 100644 --- a/test/unit/SupportTest.cpp +++ b/test/unit/SupportTest.cpp @@ -120,8 +120,6 @@ BOOST_AUTO_TEST_CASE(test_diff_file) same = Support::compare_files(Support::datapath("misc/data3.dat"), Support::datapath("misc/data1.dat")); BOOST_CHECK(diffs == 2); BOOST_CHECK(same == false); - - return; } @@ -167,8 +165,6 @@ BOOST_AUTO_TEST_CASE(test_diff_file_ignorable) diffs = Support::diff_files(Support::datapath("misc/data4a.dat"), Support::datapath("misc/data4b.dat"), start, len, 2); BOOST_CHECK(diffs == 1); } - - return; } @@ -211,8 +207,6 @@ BOOST_AUTO_TEST_CASE(test_diff_text_file) same = Support::compare_text_files(Support::datapath("misc/data3.txt"), Support::datapath("misc/data1.txt")); BOOST_CHECK(diffs == 2); BOOST_CHECK(same == false); - - return; } @@ -226,8 +220,6 @@ BOOST_AUTO_TEST_CASE(test_run_command) BOOST_CHECK_EQUAL(output.substr(0, 3), "foo"); BOOST_CHECK_EQUAL(stat, 0); - - return; } diff --git a/test/unit/ThreadTest.cpp b/test/unit/ThreadTest.cpp index cce84ab99e..07c3ee27d7 100644 --- a/test/unit/ThreadTest.cpp +++ b/test/unit/ThreadTest.cpp @@ -118,8 +118,6 @@ Options makeReaderOptions() BOOST_AUTO_TEST_CASE(test_parallel) { - //return; - #define TEN 10 Options opts[TEN][TEN]; Stage* stages[TEN][TEN]; @@ -180,8 +178,6 @@ BOOST_AUTO_TEST_CASE(test_parallel) FileUtils::deleteFile(Support::temppath("logtest_1.txt")); FileUtils::deleteFile(Support::temppath("logtest_2.txt")); FileUtils::deleteFile(Support::temppath("logtest_3.txt")); - - return; } diff --git a/test/unit/UserCallbackTest.cpp b/test/unit/UserCallbackTest.cpp index bf7fe2aec6..113ef4ada7 100644 --- a/test/unit/UserCallbackTest.cpp +++ b/test/unit/UserCallbackTest.cpp @@ -121,8 +121,6 @@ BOOST_AUTO_TEST_CASE(test1) ok = worker.doWork(); BOOST_CHECK(!ok); BOOST_CHECK_CLOSE(cb.getPercentComplete(), 51.0, 0.001); - - return; } BOOST_AUTO_TEST_SUITE_END() diff --git a/test/unit/UtilsTest.cpp b/test/unit/UtilsTest.cpp index bdb3d36172..b1b290799c 100644 --- a/test/unit/UtilsTest.cpp +++ b/test/unit/UtilsTest.cpp @@ -129,8 +129,6 @@ BOOST_AUTO_TEST_CASE(test_buffer_read_write) boost::uint8_t tmp[30]; Utils::read_n(tmp, istr, 15); BOOST_CHECK(memcmp(buf, tmp, 15) == 0); - - return; } @@ -152,8 +150,6 @@ BOOST_AUTO_TEST_CASE(test_field_read_write) BOOST_CHECK(x==one); BOOST_CHECK(Utils::compare_approx(y, two, std::numeric_limits::min()) == true); - - return; } @@ -179,9 +175,6 @@ BOOST_AUTO_TEST_CASE(test_base64) BOOST_CHECK_EQUAL(decoded.size(), data.size()); BOOST_CHECK_EQUAL(size, begin_size); - - - return; } diff --git a/test/unit/VectorTest.cpp b/test/unit/VectorTest.cpp index 3cf55d936f..b4be6a3737 100644 --- a/test/unit/VectorTest.cpp +++ b/test/unit/VectorTest.cpp @@ -134,7 +134,6 @@ BOOST_AUTO_TEST_CASE(test_dump) s << v; BOOST_CHECK(s.str() == "(1, 2, 3)"); - return; } @@ -153,8 +152,6 @@ BOOST_AUTO_TEST_CASE(VectorTest_ptree) const std::string ref = xml_header + "<0>12<1>23<2>34"; BOOST_CHECK_EQUAL(ref, out1); - - return; } diff --git a/test/unit/apps/pc2pcTest.cpp b/test/unit/apps/pc2pcTest.cpp index 3ce5cda851..0755e93f1b 100644 --- a/test/unit/apps/pc2pcTest.cpp +++ b/test/unit/apps/pc2pcTest.cpp @@ -65,8 +65,6 @@ BOOST_AUTO_TEST_CASE(pc2pcTest_test_no_input) const std::string expected = "Usage error: --input"; BOOST_CHECK_EQUAL(output.substr(0, expected.length()), expected); - - return; } #endif @@ -81,8 +79,6 @@ BOOST_AUTO_TEST_CASE(pc2pcTest_test_common_opts) stat = pdal::Utils::run_shell_command(cmd + " --version", output); BOOST_CHECK_EQUAL(stat, 0); - - return; } @@ -180,8 +176,6 @@ BOOST_AUTO_TEST_CASE(pc2pc_test_switches) pdal::FileUtils::deleteFile(outputLas); pdal::FileUtils::deleteFile(outputLaz); - - return; } diff --git a/test/unit/apps/pcinfoTest.cpp b/test/unit/apps/pcinfoTest.cpp index d8730382a1..7298205c80 100644 --- a/test/unit/apps/pcinfoTest.cpp +++ b/test/unit/apps/pcinfoTest.cpp @@ -72,8 +72,6 @@ BOOST_AUTO_TEST_CASE(pdalinfo_test_common_opts) stat = pdal::Utils::run_shell_command(cmd + " --version", output); BOOST_CHECK_EQUAL(stat, 0); - - return; } @@ -120,8 +118,6 @@ BOOST_AUTO_TEST_CASE(pdalinfo_test_switches) BOOST_CHECK_EQUAL(stat, 1); expected = "Usage error: no action option specified"; BOOST_CHECK_EQUAL(output.substr(0, expected.length()), expected); - - return; } @@ -202,8 +198,6 @@ BOOST_AUTO_TEST_CASE(pdalinfo_test_dumps) // pdal::FileUtils::deleteFile(stage_test); // else // std::cout << command.str() << std::endl; - - return; } diff --git a/test/unit/apps/pcpipelineTest.cpp b/test/unit/apps/pcpipelineTest.cpp index 1286947446..34da64b0d4 100644 --- a/test/unit/apps/pcpipelineTest.cpp +++ b/test/unit/apps/pcpipelineTest.cpp @@ -62,8 +62,6 @@ BOOST_AUTO_TEST_CASE(pcpipelineTest_no_input) const std::string expected = "Usage error: input file name required"; BOOST_CHECK_EQUAL(output.substr(0, expected.length()), expected); - - return; } #endif @@ -78,8 +76,6 @@ BOOST_AUTO_TEST_CASE(pcpipelineTest_test_common_opts) stat = pdal::Utils::run_shell_command(cmd + " --version", output); BOOST_CHECK_EQUAL(stat, 0); - - return; } diff --git a/test/unit/drivers/buffer/BufferReaderTest.cpp b/test/unit/drivers/buffer/BufferReaderTest.cpp index 20600c1f66..f449bda446 100644 --- a/test/unit/drivers/buffer/BufferReaderTest.cpp +++ b/test/unit/drivers/buffer/BufferReaderTest.cpp @@ -152,8 +152,6 @@ BOOST_AUTO_TEST_CASE(test_sequential_iter) delete iter; delete input; - - return; } BOOST_AUTO_TEST_CASE(test_random_iter) @@ -254,8 +252,6 @@ BOOST_AUTO_TEST_CASE(test_random_iter) delete iter; delete input; - - return; } @@ -291,7 +287,6 @@ BOOST_AUTO_TEST_CASE(test_iterator_write) FileUtils::deleteFile(out_filename.getValue()); delete input; - return; } diff --git a/test/unit/drivers/caris/CarisReaderTest.cpp b/test/unit/drivers/caris/CarisReaderTest.cpp index 67e4303278..e59a3c9e3e 100644 --- a/test/unit/drivers/caris/CarisReaderTest.cpp +++ b/test/unit/drivers/caris/CarisReaderTest.cpp @@ -61,8 +61,6 @@ BOOST_AUTO_TEST_SUITE(CarisReaderTest) BOOST_AUTO_TEST_CASE(test_one) { - - return; } diff --git a/test/unit/drivers/faux/FauxReaderTest.cpp b/test/unit/drivers/faux/FauxReaderTest.cpp index 787035af48..082cfad9be 100644 --- a/test/unit/drivers/faux/FauxReaderTest.cpp +++ b/test/unit/drivers/faux/FauxReaderTest.cpp @@ -88,8 +88,6 @@ BOOST_AUTO_TEST_CASE(test_constant_mode_sequential_iter) } delete iter; - - return; } @@ -140,8 +138,6 @@ BOOST_AUTO_TEST_CASE(FauxReaderTest_test_options) } delete iter; - - return; } @@ -247,8 +243,6 @@ BOOST_AUTO_TEST_CASE(test_constant_mode_random_iter) } delete iter; - - return; } @@ -298,8 +292,6 @@ BOOST_AUTO_TEST_CASE(test_random_mode) } delete iter; - - return; } BOOST_AUTO_TEST_CASE(test_ramp_mode_1) @@ -345,8 +337,6 @@ BOOST_AUTO_TEST_CASE(test_ramp_mode_1) delete iter; - - return; } @@ -390,8 +380,6 @@ BOOST_AUTO_TEST_CASE(test_ramp_mode_2) } delete iter; - - return; } @@ -430,8 +418,6 @@ BOOST_AUTO_TEST_CASE(testUnknownPointCountType) BOOST_CHECK_EQUAL(numRead, 1000); delete iter; - - return; } diff --git a/test/unit/drivers/faux/FauxWriterTest.cpp b/test/unit/drivers/faux/FauxWriterTest.cpp index 57a7ce189a..406003b519 100644 --- a/test/unit/drivers/faux/FauxWriterTest.cpp +++ b/test/unit/drivers/faux/FauxWriterTest.cpp @@ -67,9 +67,6 @@ BOOST_AUTO_TEST_CASE(FauxWriterTest_test_1) BOOST_CHECK(Utils::compare_approx(writer.getAvgX(), 1.0, (std::numeric_limits::min)()) == true); BOOST_CHECK(Utils::compare_approx(writer.getAvgY(), 2.0, (std::numeric_limits::min)()) == true); BOOST_CHECK(Utils::compare_approx(writer.getAvgZ(), 3.0, (std::numeric_limits::min)()) == true); - - - return; } BOOST_AUTO_TEST_CASE(test_2) @@ -94,8 +91,6 @@ BOOST_AUTO_TEST_CASE(test_2) BOOST_CHECK(Utils::compare_approx(writer.getAvgX(), 51.0, 10.0)); BOOST_CHECK(Utils::compare_approx(writer.getAvgY(), 52.0, 10.0)); BOOST_CHECK(Utils::compare_approx(writer.getAvgZ(), 53.0, 10.0)); - - return; } @@ -200,8 +195,6 @@ BOOST_AUTO_TEST_CASE(test_callbacks) BOOST_CHECK_EQUAL(cb.getHeartbeats(), 7u); BOOST_CHECK_EQUAL(cb.getPercentComplete(), 60); } - - return; } BOOST_AUTO_TEST_CASE(test_buffer_resize) diff --git a/test/unit/drivers/las/LasReaderTest.cpp b/test/unit/drivers/las/LasReaderTest.cpp index 7801b6fd04..7d8bdd67db 100644 --- a/test/unit/drivers/las/LasReaderTest.cpp +++ b/test/unit/drivers/las/LasReaderTest.cpp @@ -83,8 +83,6 @@ BOOST_AUTO_TEST_CASE(test_base_options) BOOST_CHECK(reader.getVerboseLevel() == 99); BOOST_CHECK(reader.isDebug() == true); } - - return; } @@ -118,8 +116,6 @@ BOOST_AUTO_TEST_CASE(test_sequential) } delete iter; - - return; } @@ -163,8 +159,6 @@ BOOST_AUTO_TEST_CASE(test_random) } delete iter; - - return; } @@ -209,8 +203,6 @@ BOOST_AUTO_TEST_CASE(test_random_laz) } delete iter; - - return; } #endif @@ -251,8 +243,6 @@ BOOST_AUTO_TEST_CASE(test_two_iters) delete iter; } - - return; } @@ -371,8 +361,6 @@ BOOST_AUTO_TEST_CASE(test_simultaneous_iters) delete iterS2; delete iterR1; delete iterR2; - - return; } static void test_a_format(const std::string& file, boost::uint8_t majorVersion, boost::uint8_t minorVersion, int pointFormat, @@ -413,8 +401,6 @@ BOOST_AUTO_TEST_CASE(test_different_formats) test_a_format("1.2_1.las", 1, 2, 1, 470692.440000, 4602888.900000, 16.000000, 1205902800.000000, 0, 0, 0); test_a_format("1.2_2.las", 1, 2, 2, 470692.440000, 4602888.900000, 16.000000, 0, 255, 12, 234); test_a_format("1.2_3.las", 1, 2, 3, 470692.440000, 4602888.900000, 16.000000, 1205902800.000000, 255, 12, 234); - - return; } @@ -424,8 +410,6 @@ BOOST_AUTO_TEST_CASE(test_vlr) reader.initialize(); BOOST_CHECK_EQUAL(reader.getLasHeader().getVLRs().getAll().size(), 390); - - return; } @@ -468,8 +452,6 @@ BOOST_AUTO_TEST_CASE(test_no_xyz) delete iter; - - return; } diff --git a/test/unit/drivers/las/LasWriterTest.cpp b/test/unit/drivers/las/LasWriterTest.cpp index 1934edf0c1..fb8bb7f13d 100644 --- a/test/unit/drivers/las/LasWriterTest.cpp +++ b/test/unit/drivers/las/LasWriterTest.cpp @@ -89,8 +89,6 @@ BOOST_AUTO_TEST_CASE(LasWriterTest_test_simple_las) { FileUtils::deleteFile(Support::temppath(temp_filename)); } - - return; } #ifdef PDAL_HAVE_LASZIP @@ -137,8 +135,6 @@ BOOST_AUTO_TEST_CASE(LasWriterTest_test_simple_laz) { FileUtils::deleteFile(Support::temppath("LasWriterTest_test_simple_laz.laz")); } - - return; } #endif @@ -183,8 +179,6 @@ static void test_a_format(const std::string& refFile, boost::uint8_t majorVersio { FileUtils::deleteFile(Support::temppath("temp.las")); } - - return; } BOOST_AUTO_TEST_CASE(LasWriterTest_test_metadata) @@ -260,8 +254,6 @@ BOOST_AUTO_TEST_CASE(LasWriterTest_test_metadata) BOOST_CHECK_EQUAL(r.getLength(), 70); FileUtils::deleteFile(temp_filename); - - return; } BOOST_AUTO_TEST_CASE(LasWriterTest_test_ignored_dimensions) @@ -353,8 +345,6 @@ BOOST_AUTO_TEST_CASE(LasWriterTest_test_ignored_dimensions) } FileUtils::deleteFile(temp_filename); - - return; } BOOST_AUTO_TEST_CASE(test_different_formats) @@ -369,8 +359,6 @@ BOOST_AUTO_TEST_CASE(test_different_formats) test_a_format("1.2_1.las", 1, 2, 1); test_a_format("1.2_2.las", 1, 2, 2); test_a_format("1.2_3.las", 1, 2, 3); - - return; } diff --git a/test/unit/drivers/nitf/NitfReaderTest.cpp b/test/unit/drivers/nitf/NitfReaderTest.cpp index 9973a547f3..1731648c07 100644 --- a/test/unit/drivers/nitf/NitfReaderTest.cpp +++ b/test/unit/drivers/nitf/NitfReaderTest.cpp @@ -133,8 +133,6 @@ BOOST_AUTO_TEST_CASE(test_one) delete nitf_iter; delete las_iter; - - return; } @@ -165,8 +163,6 @@ BOOST_AUTO_TEST_CASE(test_chipper) BOOST_CHECK_EQUAL(num_blocks, 8u); delete iter; - - return; } diff --git a/test/unit/drivers/nitf/NitfWriterTest.cpp b/test/unit/drivers/nitf/NitfWriterTest.cpp index e20483382e..a9155d16af 100644 --- a/test/unit/drivers/nitf/NitfWriterTest.cpp +++ b/test/unit/drivers/nitf/NitfWriterTest.cpp @@ -105,8 +105,6 @@ static void compare_contents(const std::string& las_file, const std::string& ntf delete ntf_iter; delete las_iter; - - return; } #endif @@ -174,8 +172,6 @@ BOOST_AUTO_TEST_CASE(test1) #endif - return; - #if 0 // // check the generated NITF @@ -196,8 +192,6 @@ BOOST_AUTO_TEST_CASE(test1) FileUtils::deleteFile(Support::temppath(nitf_output)); } #endif - - return; } diff --git a/test/unit/drivers/pipeline/PipelineReaderTest.cpp b/test/unit/drivers/pipeline/PipelineReaderTest.cpp index 255df3c695..34636a81cf 100644 --- a/test/unit/drivers/pipeline/PipelineReaderTest.cpp +++ b/test/unit/drivers/pipeline/PipelineReaderTest.cpp @@ -69,8 +69,6 @@ BOOST_AUTO_TEST_CASE(PipelineReaderTest_test1) delete iter; } - - return; } @@ -95,8 +93,6 @@ BOOST_AUTO_TEST_CASE(PipelineReaderTest_test2) } FileUtils::deleteFile(Support::datapath("pipeline/pdal-compressed.laz")); - - return; } @@ -172,8 +168,6 @@ BOOST_AUTO_TEST_CASE(PipelineReaderTest_test3) PipelineManager managerComments2; PipelineReader readerComments2(managerComments2); BOOST_CHECK_NO_THROW(readerComments2.readPipeline(Support::datapath("pipeline/pipeline_writecomments.xml"))); - - return; } @@ -216,8 +210,6 @@ BOOST_AUTO_TEST_CASE(PipelineReaderTest_test4) } FileUtils::deleteFile(Support::datapath("pipeline/out2.las")); - - return; } #endif @@ -239,8 +231,6 @@ BOOST_AUTO_TEST_CASE(PipelineReaderTest_Reader) delete iter; } - - return; } BOOST_AUTO_TEST_CASE(PipelineReaderTest_MultiOptions) @@ -265,8 +255,6 @@ BOOST_AUTO_TEST_CASE(PipelineReaderTest_MultiOptions) Option meaning_of_life = more->getOption("somemore"); BOOST_CHECK_EQUAL(meaning_of_life.getValue(), 42); - - return; } diff --git a/test/unit/drivers/pipeline/PipelineWriterTest.cpp b/test/unit/drivers/pipeline/PipelineWriterTest.cpp index 09485de546..66461ad448 100644 --- a/test/unit/drivers/pipeline/PipelineWriterTest.cpp +++ b/test/unit/drivers/pipeline/PipelineWriterTest.cpp @@ -84,8 +84,6 @@ BOOST_AUTO_TEST_CASE(PipelineWriterTest_test1) } FileUtils::deleteFile(Support::datapath("pipeline/out.las")); - - return; } @@ -115,8 +113,6 @@ BOOST_AUTO_TEST_CASE(PipelineWriterTest_attr_test) BOOST_CHECK_EQUAL(tree.get("x..b"), "bbb"); BOOST_CHECK_EQUAL(tree.get("child2"), "two"); } - - return; } @@ -152,7 +148,6 @@ BOOST_AUTO_TEST_CASE(PipelineWriterTest_multioptions) } FileUtils::deleteFile(Support::temppath("test-multi.xml")); - return; } BOOST_AUTO_TEST_SUITE_END() diff --git a/test/unit/drivers/qfit/QFITReaderTest.cpp b/test/unit/drivers/qfit/QFITReaderTest.cpp index 81c70c5fe8..1acff66c7f 100644 --- a/test/unit/drivers/qfit/QFITReaderTest.cpp +++ b/test/unit/drivers/qfit/QFITReaderTest.cpp @@ -121,8 +121,6 @@ BOOST_AUTO_TEST_CASE(test_10_word) Check_Point(data, 0, 221.826822, 59.205160, 32.0900, 0); Check_Point(data, 1, 221.826740, 59.205161, 32.0190, 0); Check_Point(data, 2, 221.826658, 59.205164, 32.0000, 0); - - return; } BOOST_AUTO_TEST_CASE(test_14_word) diff --git a/test/unit/drivers/sbet/SbetReaderTest.cpp b/test/unit/drivers/sbet/SbetReaderTest.cpp index 917e2cadae..24133e4298 100644 --- a/test/unit/drivers/sbet/SbetReaderTest.cpp +++ b/test/unit/drivers/sbet/SbetReaderTest.cpp @@ -139,8 +139,6 @@ BOOST_AUTO_TEST_CASE(testRead) 3.252165276637165e-01, -1.558883225990844e-01, 8.379685112283802e-04, 7.372886784718076e-03, 7.179027672314571e-02); - - return; } @@ -169,8 +167,6 @@ BOOST_AUTO_TEST_CASE(testSkip) 3.252165276637165e-01, -1.558883225990844e-01, 8.379685112283802e-04, 7.372886784718076e-03, 7.179027672314571e-02); - - return; } @@ -194,8 +190,6 @@ BOOST_AUTO_TEST_CASE(testPipeline) const boost::uint64_t numPoints = manager.execute(); BOOST_CHECK_EQUAL(numPoints, 2); pdal::FileUtils::deleteFile(Support::datapath("sbet/outfile.txt")); - - return; } @@ -226,8 +220,6 @@ BOOST_AUTO_TEST_CASE(testRandomIterator) 3.252165276637165e-01, -1.558883225990844e-01, 8.379685112283802e-04, 7.372886784718076e-03, 7.179027672314571e-02); - - return; } diff --git a/test/unit/drivers/sqlite/Writer.cpp b/test/unit/drivers/sqlite/Writer.cpp index 9a11ac58c0..478210423e 100644 --- a/test/unit/drivers/sqlite/Writer.cpp +++ b/test/unit/drivers/sqlite/Writer.cpp @@ -188,8 +188,6 @@ BOOST_AUTO_TEST_CASE(SqliteWriterTest_test_simple_las) FileUtils::closeFile(ofs); FileUtils::deleteFile(temp_filename); - - return; #endif } diff --git a/test/unit/drivers/terrasolid/TerraSolidReaderTest.cpp b/test/unit/drivers/terrasolid/TerraSolidReaderTest.cpp index 2944697861..fe5038f668 100644 --- a/test/unit/drivers/terrasolid/TerraSolidReaderTest.cpp +++ b/test/unit/drivers/terrasolid/TerraSolidReaderTest.cpp @@ -129,9 +129,6 @@ BOOST_AUTO_TEST_CASE(test_tsolid) Check_Point(data, 0, 363127.94, 3437612.33, 55.26, 580220.5528); Check_Point(data, 1, 363128.12, 3437613.01, 55.33, 580220.5530); Check_Point(data, 2, 363128.29, 3437613.66, 55.28, 580220.5530); - - - return; } BOOST_AUTO_TEST_SUITE_END() diff --git a/test/unit/drivers/text/TextWriterTest.cpp b/test/unit/drivers/text/TextWriterTest.cpp index 7a7c126659..130daeaceb 100644 --- a/test/unit/drivers/text/TextWriterTest.cpp +++ b/test/unit/drivers/text/TextWriterTest.cpp @@ -83,9 +83,6 @@ BOOST_AUTO_TEST_CASE(TextWriterTest_test_1) pdal::FileUtils::deleteFile(output_file); else std::cout << "comparison of " << Support::datapath("autzen-point-format-3.txt") << " and " << output_file << " failed."; - - - return; } @@ -141,8 +138,6 @@ BOOST_AUTO_TEST_CASE(TextWriterTest_geojson) { FileUtils::deleteFile(Support::temppath(output)); } - - return; } #endif diff --git a/test/unit/filters/ByteSwapFilterTest.cpp b/test/unit/filters/ByteSwapFilterTest.cpp index b8dd7fc053..52294c4490 100644 --- a/test/unit/filters/ByteSwapFilterTest.cpp +++ b/test/unit/filters/ByteSwapFilterTest.cpp @@ -142,8 +142,6 @@ BOOST_AUTO_TEST_CASE(test_swapping) SWAP_ENDIANNESS(reflipped_t); BOOST_CHECK_EQUAL(unflipped_t, reflipped_t); } - - return; } BOOST_AUTO_TEST_SUITE_END() diff --git a/test/unit/filters/CacheFilterTest.cpp b/test/unit/filters/CacheFilterTest.cpp index 3fa0c69fbc..4403b6da7e 100644 --- a/test/unit/filters/CacheFilterTest.cpp +++ b/test/unit/filters/CacheFilterTest.cpp @@ -113,8 +113,6 @@ BOOST_AUTO_TEST_CASE(CacheFilterTest_test_options) delete iter1; delete iter2; - - return; } @@ -177,8 +175,6 @@ BOOST_AUTO_TEST_CASE(CacheFilterTest_test_use_counts) delete iter1; delete iter2; - - return; } @@ -232,8 +228,6 @@ BOOST_AUTO_TEST_CASE(CacheFilterTest_test_random) delete sequential; delete random; - - return; } @@ -334,8 +328,6 @@ BOOST_AUTO_TEST_CASE(test_two_iters_with_cache) delete iter; } - - return; } BOOST_AUTO_TEST_CASE(CacheFilterTest_test_large) @@ -394,8 +386,6 @@ BOOST_AUTO_TEST_CASE(CacheFilterTest_test_large) delete sequential; delete random; - - return; } diff --git a/test/unit/filters/ChipperTest.cpp b/test/unit/filters/ChipperTest.cpp index 4874bb2bcd..35b378bf25 100644 --- a/test/unit/filters/ChipperTest.cpp +++ b/test/unit/filters/ChipperTest.cpp @@ -122,8 +122,6 @@ BOOST_AUTO_TEST_CASE(test_construction) // BOOST_CHECK_EQUAL(buffer.getField(dimZ, 2), 42651); } - - return; } diff --git a/test/unit/filters/ColorFilterTest.cpp b/test/unit/filters/ColorFilterTest.cpp index 700ecf94e4..6c8ce03928 100644 --- a/test/unit/filters/ColorFilterTest.cpp +++ b/test/unit/filters/ColorFilterTest.cpp @@ -46,8 +46,6 @@ BOOST_AUTO_TEST_SUITE(ColorFilterTest) BOOST_AUTO_TEST_CASE(test1) { // BUG: tbd - - return; } BOOST_AUTO_TEST_SUITE_END() diff --git a/test/unit/filters/ColorizationFilterTest.cpp b/test/unit/filters/ColorizationFilterTest.cpp index 2596c09ec7..0777627f44 100644 --- a/test/unit/filters/ColorizationFilterTest.cpp +++ b/test/unit/filters/ColorizationFilterTest.cpp @@ -135,9 +135,6 @@ BOOST_AUTO_TEST_CASE(ColorizationFilterTest_test_1) // #endif } - - - return; } #endif diff --git a/test/unit/filters/CropFilterTest.cpp b/test/unit/filters/CropFilterTest.cpp index 971abd821f..83aed75a7a 100644 --- a/test/unit/filters/CropFilterTest.cpp +++ b/test/unit/filters/CropFilterTest.cpp @@ -92,8 +92,6 @@ BOOST_AUTO_TEST_CASE(test_crop) BOOST_CHECK_CLOSE(avgX, 5.00000, delX); BOOST_CHECK_CLOSE(avgY, 50.00000, delY); BOOST_CHECK_CLOSE(avgZ, 500.00000, delZ); - - return; } @@ -136,7 +134,6 @@ BOOST_AUTO_TEST_CASE(test_crop_polygon) FileUtils::closeFile(wkt_stream); #endif - return; } BOOST_AUTO_TEST_CASE(test_crop_polygon_reprojection) @@ -201,7 +198,6 @@ BOOST_AUTO_TEST_CASE(test_crop_polygon_reprojection) FileUtils::closeFile(wkt_stream); #endif - return; } BOOST_AUTO_TEST_SUITE_END() diff --git a/test/unit/filters/DecimationFilterTest.cpp b/test/unit/filters/DecimationFilterTest.cpp index 42ad5acb55..346466021a 100644 --- a/test/unit/filters/DecimationFilterTest.cpp +++ b/test/unit/filters/DecimationFilterTest.cpp @@ -76,8 +76,6 @@ BOOST_AUTO_TEST_CASE(DecimationFilterTest_test1) BOOST_CHECK_EQUAL(t2, 20); delete iter; - - return; } BOOST_AUTO_TEST_CASE(DecimationFilterTest_test_options) @@ -113,8 +111,6 @@ BOOST_AUTO_TEST_CASE(DecimationFilterTest_test_options) BOOST_CHECK_EQUAL(t2, 20); delete iter; - - return; } @@ -160,8 +156,6 @@ BOOST_AUTO_TEST_CASE(DecimationFilterTest_test_random) // BOOST_CHECK_EQUAL(t2, 28); delete iter; - - return; } BOOST_AUTO_TEST_SUITE_END() diff --git a/test/unit/filters/HexbinFilterTest.cpp b/test/unit/filters/HexbinFilterTest.cpp index 83ffb22fd0..8ab8d076e4 100644 --- a/test/unit/filters/HexbinFilterTest.cpp +++ b/test/unit/filters/HexbinFilterTest.cpp @@ -94,10 +94,6 @@ BOOST_AUTO_TEST_CASE(HexbinFilterTest_test_1) delete iter; - - - - return; } diff --git a/test/unit/filters/InPlaceReprojectionFilterTest.cpp b/test/unit/filters/InPlaceReprojectionFilterTest.cpp index 1df56b0c09..c810772278 100644 --- a/test/unit/filters/InPlaceReprojectionFilterTest.cpp +++ b/test/unit/filters/InPlaceReprojectionFilterTest.cpp @@ -152,9 +152,6 @@ BOOST_AUTO_TEST_CASE(InPlaceReprojectionFilterTest_test_1) delete iter; } - - - return; } @@ -225,9 +222,6 @@ BOOST_AUTO_TEST_CASE(InPlaceReprojectionFilterTest_test_2) delete iter; } - - - return; } #endif diff --git a/test/unit/filters/MosaicFilterTest.cpp b/test/unit/filters/MosaicFilterTest.cpp index 630dc4d529..c9f7ef9bfb 100644 --- a/test/unit/filters/MosaicFilterTest.cpp +++ b/test/unit/filters/MosaicFilterTest.cpp @@ -122,8 +122,6 @@ BOOST_AUTO_TEST_CASE(basic_test) } delete iter; - - return; } @@ -159,9 +157,6 @@ BOOST_AUTO_TEST_CASE(pipeline_mosaic) // BOOST_CHECK_EQUAL(x2, 0); // Past 1066, is the other data set due to mosaic filter // delete iter; - - - return; } #endif diff --git a/test/unit/filters/PCLBlockFilterTest.cpp b/test/unit/filters/PCLBlockFilterTest.cpp index 2750c9ced1..a90d0c7d68 100644 --- a/test/unit/filters/PCLBlockFilterTest.cpp +++ b/test/unit/filters/PCLBlockFilterTest.cpp @@ -82,8 +82,6 @@ BOOST_AUTO_TEST_CASE(PCLBlockFilterTest_passthrough) pdal::filters::iterators::sequential::PCLBlock* b = static_cast(iter); delete iter; - - return; } BOOST_AUTO_TEST_CASE(PCLBlockFilterTest_outlier_removal) @@ -121,8 +119,6 @@ BOOST_AUTO_TEST_CASE(PCLBlockFilterTest_outlier_removal) pdal::filters::iterators::sequential::PCLBlock* b = static_cast(iter); delete iter; - - return; } #endif diff --git a/test/unit/filters/ScalingFilterTest.cpp b/test/unit/filters/ScalingFilterTest.cpp index 98d40a780a..4489149c0a 100644 --- a/test/unit/filters/ScalingFilterTest.cpp +++ b/test/unit/filters/ScalingFilterTest.cpp @@ -91,8 +91,6 @@ BOOST_AUTO_TEST_CASE(ScalingFilterTest_test_1) BOOST_CHECK_EQUAL(x, 63701224); BOOST_CHECK_EQUAL(y, 84902831); - - return; } @@ -182,8 +180,6 @@ BOOST_AUTO_TEST_CASE(ScalingFilterFloat_test) } delete iter; - - return; } @@ -231,8 +227,6 @@ BOOST_AUTO_TEST_CASE(ScalingFilterTest_test_2) BOOST_CHECK_EQUAL(x, 63603753); BOOST_CHECK_EQUAL(y, 84933845); - - return; } diff --git a/test/unit/filters/SelectorFilterTest.cpp b/test/unit/filters/SelectorFilterTest.cpp index 805f08d28a..7f0f72e188 100644 --- a/test/unit/filters/SelectorFilterTest.cpp +++ b/test/unit/filters/SelectorFilterTest.cpp @@ -81,8 +81,6 @@ BOOST_AUTO_TEST_CASE(test1) // We created Greenish BOOST_CHECK_EQUAL(new_schema.getDimension("Greenish").isIgnored(), false); - - return; } diff --git a/test/unit/filters/SplitterTest.cpp b/test/unit/filters/SplitterTest.cpp index b81159f227..dcd3c2200b 100644 --- a/test/unit/filters/SplitterTest.cpp +++ b/test/unit/filters/SplitterTest.cpp @@ -116,8 +116,6 @@ BOOST_AUTO_TEST_CASE(test_tile_filter) BOOST_CHECK(s.getTile(22).getNumPoints() == 34); // lower left xy: 637000, 853000 BOOST_CHECK(s.getTile(23).getNumPoints() == 37); // lower left xy: 638000, 853000 } - - return; } BOOST_AUTO_TEST_SUITE_END() diff --git a/test/unit/filters/StatsFilterTest.cpp b/test/unit/filters/StatsFilterTest.cpp index 4bcd8515ea..4613b33d6c 100644 --- a/test/unit/filters/StatsFilterTest.cpp +++ b/test/unit/filters/StatsFilterTest.cpp @@ -94,8 +94,6 @@ BOOST_AUTO_TEST_CASE(StatsFilterTest_test1) BOOST_CHECK_CLOSE(statsX.average(), 1.0, 0.0001); BOOST_CHECK_CLOSE(statsY.average(), 2.0, 0.0001); BOOST_CHECK_CLOSE(statsZ.average(), 3.0, 0.0001); - - return; } @@ -143,8 +141,6 @@ BOOST_AUTO_TEST_CASE(test_random_iterator) } delete iter; - - return; } @@ -208,8 +204,6 @@ BOOST_AUTO_TEST_CASE(test_multiple_dims_same_name) BOOST_CHECK_EQUAL(statsZ.count(), 1000u); pdal::Metadata m = iterator->toMetadata(); - - return; } @@ -279,9 +273,6 @@ BOOST_AUTO_TEST_CASE(test_specified_stats) BOOST_CHECK_CLOSE(statsX.minimum(), -117.2686466233, 0.0001); BOOST_CHECK_CLOSE(statsY.minimum(), 848899.700, 0.0001); - - - return; } BOOST_AUTO_TEST_CASE(test_pointbuffer_stats) @@ -342,9 +333,6 @@ BOOST_AUTO_TEST_CASE(test_pointbuffer_stats) pdal::Metadata m = data.getMetadata(); BOOST_CHECK_EQUAL(m.toPTree().get("metadata.filters_stats.metadata.Classification.metadata.counts.metadata.count-1.metadata.count.value"), 737); - - - return; } BOOST_AUTO_TEST_SUITE_END() diff --git a/test/unit/plang/PLangTest.cpp b/test/unit/plang/PLangTest.cpp index 13d835601f..7251dea0a2 100644 --- a/test/unit/plang/PLangTest.cpp +++ b/test/unit/plang/PLangTest.cpp @@ -55,8 +55,6 @@ BOOST_AUTO_TEST_CASE(PLangTest_basic) pdal::plang::Invocation meth(script); meth.compile(); meth.execute(); - - return; } @@ -78,8 +76,6 @@ BOOST_AUTO_TEST_CASE(PLangTest_compile_error) pdal::plang::Invocation meth(script); BOOST_REQUIRE_THROW(meth.compile(), pdal::python_error); - - return; } @@ -97,8 +93,6 @@ BOOST_AUTO_TEST_CASE(PLangTest_runtime_error) meth.compile(); BOOST_REQUIRE_THROW(meth.execute(), pdal::python_error); - - return; } @@ -116,8 +110,6 @@ BOOST_AUTO_TEST_CASE(PLangTest_toofewinputs) meth.compile(); BOOST_REQUIRE_THROW(meth.execute(), pdal::python_error); - - return; } @@ -135,8 +127,6 @@ BOOST_AUTO_TEST_CASE(PLangTest_toomanyinputs) meth.compile(); BOOST_REQUIRE_THROW(meth.execute(), pdal::python_error); - - return; } @@ -154,8 +144,6 @@ BOOST_AUTO_TEST_CASE(PLangTest_returnvoid) meth.compile(); BOOST_REQUIRE_THROW(meth.execute(), pdal::python_error); - - return; } @@ -173,8 +161,6 @@ BOOST_AUTO_TEST_CASE(PLangTest_returnint) meth.compile(); BOOST_REQUIRE_THROW(meth.execute(), pdal::python_error); - - return; } @@ -205,8 +191,6 @@ BOOST_AUTO_TEST_CASE(PLangTest_ins) meth.insertArgument("X", (boost::uint8_t*)data, 5, 8, pdal::dimension::Float, 8); meth.execute(); - - return; } @@ -239,8 +223,6 @@ BOOST_AUTO_TEST_CASE(PLangTest_outs) BOOST_CHECK_CLOSE(data[2], 1.0, 0.00001); BOOST_CHECK_CLOSE(data[3], 1.0, 0.00001); BOOST_CHECK_CLOSE(data[4], 1.0, 0.00001); - - return; } @@ -314,8 +296,6 @@ BOOST_AUTO_TEST_CASE(PLangTest_aliases) BOOST_CHECK(names[0] == "Y"); BOOST_CHECK(names[1] == "prefix.Y"); } - - return; } @@ -333,8 +313,6 @@ BOOST_AUTO_TEST_CASE(PLangTest_returntrue) bool sts = meth.execute(); BOOST_CHECK(sts); - - return; } @@ -352,8 +330,6 @@ BOOST_AUTO_TEST_CASE(PLangTest_returnfalse) bool sts = meth.execute(); BOOST_CHECK(!sts); - - return; } @@ -411,8 +387,6 @@ BOOST_AUTO_TEST_CASE(PLangTest_reentry) BOOST_CHECK_CLOSE(outdata2[3], 41.0, 0.00001); BOOST_CHECK_CLOSE(outdata2[4], 51.0, 0.00001); } - - return; } diff --git a/test/unit/plang/PredicateFilterTest.cpp b/test/unit/plang/PredicateFilterTest.cpp index 2210e5fcac..eaa7c00250 100644 --- a/test/unit/plang/PredicateFilterTest.cpp +++ b/test/unit/plang/PredicateFilterTest.cpp @@ -94,8 +94,6 @@ BOOST_AUTO_TEST_CASE(PredicateFilterTest_test1) BOOST_CHECK(Utils::compare_approx(maxX, 1.0, 0.01)); BOOST_CHECK(Utils::compare_approx(maxY, 1.0, 0.01)); BOOST_CHECK(Utils::compare_approx(maxZ, 1.0, 0.01)); - - return; } @@ -145,8 +143,6 @@ BOOST_AUTO_TEST_CASE(PredicateFilterTest_test2) BOOST_CHECK(Utils::compare_approx(maxX, 2.0, 0.01)); BOOST_CHECK(Utils::compare_approx(maxY, 2.0, 0.01)); BOOST_CHECK(Utils::compare_approx(maxZ, 2.0, 0.01)); - - return; } @@ -219,8 +215,6 @@ BOOST_AUTO_TEST_CASE(PredicateFilterTest_test3) BOOST_CHECK(Utils::compare_approx(maxX, 1.0, 0.01)); BOOST_CHECK(Utils::compare_approx(maxY, 1.0, 0.01)); BOOST_CHECK(Utils::compare_approx(maxZ, 1.0, 0.01)); - - return; } @@ -268,8 +262,6 @@ BOOST_AUTO_TEST_CASE(PredicateFilterTest_test4) BOOST_CHECK(processed == 1000); BOOST_CHECK(passed == 750); - - return; } BOOST_AUTO_TEST_CASE(PredicateFilterTest_test5) @@ -306,8 +298,6 @@ BOOST_AUTO_TEST_CASE(PredicateFilterTest_test5) boost::scoped_ptr iter(filter.createSequentialIterator(data)); BOOST_REQUIRE_THROW(iter->read(data), pdal::python_error); - - return; } BOOST_AUTO_TEST_CASE(PredicateFilterTest_Pipeline) @@ -328,8 +318,6 @@ BOOST_AUTO_TEST_CASE(PredicateFilterTest_Pipeline) delete iter; } - - return; } BOOST_AUTO_TEST_CASE(PredicateFilterTest_Embed) @@ -350,8 +338,6 @@ BOOST_AUTO_TEST_CASE(PredicateFilterTest_Embed) delete iter; } - - return; } diff --git a/test/unit/plang/ProgrammableFilterTest.cpp b/test/unit/plang/ProgrammableFilterTest.cpp index 476b495139..7192a37751 100644 --- a/test/unit/plang/ProgrammableFilterTest.cpp +++ b/test/unit/plang/ProgrammableFilterTest.cpp @@ -105,8 +105,6 @@ BOOST_AUTO_TEST_CASE(ProgrammableFilterTest_test1) BOOST_CHECK_CLOSE(minZ, 3.14, 0.001); BOOST_CHECK_CLOSE(maxZ, 3.14, 0.001); - - return; } BOOST_AUTO_TEST_CASE(pipeline) @@ -136,8 +134,6 @@ BOOST_AUTO_TEST_CASE(pipeline) } delete iter; - - return; } BOOST_AUTO_TEST_SUITE_END() From aede8eccc62a900fb67014f6e98f4bc9cc818a54 Mon Sep 17 00:00:00 2001 From: Pete Gadomski Date: Thu, 1 May 2014 13:40:14 -0600 Subject: [PATCH 2/5] Split inferWriterDriver into two Similar to #340, the 2-argument infer{Reader|Writer}Driver might try to do too much by both modifying options and finding the correct driver. This patch splits the inferWriterDriver into two pieces. The inferWriterDriver part does just that, while a new method, inferWriterOptionsChanges, modifies an options object based upon a given filename. --- include/pdal/StageFactory.hpp | 10 ++++++---- src/StageFactory.cpp | 35 ++++++++++++++++++++++------------- src/kernel/Support.cpp | 5 +++-- 3 files changed, 31 insertions(+), 19 deletions(-) diff --git a/include/pdal/StageFactory.hpp b/include/pdal/StageFactory.hpp index 6037e6e885..1be24e48d9 100644 --- a/include/pdal/StageFactory.hpp +++ b/include/pdal/StageFactory.hpp @@ -93,10 +93,12 @@ class PDAL_DLL StageFactory // infer the driver to use based on filename extension // returns "" if no driver found - // - // this may also add on an option to pass to the driver, such as the filename - // (or something inferred from the extension, such as .laz means we need to use compress=true) - static std::string inferWriterDriver(const std::string& filename, pdal::Options& options); + static std::string inferWriterDriver(const std::string& filename); + + // modify options based upon expectations implicit in a given filename + // e.g. output files ending in .laz should be compressed + static void inferWriterOptionsChanges(const std::string& filename, + pdal::Options& options); Reader* createReader(const std::string& type, const Options& options); Filter* createFilter(const std::string& type, Stage& prevStage, const Options& options); diff --git a/src/StageFactory.cpp b/src/StageFactory.cpp index dc10a6989d..d6fe5fed46 100644 --- a/src/StageFactory.cpp +++ b/src/StageFactory.cpp @@ -201,24 +201,13 @@ std::string StageFactory::inferReaderDriver(const std::string& filename, pdal::O return driver; // will be "" if not found } -std::string StageFactory::inferWriterDriver(const std::string& filename, pdal::Options& options) + +std::string StageFactory::inferWriterDriver(const std::string& filename) { std::string ext = boost::filesystem::extension(filename); boost::to_lower(ext); - if (boost::algorithm::iequals(ext,".laz")) - { - options.add("compression", true); - } - - if (boost::algorithm::iequals(ext,".pcd")) - { - options.add("format","PCD"); - } - - options.add("filename", filename); - std::map drivers; drivers["las"] = "drivers.las.writer"; drivers["laz"] = "drivers.las.writer"; @@ -241,6 +230,26 @@ std::string StageFactory::inferWriterDriver(const std::string& filename, pdal::O return driver; // will be "" if not found } + +void StageFactory::inferWriterOptionsChanges(const std::string& filename, pdal::Options& options) +{ + std::string ext = boost::filesystem::extension(filename); + boost::to_lower(ext); + + if (boost::algorithm::iequals(ext,".laz")) + { + options.add("compression", true); + } + + if (boost::algorithm::iequals(ext,".pcd")) + { + options.add("format","PCD"); + } + + options.add("filename", filename); +} + + Reader* StageFactory::createReader(const std::string& type, const Options& options) { ReaderCreator* f = getReaderCreator(type); diff --git a/src/kernel/Support.cpp b/src/kernel/Support.cpp index 322109fbbc..789d20b0f7 100644 --- a/src/kernel/Support.cpp +++ b/src/kernel/Support.cpp @@ -101,11 +101,12 @@ pdal::Writer* AppSupport::makeWriter(pdal::Options& options, pdal::Stage& stage) const std::string outputFile = options.getValueOrThrow("filename"); pdal::StageFactory factory; - std::string driver = factory.inferWriterDriver(outputFile, options); + std::string driver = factory.inferWriterDriver(outputFile); if (driver == "") { throw app_runtime_error("Cannot determine output file type of " + outputFile); } + factory.inferWriterOptionsChanges(outputFile, options); pdal::Writer* writer = factory.createWriter(driver, stage, options); if (!writer) @@ -220,4 +221,4 @@ void HeartbeatCallback::callback() return; } -}} // pdal::kernel \ No newline at end of file +}} // pdal::kernel From 2826c9c5166062a35085ab64ec282994488fcaa9 Mon Sep 17 00:00:00 2001 From: Andrew Bell Date: Fri, 2 May 2014 09:05:31 -0500 Subject: [PATCH 3/5] Merge StageBase into Stage. --- include/pdal/Log.hpp | 2 +- include/pdal/Stage.hpp | 82 +++++- include/pdal/StageBase.hpp | 327 --------------------- include/pdal/StageInfo.hpp | 1 - include/pdal/Writer.hpp | 3 +- include/pdal/drivers/caris/CloudReader.hpp | 1 - include/pdal/drivers/oci/common.hpp | 6 +- src/CMakeLists.txt | 2 - src/Filter.cpp | 7 +- src/MultiFilter.cpp | 9 +- src/PipelineWriter.cpp | 6 +- src/Reader.cpp | 12 +- src/Stage.cpp | 104 ++++++- src/StageBase.cpp | 253 ---------------- src/Writer.cpp | 23 +- src/drivers/oci/Writer.cpp | 5 +- src/filters/Scaling.cpp | 11 +- src/filters/Selector.cpp | 13 +- test/unit/PipelineManagerTest.cpp | 22 +- 19 files changed, 211 insertions(+), 678 deletions(-) delete mode 100644 include/pdal/StageBase.hpp delete mode 100644 src/StageBase.cpp diff --git a/include/pdal/Log.hpp b/include/pdal/Log.hpp index f13f7fc822..621dc6d0db 100644 --- a/include/pdal/Log.hpp +++ b/include/pdal/Log.hpp @@ -53,7 +53,7 @@ namespace pdal { -/// pdal::Log is a logging object that is provided by pdal::StageBase to +/// pdal::Log is a logging object that is provided by pdal::Stage to /// facilitate logging operations. class PDAL_DLL Log { diff --git a/include/pdal/Stage.hpp b/include/pdal/Stage.hpp index 285add6c10..7fd9b39b0d 100644 --- a/include/pdal/Stage.hpp +++ b/include/pdal/Stage.hpp @@ -37,9 +37,11 @@ #include -#include -#include #include +#include +#include +#include +#include #include namespace pdal @@ -57,22 +59,67 @@ class PointBuffer; // verbose // -class PDAL_DLL Stage : public StageBase +class PDAL_DLL Stage { public: - Stage(const std::vector& prevs, const Options& options); - virtual ~Stage(); + Stage(const std::vector& prevs, const Options& options); + virtual ~Stage() + {} virtual void initialize(); + bool isInitialized() const + { return m_initialized; } inline Schema const& getSchema() const - { - return m_schema; - } + { return m_schema; } virtual boost::uint64_t getNumPoints() const; const Bounds& getBounds() const; const SpatialReference& getSpatialReference() const; + const Options& getOptions() const + { return m_options; } + virtual boost::property_tree::ptree serializePipeline() const = 0; + virtual LogPtr log() const + { return m_log; } + bool isDebug() const + { return m_debug; } + bool isVerbose() const + { return (bool)m_verbose; } + boost::uint32_t getVerboseLevel() const + { return m_verbose; } + virtual std::string getName() const = 0; + virtual std::string getDescription() const = 0; + boost::uint32_t getId() const + { return m_id; } + const std::vector& getInputs() const + { return m_inputs; } + const std::vector& getOutputs() const + { return m_outputs; } + Stage& getPrevStage() const; + std::vector getPrevStages() const; + virtual Metadata getMetadata() const + { return m_metadata; } + virtual Metadata collectMetadata() const; + static Options getDefaultOptions() + { return Options(); } + static std::vector getDefaultDimensions() + { return std::vector(); } + static std::string s_getInfoLink() + { return std::string(); } + +#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; } + +#define SET_STAGE_LINK(infolink) \ + static std::string s_getInfoLink() { return infolink; } \ + std::string getInfoLink() const { return infolink; } + +#define SET_STAGE_ENABLED(YES_OR_NO) \ + static bool s_isEnabled() { return YES_OR_NO; } \ + bool isEnabled() const { return YES_OR_NO; } virtual StageSequentialIterator* createSequentialIterator(PointBuffer&) const @@ -82,17 +129,36 @@ class PDAL_DLL Stage : public StageBase protected: Schema m_schema; + Options m_options; + StageOperationType getDimensionOperationType() const + { return m_dimensionsType; } void setSchema(Schema const&); void setNumPoints(boost::uint64_t); void setBounds(Bounds const&); void setSpatialReference(SpatialReference const&); + Metadata& getMetadataRef() + { return m_metadata; } // convenience function, for doing a "copy ctor" on all the core props // (used by the Filter stage, for example) void setCoreProperties(const Stage&); + static std::vector makeVector() + { return std::vector(); } + static std::vector makeVector(Stage& src); + static std::vector makeVector(const std::vector& src); + private: + bool m_initialized; + bool m_debug; + boost::uint32_t m_verbose; + boost::uint32_t m_id; + std::vector m_inputs; + std::vector m_outputs; + StageOperationType m_dimensionsType; + LogPtr m_log; + Metadata m_metadata; mutable boost::uint64_t m_numPoints; Bounds m_bounds; SpatialReference m_spatialReference; diff --git a/include/pdal/StageBase.hpp b/include/pdal/StageBase.hpp deleted file mode 100644 index cc7e2fcd74..0000000000 --- a/include/pdal/StageBase.hpp +++ /dev/null @@ -1,327 +0,0 @@ -/****************************************************************************** -* Copyright (c) 2011, Michael P. Gerlek (mpg@flaxen.com) -* -* All rights reserved. -* -* Redistribution and use in source and binary forms, with or without -* modification, are permitted provided that the following -* conditions are met: -* -* * Redistributions of source code must retain the above copyright -* notice, this list of conditions and the following disclaimer. -* * Redistributions in binary form must reproduce the above copyright -* notice, this list of conditions and the following disclaimer in -* the documentation and/or other materials provided -* with the distribution. -* * Neither the name of Hobu, Inc. or Flaxen Geo Consulting nor the -* names of its contributors may be used to endorse or promote -* products derived from this software without specific prior -* written permission. -* -* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS -* FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE -* COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, -* INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, -* BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS -* OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED -* AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, -* OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT -* OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY -* OF SUCH DAMAGE. -****************************************************************************/ - -#ifndef INCLUDED_STAGEBASE_HPP -#define INCLUDED_STAGEBASE_HPP - -#include - -#include -#include -#include -#include - -#include -#include -#include - -namespace pdal -{ - - -class Stage; -class Dimension; - -// -// supported options: -// id -// debug -// verbose -// - -// both Stages and Writers have a few common properties, so -class PDAL_DLL StageBase -{ - friend class Stage; -public: - - /// Constructor. - /// - /// @param inputs The input stages. - /// @param options Options for controlling the pipeline stage. - StageBase(const std::vector& inputs, const Options& options); - - /// Destructor. - virtual ~StageBase(); - - /// Initializes this object. - /// It will recursively call initialize() on all previous stages. - /// Users must call this after the last stage in the pipeline - /// has been constructed. - /// It is illegal to call this twice for a stage. - /// Derived stages should feel free to provide their own implementations. - /// Remember to call initialize() on the parent class before - /// your own class-specific code. This function will throw when errors are found. - virtual void initialize(); - - /// Query if this object is initialized. - /// @return true if initialized, false if not. - bool isInitialized() const; - - /// Gets the Options set for the stage. - /// - /// @return The options. - Options const& getOptions() const; - - - /// Returns the serialized pipeline. - /// - /// This is used to generate pipeline xml files. It will - /// recursively visit all child stages to populate the tree. - /// - /// @return the ptree for the stage - virtual boost::property_tree::ptree serializePipeline() const = 0; - - /// @return the pdal::LogPtr for this pdal::Stage. - virtual LogPtr log() const - { return m_log; } - - - /// Put data to the log - /// @param input a string to put into the Stage's log - // virtual void log(std::string const& input, boost::uint32_t nVerbosity = 1) const; - - /// Query if this object is debug. - /// - /// This is set by the "debug" option, which is a boolean. - /// - /// This is intended to be used for adding debug code to stages, e.g. more than just the - /// extra logging that "verbose" implies. - /// - /// @return true if debug, false if not. - bool isDebug() const; - - - /// Query if this object is verbose. - /// - /// This is set by the "verbose" option - /// 0 - no verbosity at all - /// >0 - meaning is left to the implementors of the individual stages - /// - /// "Verbose" is intended to only add logging/tracing/output functionality; to add or enable - /// extra validation checks and such (code which is potentially side-effecting) you want to use - /// the "debug" option. - /// - /// @return true if verbosity>0, false if not. - - bool isVerbose() const; - - /// Gets the verbose level. - /// - /// @return The verbose level. - boost::uint32_t getVerboseLevel() const; - - - /// Gets the default options. - /// - /// 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. - /// - /// @return The default options. - static Options getDefaultOptions() - { - return Options(); - } - - /// Gets the default dimensions that a give stage produces - static std::vector getDefaultDimensions() - { - return std::vector(); - } - - /// Gets the name. - /// - /// 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. - /// - /// @return The name. - virtual std::string getName() const = 0; - - /// Gets the description. - /// - /// @return The description. - virtual std::string getDescription() const = 0; - - - /// @return the HTML link to info about the stage - static std::string getInfoLink() - { - return std::string(""); - } - - static std::string s_getInfoLink() - { - return std::string(""); - } - - /// 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; } - -#define SET_STAGE_LINK(infolink) \ - static std::string s_getInfoLink() { return infolink; } \ - std::string getInfoLink() const { return infolink; } - -#define SET_STAGE_ENABLED(YES_OR_NO) \ - static bool s_isEnabled() { return YES_OR_NO; } \ - bool isEnabled() const { return YES_OR_NO; } - - /// Gets the stage's id. - /// - /// @return The id. - boost::uint32_t getId() const - { - return m_id; - } - - /// Gets the list of input stages - /// - /// @return vector of input stages (may be empty) - const std::vector& getInputs() const; - - /// Gets the list of output stages - /// - /// @return vector of output stages (may be empty) - const std::vector& getOutputs() const; - - /// Gets the previous stage. - /// - /// convenience function: returns the first input stage, as a Stage& - /// (don't call this unless you know it is safe to do so, e.g Readers - /// should not use this since they have no input stages) - /// - /// @return The previous stage. - Stage& getPrevStage() const; - - /// Gets the previous stages. - /// - /// convenience function: returns the input stages, as a Stage* vector - /// (don't call this unless you know it is safe to do so, e.g Readers - /// should not use this since they have no input stages, and Filters - /// probably won't want to use this either since they only have one - /// prev stage) - /// - /// @return null if it fails, else the previous stages. - std::vector getPrevStages() const; - - virtual Metadata getMetadata() const; - virtual Metadata collectMetadata() const; - -protected: - - /// Gets the options. - /// - /// @return The options. - Options& getOptions(); - - inline StageOperationType getDimensionOperationType() const - { - return m_dimensionsType; - } - /// Makes an "empty" vector of StageBase pointers. - /// - /// This is used by the ctors of the derived classes, so they can call - /// the ctor of StageBase. This function goes along with the other - /// makeVector() functions. - /// - /// @return an empty vector - static std::vector makeVector(); - - /// Makes a vector of one StageBase pointer from a single Stage reference - /// - /// This is used by the ctors of the derived classes, so they can call - /// the ctor of StageBase. C++ doesn't support polymorphic arrays or - /// inlined initialization of vectors, so we do it this way. - /// - /// @param src the Stage reference - /// - /// @return a vector of one StageBase pointer - static std::vector makeVector(Stage& src); - - /// Makes a vector of StageBase pointers from a vector of Stages - /// - /// This is used by the ctors of the derived classes, so they can call - /// the ctor of StageBase. C++ doesn't support polymorphic arrays or - /// inlined initialization of vectors, so we do it this way. - /// - /// @param src the vector of Stages - /// - /// @return a vector of StageBase pointers - static std::vector makeVector(const std::vector& src); - - /// @return a modifiable reference to the metadata for the stage - Metadata& getMetadataRef() - { - return m_metadata; - } - -private: - bool m_initialized; - Options m_options; - bool m_debug; - boost::uint32_t m_verbose; - const boost::uint32_t m_id; - - std::vector m_inputs; - std::vector m_outputs; - StageOperationType m_dimensionsType; - LogPtr m_log; - Metadata m_metadata; - - StageBase& operator=(const StageBase& rhs); // not implemented - StageBase(const StageBase&); // not implemented -}; - -/// Output operator for serialization -/// -/// @param ostr The output stream to write to -/// @param src The StageBase to be serialized out -/// -/// @return The output stream - -PDAL_DLL std::ostream& operator<<(std::ostream& ostr, const StageBase& src); - -} // namespace pdal - -#endif diff --git a/include/pdal/StageInfo.hpp b/include/pdal/StageInfo.hpp index 11c913b972..7153fee78a 100644 --- a/include/pdal/StageInfo.hpp +++ b/include/pdal/StageInfo.hpp @@ -47,7 +47,6 @@ namespace pdal { -class StageBase; class Stage; class Dimension; diff --git a/include/pdal/Writer.hpp b/include/pdal/Writer.hpp index 39f06cb0db..28e3f49ae2 100644 --- a/include/pdal/Writer.hpp +++ b/include/pdal/Writer.hpp @@ -44,12 +44,11 @@ namespace pdal { -class Stage; class PointBuffer; class UserCallback; /// End-stage consumer of PDAL pipeline -class PDAL_DLL Writer : public StageBase +class PDAL_DLL Writer : public Stage { public: diff --git a/include/pdal/drivers/caris/CloudReader.hpp b/include/pdal/drivers/caris/CloudReader.hpp index d7eceeff6b..940c5e2f16 100644 --- a/include/pdal/drivers/caris/CloudReader.hpp +++ b/include/pdal/drivers/caris/CloudReader.hpp @@ -37,7 +37,6 @@ # pragma warning(disable : DISABLED_3RDPARTY_WARNINGS) #endif -#include #include #include diff --git a/include/pdal/drivers/oci/common.hpp b/include/pdal/drivers/oci/common.hpp index 0b9a719acd..7e3b7fd811 100644 --- a/include/pdal/drivers/oci/common.hpp +++ b/include/pdal/drivers/oci/common.hpp @@ -97,7 +97,7 @@ class PDAL_DLL OracleDriver { public: OracleDriver(const Options& options) - : m_options(options) + : m_stageOptions(options) { @@ -105,7 +105,7 @@ class PDAL_DLL OracleDriver pdal::drivers::oci::Connection connect() { - std::string connection = m_options.getValueOrThrow("connection"); + std::string connection = m_stageOptions.getValueOrThrow("connection"); if (connection.empty()) throw pdal_error("Oracle connection string empty! Unable to connect"); @@ -129,7 +129,7 @@ class PDAL_DLL OracleDriver } private: - Options const& m_options; + Options const& m_stageOptions; OracleDriver& operator=(const OracleDriver&); // not implemented OracleDriver(const OracleDriver&); // not implemented diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index 6edaec4a4d..1ecf54027b 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -53,7 +53,6 @@ set(PDAL_BASE_HPP "${PDAL_HEADERS_DIR}/Schema.hpp" "${PDAL_HEADERS_DIR}/SpatialReference.hpp" "${PDAL_HEADERS_DIR}/Stage.hpp" - "${PDAL_HEADERS_DIR}/StageBase.hpp" "${PDAL_HEADERS_DIR}/StageFactory.hpp" "${PDAL_HEADERS_DIR}/StageInfo.hpp" "${PDAL_HEADERS_DIR}/StageIterator.hpp" @@ -97,7 +96,6 @@ set(PDAL_BASE_CPP Schema.cpp SpatialReference.cpp Stage.cpp - StageBase.cpp StageFactory.cpp StageInfo.cpp StageIterator.cpp diff --git a/src/Filter.cpp b/src/Filter.cpp index 2d7a52b431..933eaded73 100644 --- a/src/Filter.cpp +++ b/src/Filter.cpp @@ -40,11 +40,8 @@ namespace pdal Filter::Filter(Stage& prevStage, const Options& options) - : Stage(StageBase::makeVector(prevStage), options) -{ - - return; -} + : Stage(makeVector(prevStage), options) +{} void Filter::initialize() diff --git a/src/MultiFilter.cpp b/src/MultiFilter.cpp index 6d07f1fa26..fc19afda47 100644 --- a/src/MultiFilter.cpp +++ b/src/MultiFilter.cpp @@ -39,11 +39,10 @@ namespace pdal { -MultiFilter::MultiFilter(const std::vector& prevStages, const Options& options) - : Stage(StageBase::makeVector(prevStages), options) -{ - return; -} +MultiFilter::MultiFilter(const std::vector& prevStages, + const Options& options) : + Stage(makeVector(prevStages), options) +{} void MultiFilter::initialize() diff --git a/src/PipelineWriter.cpp b/src/PipelineWriter.cpp index 83de8f204b..7d8f38536e 100644 --- a/src/PipelineWriter.cpp +++ b/src/PipelineWriter.cpp @@ -68,7 +68,7 @@ PipelineWriter::~PipelineWriter() } -static boost::property_tree::ptree generateTreeFromStageBase(const StageBase& stage) +static boost::property_tree::ptree generateTreeFromStage(const Stage& stage) { boost::property_tree::ptree subtree = stage.serializePipeline(); @@ -174,9 +174,9 @@ void PipelineWriter::write_metadata_ptree(boost::property_tree::ptree& tree, con void PipelineWriter::writePipeline(const std::string& filename) const { - const StageBase* stage = m_manager.isWriterPipeline() ? (StageBase*)m_manager.getWriter() : (StageBase*)m_manager.getStage(); + const Stage* stage = m_manager.isWriterPipeline() ? (Stage*)m_manager.getWriter() : (Stage*)m_manager.getStage(); - boost::property_tree::ptree tree = generateTreeFromStageBase(*stage); + boost::property_tree::ptree tree = generateTreeFromStage(*stage); if (m_buffer) { diff --git a/src/Reader.cpp b/src/Reader.cpp index 0605ed19a5..d12e83c9f3 100644 --- a/src/Reader.cpp +++ b/src/Reader.cpp @@ -38,18 +38,12 @@ namespace pdal { -Reader::Reader(const Options& options) - : Stage(StageBase::makeVector(), options) - -{ - -} +Reader::Reader(const Options& options) : Stage(makeVector(), options) +{} Reader::~Reader() -{ - return; -} +{} void Reader::initialize() diff --git a/src/Stage.cpp b/src/Stage.cpp index 990f753506..15ecaa928a 100644 --- a/src/Stage.cpp +++ b/src/Stage.cpp @@ -41,21 +41,62 @@ namespace pdal { -Stage::Stage(const std::vector& prevs, const Options& options) - : StageBase(prevs, options) - , m_numPoints(0) -{} - - -Stage::~Stage() -{} +Stage::Stage(const std::vector& inputs, const Options& options) : + m_options(options), m_initialized(false), m_inputs(inputs), + m_dimensionsType(StageOperation_All), m_log(LogPtr()), m_numPoints(0) +{ + m_debug = options.getValueOrDefault("debug", false); + m_verbose = options.getValueOrDefault("verbose", 0); + m_id = options.getValueOrDefault("id", 0); + for (size_t i = 0; i < m_inputs.size(); ++i) + { + Stage *input = m_inputs[i]; + input->m_outputs.push_back(this); + } + if (m_debug && !m_verbose) + m_verbose = 1; +} void Stage::initialize() { - StageBase::initialize(); - // Try to fetch overridden options here + for (size_t i = 0; i < m_inputs.size(); ++i) + { + Stage *prev = m_inputs[i]; + prev->initialize(); + } + + // it is illegal to call initialize() twice + if (m_initialized) + throw pdal_error("Class already initialized: " + this->getName()); + + m_debug = m_options.getValueOrDefault("debug", false); + m_verbose = m_options.getValueOrDefault("verbose", 0); + if (m_debug && !m_verbose) + m_verbose = 1; + + if (m_inputs.empty()) + { + std::string logname = + m_options.getValueOrDefault("log", "stdlog"); + m_log = boost::shared_ptr(new Log(getName(), logname)); + } + else + { + if (m_options.hasOption("log")) + { + std::string logname = m_options.getValueOrThrow("log"); + m_log = boost::shared_ptr(new Log(getName(), logname)); + } + else + { + std::ostream* v = getPrevStage().log()->getLogStream(); + m_log = boost::shared_ptr(new Log(getName(), v)); + } + } + m_log->setLevel((LogLevel)m_verbose); + m_initialized = true; // If the user gave us an SRS via options, take that. try @@ -71,6 +112,37 @@ void Stage::initialize() } +Metadata Stage::collectMetadata() const +{ + Metadata output(m_metadata); + output = output + m_metadata; + + try + { + Metadata const& m = getPrevStage().getMetadata(); + output = output + m; + } + catch (pdal::internal_error const&) + { + } + return output; +} + + +Stage& Stage::getPrevStage() const +{ + if (m_inputs.empty()) + throw internal_error("Stage does not have any previous stages"); + return *m_inputs[0]; +} + + +std::vector Stage::getPrevStages() const +{ + return m_inputs; +} + + const Bounds& Stage::getBounds() const { return m_bounds; @@ -150,6 +222,18 @@ void Stage::setCoreProperties(const Stage& stage) this->setSpatialReference(stage.getSpatialReference()); } +std::vector Stage::makeVector(Stage& sref) +{ + std::vector v; + v.push_back(&sref); + return v; +} + +std::vector Stage::makeVector(const std::vector& stages) +{ + return stages; +} + std::ostream& operator<<(std::ostream& ostr, const Stage& stage) { ostr << " Name: " << stage.getName() << std::endl; diff --git a/src/StageBase.cpp b/src/StageBase.cpp deleted file mode 100644 index ed8c639ddf..0000000000 --- a/src/StageBase.cpp +++ /dev/null @@ -1,253 +0,0 @@ -/****************************************************************************** -* Copyright (c) 2011, Michael P. Gerlek (mpg@flaxen.com) -* -* All rights reserved. -* -* Redistribution and use in source and binary forms, with or without -* modification, are permitted provided that the following -* conditions are met: -* -* * Redistributions of source code must retain the above copyright -* notice, this list of conditions and the following disclaimer. -* * Redistributions in binary form must reproduce the above copyright -* notice, this list of conditions and the following disclaimer in -* the documentation and/or other materials provided -* with the distribution. -* * Neither the name of Hobu, Inc. or Flaxen Geo Consulting nor the -* names of its contributors may be used to endorse or promote -* products derived from this software without specific prior -* written permission. -* -* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS -* FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE -* COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, -* INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, -* BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS -* OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED -* AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, -* OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT -* OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY -* OF SUCH DAMAGE. -****************************************************************************/ - -#include - -#include - -#include -#include -#include - -#include -#include - -namespace pdal -{ - -std::vector StageBase::makeVector() -{ - std::vector v; - return v; -} - -std::vector StageBase::makeVector(Stage& sref) -{ - Stage* s = &sref; - StageBase* sb = s; - std::vector v; - v.push_back(sb); - return v; -} - -std::vector StageBase::makeVector(const std::vector& stages) -{ - std::vector v; - BOOST_FOREACH(Stage* stage, stages) - { - v.push_back(stage); - } - return v; -} - -StageBase::StageBase(const std::vector& inputs, const Options& options) - : m_initialized(false) - , m_options(options) - , m_debug(options.getValueOrDefault("debug", false)) - , m_verbose(options.getValueOrDefault("verbose", 0)) - , m_id(options.getValueOrDefault("id", 0)) - , m_inputs(inputs) - , m_dimensionsType(StageOperation_All) - , m_log(LogPtr()) -{ - BOOST_FOREACH(StageBase* input, m_inputs) - { - input->m_outputs.push_back(this); - } - - if (m_debug) - if (m_verbose == 0) m_verbose = 1; - - return; -} - - -StageBase::~StageBase() -{ - -} - -void StageBase::initialize() -{ - // first, initialize any previous stages - BOOST_FOREACH(StageBase* prev, getInputs()) - { - prev->initialize(); - } - - // it is illegal to call initialize() twice - if (m_initialized) - { - throw pdal_error("Class already initialized: " + this->getName()); - } - - m_debug = m_options.getValueOrDefault("debug", false); - m_verbose = m_options.getValueOrDefault("verbose", 0); - if (m_debug) - if (m_verbose == 0) m_verbose = 1; - - - std::vector const& inputs = getInputs(); - if (inputs.size() == 0) - { - std::string logname = m_options.getValueOrDefault("log", "stdlog"); - m_log = boost::shared_ptr(new Log(getName(), logname)); - } - else - { - if (m_options.hasOption("log")) - { - std::string logname = m_options.getValueOrThrow("log"); - m_log = boost::shared_ptr(new Log(getName(), logname)); - } - else - { - std::ostream* v = getPrevStage().log()->getLogStream(); - m_log = boost::shared_ptr(new Log(getName(), v)); - } - } - - m_log->setLevel(static_cast(m_verbose)); - - m_initialized = true; - - return; -} - -bool StageBase::isInitialized() const -{ - return m_initialized; -} - - -const Options& StageBase::getOptions() const -{ - return m_options; -} - - -Metadata StageBase::getMetadata() const -{ - return m_metadata; -} - -Metadata StageBase::collectMetadata() const -{ - Metadata output(m_metadata); - output = output + m_metadata; - - try - { - Metadata const& m = getPrevStage().getMetadata(); - output = output + m; - } - catch (pdal::internal_error const&) - { - } - - return output; -} - -Options& StageBase::getOptions() -{ - return m_options; -} - - -bool StageBase::isDebug() const -{ - return m_debug; -} - - -bool StageBase::isVerbose() const -{ - return m_verbose > 0; -} - - -boost::uint32_t StageBase::getVerboseLevel() const -{ - return m_verbose; -} - - -const std::vector& StageBase::getInputs() const -{ - return m_inputs; -} - - -const std::vector& StageBase::getOutputs() const -{ - return m_outputs; -} - - -Stage& StageBase::getPrevStage() const -{ - // BUG: should probably do this once and cache it - if (getInputs().size()==0) throw internal_error("StageBase does not have any previous stages"); - StageBase* sb = getInputs()[0]; - Stage* s = dynamic_cast(sb); - if (!s) throw internal_error("previous StageBase is not a Stage"); - return *s; -} - - -std::vector StageBase::getPrevStages() const -{ - // BUG: should probably do this once and cache it - std::vector vec; - BOOST_FOREACH(StageBase* prev, getInputs()) - { - Stage* s = dynamic_cast(prev); - if (!s) throw internal_error("previous StageBase is not a Stage"); - vec.push_back(s); - } - return vec; -} - - -std::ostream& operator<<(std::ostream& ostr, const StageBase& stage) -{ - // boost::property_tree::ptree tree = stage.toPTree(); - // - // boost::property_tree::write_json(ostr, tree); - // - return ostr; -} - - -} // namespace pdal diff --git a/src/Writer.cpp b/src/Writer.cpp index 49a0c4cc7e..751d363ffb 100644 --- a/src/Writer.cpp +++ b/src/Writer.cpp @@ -51,19 +51,14 @@ namespace pdal { Writer::Writer(Stage& prevStage, const Options& options) - : StageBase(StageBase::makeVector(prevStage), options) - , m_userCallback(0) - , m_writer_buffer(0) -{ - return; -} + : Stage(makeVector(prevStage), options), m_userCallback(0), + m_writer_buffer(0) +{} void Writer::initialize() { - StageBase::initialize(); - - return; + Stage::initialize(); } Writer::~Writer() @@ -288,14 +283,4 @@ boost::property_tree::ptree Writer::serializePipeline() const } -// boost::property_tree::ptree Writer::toPTree() const -// { -// boost::property_tree::ptree tree = StageBase::toPTree(); -// -// // (nothing to add for a Writer) -// -// return tree; -// } - - } // namespace pdal diff --git a/src/drivers/oci/Writer.cpp b/src/drivers/oci/Writer.cpp index a77c319f7e..986a497c7e 100644 --- a/src/drivers/oci/Writer.cpp +++ b/src/drivers/oci/Writer.cpp @@ -927,15 +927,14 @@ void Writer::CreatePCEntry(Schema const& buffer_schema) try { - Option& pc_id = getOptions().getOptionByRef("pc_id"); + Option& pc_id = m_options.getOptionByRef("pc_id"); pc_id.setValue(m_pc_id); } catch (pdal::option_not_found&) { Option pc_id("pc_id", m_pc_id, "Point Cloud Id"); - getOptions().add(pc_id); + m_options.add(pc_id); } - } bool Writer::IsValidWKT(std::string const& input) diff --git a/src/filters/Scaling.cpp b/src/filters/Scaling.cpp index 492052376b..d7d30c3740 100644 --- a/src/filters/Scaling.cpp +++ b/src/filters/Scaling.cpp @@ -62,9 +62,7 @@ void Scaling::initialize() void Scaling::checkImpedance() { - Options& options = getOptions(); - - std::vector