[Liblas-commits] libpc: add Stage::getName()
liblas-commits at liblas.org
liblas-commits at liblas.org
Tue Mar 1 16:40:33 EST 2011
details: http://hg.liblas.orglibpc/rev/4083a8ad908e
changeset: 145:4083a8ad908e
user: Michael P. Gerlek <mpg at flaxen.com>
date: Tue Mar 01 13:40:24 2011 -0800
description:
add Stage::getName()
diffstat:
include/libpc/ColorFilter.hpp | 2 ++
include/libpc/CropFilter.hpp | 2 ++
include/libpc/FauxReader.hpp | 2 ++
include/libpc/FauxWriter.hpp | 2 ++
include/libpc/LasReader.hpp | 2 ++
include/libpc/LasWriter.hpp | 2 +-
include/libpc/MosaicFilter.hpp | 2 ++
include/libpc/Stage.hpp | 5 +++++
src/ColorFilter.cpp | 7 +++++++
src/CropFilter.cpp | 7 +++++++
src/FauxReader.cpp | 7 +++++++
src/FauxWriter.cpp | 7 +++++++
src/LasReader.cpp | 7 +++++++
src/LasWriter.cpp | 7 +++++++
src/MosaicFilter.cpp | 7 +++++++
src/drivers/liblas/reader.cpp | 7 +++++++
src/drivers/liblas/reader.hpp | 2 ++
src/drivers/liblas/writer.cpp | 7 +++++++
src/drivers/liblas/writer.hpp | 2 ++
test/unit/CropFilterTest.cpp | 1 +
test/unit/FauxReaderTest.cpp | 1 +
test/unit/FauxWriterTest.cpp | 1 +
test/unit/LiblasReaderTest.cpp | 1 +
test/unit/LiblasWriterTest.cpp | 1 +
24 files changed, 90 insertions(+), 1 deletions(-)
diffs (truncated from 331 to 300 lines):
diff -r 4c5f9ca6e064 -r 4083a8ad908e include/libpc/ColorFilter.hpp
--- a/include/libpc/ColorFilter.hpp Tue Mar 01 13:40:08 2011 -0800
+++ b/include/libpc/ColorFilter.hpp Tue Mar 01 13:40:24 2011 -0800
@@ -50,6 +50,8 @@
public:
ColorFilter(Stage& prevStage);
+ const std::string& getName() const;
+
boost::uint32_t readPoints(PointData&);
private:
diff -r 4c5f9ca6e064 -r 4083a8ad908e include/libpc/CropFilter.hpp
--- a/include/libpc/CropFilter.hpp Tue Mar 01 13:40:08 2011 -0800
+++ b/include/libpc/CropFilter.hpp Tue Mar 01 13:40:24 2011 -0800
@@ -49,6 +49,8 @@
public:
CropFilter(Stage& prevStage, Bounds<double> const& bounds);
+ const std::string& getName() const;
+
boost::uint32_t readPoints(PointData&);
private:
diff -r 4c5f9ca6e064 -r 4083a8ad908e include/libpc/FauxReader.hpp
--- a/include/libpc/FauxReader.hpp Tue Mar 01 13:40:08 2011 -0800
+++ b/include/libpc/FauxReader.hpp Tue Mar 01 13:40:24 2011 -0800
@@ -66,6 +66,8 @@
FauxReader(const Bounds<double>&, int numPoints, Mode mode);
FauxReader(const Bounds<double>&, int numPoints, Mode mode, const std::vector<Dimension>& dimensions);
+ const std::string& getName() const;
+
boost::uint32_t readPoints(PointData& data);
void seekToPoint(boost::uint64_t);
diff -r 4c5f9ca6e064 -r 4083a8ad908e include/libpc/FauxWriter.hpp
--- a/include/libpc/FauxWriter.hpp Tue Mar 01 13:40:08 2011 -0800
+++ b/include/libpc/FauxWriter.hpp Tue Mar 01 13:40:24 2011 -0800
@@ -53,6 +53,8 @@
public:
FauxWriter(Stage& prevStage);
+ const std::string& getName() const;
+
// retrieve the summary info
float getMinX() const { return m_minimumX; }
float getMinY() const { return m_minimumY; }
diff -r 4c5f9ca6e064 -r 4083a8ad908e include/libpc/LasReader.hpp
--- a/include/libpc/LasReader.hpp Tue Mar 01 13:40:08 2011 -0800
+++ b/include/libpc/LasReader.hpp Tue Mar 01 13:40:24 2011 -0800
@@ -48,6 +48,8 @@
public:
LasReader(std::istream&);
+ const std::string& getName() const;
+
virtual boost::uint32_t readPoints(PointData&);
// default is to reset() and then read N points manually
diff -r 4c5f9ca6e064 -r 4083a8ad908e include/libpc/LasWriter.hpp
--- a/include/libpc/LasWriter.hpp Tue Mar 01 13:40:08 2011 -0800
+++ b/include/libpc/LasWriter.hpp Tue Mar 01 13:40:24 2011 -0800
@@ -45,7 +45,7 @@
public:
LasWriter(Stage& prevStage, std::ostream&);
- //void write();
+ const std::string& getName() const;
protected:
// this is called once before the loop with the writeBuffer calls
diff -r 4c5f9ca6e064 -r 4083a8ad908e include/libpc/MosaicFilter.hpp
--- a/include/libpc/MosaicFilter.hpp Tue Mar 01 13:40:08 2011 -0800
+++ b/include/libpc/MosaicFilter.hpp Tue Mar 01 13:40:24 2011 -0800
@@ -47,6 +47,8 @@
{
public:
MosaicFilter(Stage& prevStage, Stage& prevStage2);
+
+ const std::string& getName() const;
boost::uint32_t readPoints(PointData&);
diff -r 4c5f9ca6e064 -r 4083a8ad908e include/libpc/Stage.hpp
--- a/include/libpc/Stage.hpp Tue Mar 01 13:40:08 2011 -0800
+++ b/include/libpc/Stage.hpp Tue Mar 01 13:40:24 2011 -0800
@@ -52,6 +52,11 @@
Stage();
virtual ~Stage();
+ // Implement this in your concrete classes to return a constant string
+ // as the name of the stage. Use upper camel case, with spaces between
+ // words. The last word should be "Reader", "Writer", or "Filter".
+ virtual const std::string& getName() const = 0;
+
// This reads a set of points at the current position in the file.
//
// The schema of the PointData buffer we are given here might
diff -r 4c5f9ca6e064 -r 4083a8ad908e src/ColorFilter.cpp
--- a/src/ColorFilter.cpp Tue Mar 01 13:40:08 2011 -0800
+++ b/src/ColorFilter.cpp Tue Mar 01 13:40:24 2011 -0800
@@ -53,6 +53,13 @@
}
+const std::string& ColorFilter::getName() const
+{
+ static std::string name("Color Filter");
+ return name;
+}
+
+
boost::uint32_t ColorFilter::readPoints(PointData& data)
{
m_prevStage.readPoints(data);
diff -r 4c5f9ca6e064 -r 4083a8ad908e src/CropFilter.cpp
--- a/src/CropFilter.cpp Tue Mar 01 13:40:08 2011 -0800
+++ b/src/CropFilter.cpp Tue Mar 01 13:40:24 2011 -0800
@@ -49,6 +49,13 @@
}
+const std::string& CropFilter::getName() const
+{
+ static std::string name("Crop Filter");
+ return name;
+}
+
+
boost::uint32_t CropFilter::readPoints(PointData& data)
{
m_prevStage.readPoints(data);
diff -r 4c5f9ca6e064 -r 4083a8ad908e src/FauxReader.cpp
--- a/src/FauxReader.cpp Tue Mar 01 13:40:08 2011 -0800
+++ b/src/FauxReader.cpp Tue Mar 01 13:40:24 2011 -0800
@@ -88,6 +88,13 @@
}
+const std::string& FauxReader::getName() const
+{
+ static std::string name("Faux Reader");
+ return name;
+}
+
+
boost::uint32_t FauxReader::readPoints(PointData& data)
{
if (data.getSchemaLayout().getSchema().getDimensions().size() != 4)
diff -r 4c5f9ca6e064 -r 4083a8ad908e src/FauxWriter.cpp
--- a/src/FauxWriter.cpp Tue Mar 01 13:40:08 2011 -0800
+++ b/src/FauxWriter.cpp Tue Mar 01 13:40:24 2011 -0800
@@ -50,6 +50,13 @@
}
+const std::string& FauxWriter::getName() const
+{
+ static std::string name("Faux Writer");
+ return name;
+}
+
+
void FauxWriter::writeBegin()
{
m_minimumX = m_minimumY = m_minimumZ = std::numeric_limits<float>::max();
diff -r 4c5f9ca6e064 -r 4083a8ad908e src/LasReader.cpp
--- a/src/LasReader.cpp Tue Mar 01 13:40:08 2011 -0800
+++ b/src/LasReader.cpp Tue Mar 01 13:40:24 2011 -0800
@@ -54,6 +54,13 @@
}
+const std::string& LasReader::getName() const
+{
+ static std::string name("Las Reader");
+ return name;
+}
+
+
const LasHeader& LasReader::getLasHeader() const
{
return (const LasHeader&)getHeader();
diff -r 4c5f9ca6e064 -r 4083a8ad908e src/LasWriter.cpp
--- a/src/LasWriter.cpp Tue Mar 01 13:40:08 2011 -0800
+++ b/src/LasWriter.cpp Tue Mar 01 13:40:24 2011 -0800
@@ -52,6 +52,13 @@
}
+const std::string& LasWriter::getName() const
+{
+ static std::string name("Liblas Writer");
+ return name;
+}
+
+
void LasWriter::writeBegin()
{
Header& baseHeader = getHeader();
diff -r 4c5f9ca6e064 -r 4083a8ad908e src/MosaicFilter.cpp
--- a/src/MosaicFilter.cpp Tue Mar 01 13:40:08 2011 -0800
+++ b/src/MosaicFilter.cpp Tue Mar 01 13:40:24 2011 -0800
@@ -60,6 +60,13 @@
}
+const std::string& MosaicFilter::getName() const
+{
+ static std::string name("Mosaic Filter");
+ return name;
+}
+
+
boost::uint32_t MosaicFilter::readPoints(PointData& destData)
{
boost::uint32_t numPoints = destData.getNumPoints();
diff -r 4c5f9ca6e064 -r 4083a8ad908e src/drivers/liblas/reader.cpp
--- a/src/drivers/liblas/reader.cpp Tue Mar 01 13:40:08 2011 -0800
+++ b/src/drivers/liblas/reader.cpp Tue Mar 01 13:40:24 2011 -0800
@@ -83,6 +83,13 @@
}
+const std::string& LiblasReader::getName() const
+{
+ static std::string name("Liblas Reader");
+ return name;
+}
+
+
void LiblasReader::processExternalHeader()
{
const liblas::Header& externalHeader = m_externalReader->GetHeader();
diff -r 4c5f9ca6e064 -r 4083a8ad908e src/drivers/liblas/reader.hpp
--- a/src/drivers/liblas/reader.hpp Tue Mar 01 13:40:08 2011 -0800
+++ b/src/drivers/liblas/reader.hpp Tue Mar 01 13:40:24 2011 -0800
@@ -60,6 +60,8 @@
LiblasReader(std::istream&);
~LiblasReader();
+ const std::string& getName() const;
+
virtual boost::uint32_t readPoints(PointData&);
// default is to reset() and then read N points manually
diff -r 4c5f9ca6e064 -r 4083a8ad908e src/drivers/liblas/writer.cpp
--- a/src/drivers/liblas/writer.cpp Tue Mar 01 13:40:08 2011 -0800
+++ b/src/drivers/liblas/writer.cpp Tue Mar 01 13:40:24 2011 -0800
@@ -76,6 +76,13 @@
}
+const std::string& LiblasWriter::getName() const
+{
+ static std::string name("Liblas Writer");
+ return name;
+}
+
+
void LiblasWriter::setupExternalHeader()
{
setFormatVersion(1,2);
diff -r 4c5f9ca6e064 -r 4083a8ad908e src/drivers/liblas/writer.hpp
--- a/src/drivers/liblas/writer.hpp Tue Mar 01 13:40:08 2011 -0800
+++ b/src/drivers/liblas/writer.hpp Tue Mar 01 13:40:24 2011 -0800
@@ -53,6 +53,8 @@
public:
LiblasWriter(Stage& prevStage, std::ostream&);
~LiblasWriter();
+
+ const std::string& getName() const;
void setFormatVersion(boost::uint8_t majorVersion, boost::uint8_t minorVersion);
void setPointFormat(boost::int8_t pointFormat);
diff -r 4c5f9ca6e064 -r 4083a8ad908e test/unit/CropFilterTest.cpp
--- a/test/unit/CropFilterTest.cpp Tue Mar 01 13:40:08 2011 -0800
+++ b/test/unit/CropFilterTest.cpp Tue Mar 01 13:40:24 2011 -0800
@@ -53,6 +53,7 @@
FauxReader reader(srcBounds, 1000, FauxReader::Random);
CropFilter filter(reader, dstBounds);
+ BOOST_CHECK(filter.getName() == "Crop Filter");
FauxWriter writer(filter);
diff -r 4c5f9ca6e064 -r 4083a8ad908e test/unit/FauxReaderTest.cpp
--- a/test/unit/FauxReaderTest.cpp Tue Mar 01 13:40:08 2011 -0800
+++ b/test/unit/FauxReaderTest.cpp Tue Mar 01 13:40:24 2011 -0800
@@ -45,6 +45,7 @@
{
Bounds<double> bounds(1.0, 2.0, 3.0, 101.0, 102.0, 103.0);
FauxReader reader(bounds, 1000, FauxReader::Constant);
+ BOOST_CHECK(reader.getName() == "Faux Reader");
const Schema& schema = reader.getHeader().getSchema();
SchemaLayout layout(schema);
diff -r 4c5f9ca6e064 -r 4083a8ad908e test/unit/FauxWriterTest.cpp
--- a/test/unit/FauxWriterTest.cpp Tue Mar 01 13:40:08 2011 -0800
More information about the Liblas-commits
mailing list