[Liblas-commits] hg-main-tree: StreamOwner class work
liblas-commits at liblas.org
liblas-commits at liblas.org
Tue Jul 26 18:14:11 EDT 2011
details: http://hg.libpc.orghg-main-tree/rev/2c1ad5da07af
changeset: 940:2c1ad5da07af
user: Michael P. Gerlek <mpg at flaxen.com>
date: Tue Jul 26 12:00:24 2011 -0700
description:
StreamOwner class work
Subject: hg-main-tree: StreamOwner renamed to StreamManager because it doesn't actually, umm, own the stream
details: http://hg.libpc.orghg-main-tree/rev/1c24715649fc
changeset: 941:1c24715649fc
user: Michael P. Gerlek <mpg at flaxen.com>
date: Tue Jul 26 12:04:27 2011 -0700
description:
StreamOwner renamed to StreamManager because it doesn't actually, umm, own the stream
Subject: hg-main-tree: merge
details: http://hg.libpc.orghg-main-tree/rev/0e545c2cba3e
changeset: 942:0e545c2cba3e
user: Michael P. Gerlek <mpg at flaxen.com>
date: Tue Jul 26 12:04:37 2011 -0700
description:
merge
Subject: hg-main-tree: merge
details: http://hg.libpc.orghg-main-tree/rev/8049c567d88f
changeset: 943:8049c567d88f
user: Michael P. Gerlek <mpg at flaxen.com>
date: Tue Jul 26 14:14:50 2011 -0700
description:
merge
Subject: hg-main-tree: merge
details: http://hg.libpc.orghg-main-tree/rev/501d95502c2a
changeset: 944:501d95502c2a
user: Michael P. Gerlek <mpg at flaxen.com>
date: Tue Jul 26 14:23:26 2011 -0700
description:
merge
Subject: hg-main-tree: added option-based ctors for Las reader/writer, crop; turned back on pipeline manager tests
details: http://hg.libpc.orghg-main-tree/rev/a768f37245fd
changeset: 945:a768f37245fd
user: Michael P. Gerlek <mpg at flaxen.com>
date: Tue Jul 26 15:14:02 2011 -0700
description:
added option-based ctors for Las reader/writer, crop; turned back on pipeline manager tests
diffstat:
apps/pc2pc.cpp | 4 +-
include/pdal/PipelineManager.hpp | 10 +-
include/pdal/Schema.hpp | 10 +-
include/pdal/StreamManager.hpp | 126 ++++++++++++++++
include/pdal/StreamOwner.hpp | 105 -------------
include/pdal/drivers/las/Reader.hpp | 4 +-
include/pdal/drivers/las/Writer.hpp | 8 +-
include/pdal/filters/CropFilter.hpp | 2 +
src/CMakeLists.txt | 4 +-
src/PipelineManager.cpp | 40 ++++-
src/Schema.cpp | 67 ++++++-
src/StageFactory.cpp | 13 +-
src/StreamManager.cpp | 237 +++++++++++++++++++++++++++++++
src/StreamOwner.cpp | 134 -----------------
src/drivers/las/Reader.cpp | 24 ++-
src/drivers/las/VariableLengthRecord.cpp | 2 +-
src/drivers/las/Writer.cpp | 50 ++++--
src/filters/ByteSwapFilter.cpp | 29 +-
src/filters/CropFilter.cpp | 22 ++-
test/unit/CMakeLists.txt | 2 +-
test/unit/LasWriterTest.cpp | 6 +-
test/unit/OptionsTest.cpp | 4 +-
test/unit/PipelineManagerTest.cpp | 8 +-
test/unit/SpatialReferenceTest.cpp | 4 +-
test/unit/StageFactoryTest.cpp | 54 ++++--
test/unit/StreamManagerTest.cpp | 141 ++++++++++++++++++
test/unit/StreamOwnerTest.cpp | 111 --------------
27 files changed, 761 insertions(+), 460 deletions(-)
diffs (truncated from 1765 to 300 lines):
diff -r c1aa0d010dbf -r a768f37245fd apps/pc2pc.cpp
--- a/apps/pc2pc.cpp Tue Jul 26 07:55:34 2011 -0700
+++ b/apps/pc2pc.cpp Tue Jul 26 15:14:02 2011 -0700
@@ -126,7 +126,7 @@
const boost::uint64_t numPoints = reader.getNumPoints();
- pdal::drivers::las::LasWriter writer(reader, *ofs);
+ pdal::drivers::las::LasWriter writer(reader, ofs);
//BUG: handle laz writer.setCompressed(false);
@@ -243,7 +243,7 @@
scalez, offsetz,
true);
- pdal::drivers::las::LasWriter writer(descalingFilter, *ofs);
+ pdal::drivers::las::LasWriter writer(descalingFilter, ofs);
if (compress)
diff -r c1aa0d010dbf -r a768f37245fd include/pdal/PipelineManager.hpp
--- a/include/pdal/PipelineManager.hpp Tue Jul 26 07:55:34 2011 -0700
+++ b/include/pdal/PipelineManager.hpp Tue Jul 26 15:14:02 2011 -0700
@@ -77,8 +77,14 @@
StageFactory m_factory;
- //typedef std::vector<StagePtr> StagePtrList;
- //StagePtrList m_stages;
+ typedef std::vector<Reader*> ReaderList;
+ typedef std::vector<Filter*> FilterList;
+ typedef std::vector<MultiFilter*> MultiFilterList;
+ typedef std::vector<Writer*> WriterList;
+ ReaderList m_readers;
+ FilterList m_filters;
+ MultiFilterList m_multifilters;
+ WriterList m_writers;
PipelineManager& operator=(const PipelineManager&); // not implemented
PipelineManager(const PipelineManager&); // not implemented
diff -r c1aa0d010dbf -r a768f37245fd include/pdal/Schema.hpp
--- a/include/pdal/Schema.hpp Tue Jul 26 07:55:34 2011 -0700
+++ b/include/pdal/Schema.hpp Tue Jul 26 15:14:02 2011 -0700
@@ -45,6 +45,7 @@
#include <pdal/pdal.hpp>
#include <vector>
+#include <map>
#include <pdal/Dimension.hpp>
@@ -56,10 +57,16 @@
#include <boost/array.hpp>
#include <boost/optional.hpp>
+#include <boost/tuple/tuple.hpp>
+#include <boost/tuple/tuple_comparison.hpp>
+
+
namespace pdal
{
+typedef boost::tuple<Dimension::Field, Dimension::DataType> tpl_t;
+
/// Schema definition
class PDAL_DLL Schema
{
@@ -85,7 +92,7 @@
const Dimension& getDimension(std::size_t index) const;
Dimension& getDimension(std::size_t index);
const Dimensions& getDimensions() const;
- Dimensions& getDimensions();
+ // Dimensions& getDimensions();
// returns the index of the field
//
@@ -109,6 +116,7 @@
private:
std::vector<Dimension> m_dimensions;
+ std::map<tpl_t, std::size_t> m_dimensions_map;
// this is a mapping from field name to index position in the
// m_dimensions array (or -1 if field not present)
// int m_indexTable[Dimension::Field_LAST];
diff -r c1aa0d010dbf -r a768f37245fd include/pdal/StreamManager.hpp
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/include/pdal/StreamManager.hpp Tue Jul 26 15:14:02 2011 -0700
@@ -0,0 +1,126 @@
+/******************************************************************************
+* Copyright (c) 2011, Michael P. Gerlek (mpg at 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_STREAMMANAGER_HPP
+#define INCLUDED_STREAMMANAGER_HPP
+
+#include <pdal/pdal.hpp>
+
+#include <string>
+#include <cassert>
+#include <stdexcept>
+#include <cmath>
+#include <ostream>
+#include <istream>
+
+namespace pdal
+{
+
+// Many of our reader & writer classes want to take a filename or a stream
+// in their ctors, which means that we need a common piece of code that
+// creates and takes ownership of the stream, if needed.
+//
+// This could, I suppose, evolve into something that even takes in things
+// other than std streams or filenames.
+//
+// You must always call open(), regardless of what kind of ctor you call,
+// i.e. stream or filename. Calling close() is optional (the dtor will do
+// it for you.)
+
+class PDAL_DLL StreamManagerBase
+{
+public:
+ enum Type { Stream, File };
+
+ StreamManagerBase(const std::string& filename, Type type);
+ virtual ~StreamManagerBase() {}
+
+ virtual void open() = 0; // throws
+ virtual void close() = 0;
+
+ // returns "" if stream-based ctor was used
+ virtual const std::string& getFileName() const;
+
+ Type getType() const;
+ bool isOpen() const;
+
+protected:
+ bool m_isOpen;
+
+private:
+ const Type m_type;
+
+ std::string m_filename;
+
+ StreamManagerBase(const StreamManagerBase&); // nope
+ StreamManagerBase& operator=(const StreamManagerBase&); // nope
+};
+
+
+class PDAL_DLL IStreamManager : public StreamManagerBase
+{
+public:
+ IStreamManager(const std::string& filename);
+ IStreamManager(std::istream*); // may not be NULL
+ ~IStreamManager();
+
+ virtual void open(); // throws
+ virtual void close();
+
+ std::istream& istream();
+
+private:
+ std::istream* m_istream; // not NULL iff we own the stream
+};
+
+
+class PDAL_DLL OStreamManager : public StreamManagerBase
+{
+public:
+ OStreamManager(const std::string& filename);
+ OStreamManager(std::ostream*); // may not be NULL
+ ~OStreamManager();
+
+ virtual void open(); // throws
+ virtual void close();
+
+ std::ostream& ostream();
+
+private:
+ std::ostream* m_ostream;
+};
+
+} // namespace pdal
+
+#endif
diff -r c1aa0d010dbf -r a768f37245fd include/pdal/StreamOwner.hpp
--- a/include/pdal/StreamOwner.hpp Tue Jul 26 07:55:34 2011 -0700
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,105 +0,0 @@
-/******************************************************************************
-* Copyright (c) 2011, Michael P. Gerlek (mpg at 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_STREAMOWNER_HPP
-#define INCLUDED_STREAMOWNER_HPP
-
-#include <pdal/pdal.hpp>
-
-#include <string>
-#include <cassert>
-#include <stdexcept>
-#include <cmath>
-#include <ostream>
-#include <istream>
-
-namespace pdal
-{
-
-// Many of our reader & writer classes want to take a filename or a stream
-// in their ctors, which means that we need a common piece of code that
-// creates and takes ownership of the stream, if needed.
-//
-// This could, I suppose, evolve into something that even takes in things
-// other than std streams or filenames.
-
-class PDAL_DLL StreamOwnerBase
-{
-public:
- StreamOwnerBase(const std::string& filename);
- virtual ~StreamOwnerBase() {}
-
- // returns "" if stream-based ctor was used
- virtual const std::string& getFileName() const;
-
-private:
- std::string m_filename;
-
- StreamOwnerBase(const StreamOwnerBase&); // nope
- StreamOwnerBase operator=(const StreamOwnerBase&); // nope
-};
-
-
-class PDAL_DLL IStreamOwner : public StreamOwnerBase
-{
-public:
- IStreamOwner(const std::string& filename);
- IStreamOwner(std::istream&);
- ~IStreamOwner();
-
More information about the Liblas-commits
mailing list