[Liblas-commits] hg-main-tree: oci::Reader Iterator scaffolding. use libpc::driv...

liblas-commits at liblas.org liblas-commits at liblas.org
Mon Mar 28 15:05:18 EDT 2011


details:   http://hg.libpc.orghg-main-tree/rev/8d8a83b2635e
changeset: 480:8d8a83b2635e
user:      Howard Butler <hobu.inc at gmail.com>
date:      Mon Mar 28 14:04:55 2011 -0500
description:
oci::Reader Iterator scaffolding.  use libpc::drivers instead of libpc::driver for namespace for OCI driver like the rest

diffstat:

 apps/pc2pc.cpp                         |    4 +-
 include/libpc/drivers/oci/Common.hpp   |    2 +-
 include/libpc/drivers/oci/Iterator.hpp |   84 +++++++++++
 include/libpc/drivers/oci/Reader.hpp   |   10 +-
 include/libpc/drivers/oci/Writer.hpp   |    2 +-
 src/CMakeLists.txt                     |    2 +
 src/drivers/oci/Iterator.cpp           |  238 +++++++++++++++++++++++++++++++++
 src/drivers/oci/Reader.cpp             |   25 +--
 src/drivers/oci/Writer.cpp             |    2 +-
 src/drivers/oci/common.cpp             |    2 +-
 10 files changed, 340 insertions(+), 31 deletions(-)

diffs (truncated from 501 to 300 lines):

diff -r 3bbf7cfb2d83 -r 8d8a83b2635e apps/pc2pc.cpp
--- a/apps/pc2pc.cpp	Mon Mar 28 12:57:26 2011 -0500
+++ b/apps/pc2pc.cpp	Mon Mar 28 14:04:55 2011 -0500
@@ -126,7 +126,7 @@
     
         const boost::uint64_t numPoints = reader.getNumPoints();
         
-        libpc::driver::oci::Options options;
+        libpc::drivers::oci::Options options;
         boost::property_tree::ptree& tree = options.GetPTree();
         
         tree.put("capacity", 12);
@@ -136,7 +136,7 @@
         
         libpc::filters::CacheFilter cache(reader, 1, 1024);
         libpc::filters::Chipper chipper(cache, 12);
-        libpc::driver::oci::Writer writer(chipper, options);
+        libpc::drivers::oci::Writer writer(chipper, options);
 
         writer.write(numPoints);
 #else
diff -r 3bbf7cfb2d83 -r 8d8a83b2635e include/libpc/drivers/oci/Common.hpp
--- a/include/libpc/drivers/oci/Common.hpp	Mon Mar 28 12:57:26 2011 -0500
+++ b/include/libpc/drivers/oci/Common.hpp	Mon Mar 28 14:04:55 2011 -0500
@@ -50,7 +50,7 @@
 void CPL_STDCALL OCIGDALDebugErrorHandler(CPLErr eErrClass, int err_no, const char *msg);
 
 
-namespace libpc { namespace driver { namespace oci {
+namespace libpc { namespace drivers { namespace oci {
 
 typedef boost::shared_ptr<OWConnection> Connection ;
 typedef boost::shared_ptr<OWStatement> Statement ;
diff -r 3bbf7cfb2d83 -r 8d8a83b2635e include/libpc/drivers/oci/Iterator.hpp
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/include/libpc/drivers/oci/Iterator.hpp	Mon Mar 28 14:04:55 2011 -0500
@@ -0,0 +1,84 @@
+/******************************************************************************
+* 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_DRIVERS_OCI_ITERATOR_HPP
+#define INCLUDED_DRIVERS_OCI_ITERATOR_HPP
+
+#include <libpc/libpc.hpp>
+
+#include <libpc/Iterator.hpp>
+
+#include <string>
+
+namespace libpc { namespace drivers { namespace oci {
+
+class Reader;
+
+
+class IteratorBase
+{
+public:
+    IteratorBase(const Reader& reader);
+    ~IteratorBase();
+
+protected:
+    const Reader& getReader() const;
+    
+    boost::uint32_t readBuffer(PointBuffer& data);
+
+private:
+    const Reader& m_reader;
+    
+    IteratorBase& operator=(const IteratorBase&); // not implemented
+    IteratorBase(const IteratorBase&); // not implemented};
+};
+
+
+class SequentialIterator : public IteratorBase, public libpc::SequentialIterator
+{
+public:
+    SequentialIterator(const Reader& reader);
+    ~SequentialIterator();
+
+private:
+    boost::uint64_t skipImpl(boost::uint64_t count);
+    boost::uint32_t readImpl(PointBuffer& data);
+    bool atEndImpl() const;
+};
+
+
+
+} } } // namespaces
+
+#endif
diff -r 3bbf7cfb2d83 -r 8d8a83b2635e include/libpc/drivers/oci/Reader.hpp
--- a/include/libpc/drivers/oci/Reader.hpp	Mon Mar 28 12:57:26 2011 -0500
+++ b/include/libpc/drivers/oci/Reader.hpp	Mon Mar 28 14:04:55 2011 -0500
@@ -41,10 +41,10 @@
 #include <libpc/drivers/oci/Common.hpp>
 
 
-namespace libpc { namespace driver { namespace oci {
 
+namespace libpc { namespace drivers { namespace oci {
 
-class Options;
+
 
 
 
@@ -59,14 +59,14 @@
     
     const std::string& getName() const;
  
-    void seekToPoint(boost::uint64_t pointNum);
-
     bool supportsIterator (StageIteratorType t) 
     {   
         if (t == StageIterator_Sequential ) return true;
         return false;
     }
-    
+
+    libpc::SequentialIterator* createSequentialIterator() const;
+
 private:
 
     Reader& operator=(const Reader&); // not implemented
diff -r 3bbf7cfb2d83 -r 8d8a83b2635e include/libpc/drivers/oci/Writer.hpp
--- a/include/libpc/drivers/oci/Writer.hpp	Mon Mar 28 12:57:26 2011 -0500
+++ b/include/libpc/drivers/oci/Writer.hpp	Mon Mar 28 14:04:55 2011 -0500
@@ -43,7 +43,7 @@
 
 #include "Common.hpp"
 
-namespace libpc { namespace driver { namespace oci {
+namespace libpc { namespace drivers { namespace oci {
 
 class Options;
 
diff -r 3bbf7cfb2d83 -r 8d8a83b2635e src/CMakeLists.txt
--- a/src/CMakeLists.txt	Mon Mar 28 12:57:26 2011 -0500
+++ b/src/CMakeLists.txt	Mon Mar 28 14:04:55 2011 -0500
@@ -168,6 +168,7 @@
 set(LIBPC_DRIVERS_OCI_HPP
   ${LIBPC_HEADERS_DIR}/drivers/oci/Writer.hpp
   ${LIBPC_HEADERS_DIR}/drivers/oci/Reader.hpp
+  ${LIBPC_HEADERS_DIR}/drivers/oci/Iterator.hpp
   ${LIBPC_HEADERS_DIR}/drivers/oci/oci_wrapper.h
   ${LIBPC_HEADERS_DIR}/drivers/oci/Common.hpp
 )
@@ -176,6 +177,7 @@
   ./drivers/oci/oci_wrapper.cpp
   ./drivers/oci/common.cpp
   ./drivers/oci/Reader.cpp
+  ./drivers/oci/Iterator.cpp
   ./drivers/oci/Writer.cpp
 )
    
diff -r 3bbf7cfb2d83 -r 8d8a83b2635e src/drivers/oci/Iterator.cpp
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/src/drivers/oci/Iterator.cpp	Mon Mar 28 14:04:55 2011 -0500
@@ -0,0 +1,238 @@
+/******************************************************************************
+* 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.
+****************************************************************************/
+
+#include <libpc/drivers/oci/Iterator.hpp>
+
+#include <liblas/factory.hpp>
+
+#include <libpc/exceptions.hpp>
+#include <libpc/PointBuffer.hpp>
+#include <libpc/Utils.hpp>
+#include <libpc/drivers/oci/Reader.hpp>
+
+namespace libpc { namespace drivers { namespace oci {
+
+
+//---------------------------------------------------------------------------
+//
+// LiblasIteratorBase
+//
+//---------------------------------------------------------------------------
+
+
+IteratorBase::IteratorBase(const Reader& reader)
+    : m_reader(reader)
+{
+    return;
+}
+
+
+IteratorBase::~IteratorBase()
+{
+}
+
+
+
+const Reader& IteratorBase::getReader() const
+{
+    return m_reader;
+}
+
+
+boost::uint32_t IteratorBase::readBuffer(PointBuffer& data)
+{
+    boost::uint32_t numPoints = data.getCapacity();
+    // boost::uint32_t i = 0;
+    // 
+    // const Schema& schema = data.getSchema();
+    // 
+    // const int indexX = schema.getDimensionIndex(Dimension::Field_X, Dimension::Int32);
+    // const int indexY = schema.getDimensionIndex(Dimension::Field_Y, Dimension::Int32);
+    // const int indexZ = schema.getDimensionIndex(Dimension::Field_Z, Dimension::Int32);
+    // 
+    // const int indexIntensity = schema.getDimensionIndex(Dimension::Field_Intensity, Dimension::Uint16);
+    // const int indexReturnNumber = schema.getDimensionIndex(Dimension::Field_ReturnNumber, Dimension::Uint8);
+    // const int indexNumberOfReturns = schema.getDimensionIndex(Dimension::Field_NumberOfReturns, Dimension::Uint8);
+    // const int indexScanDirectionFlag = schema.getDimensionIndex(Dimension::Field_ScanDirectionFlag, Dimension::Uint8);
+    // const int indexEdgeOfFlightLine = schema.getDimensionIndex(Dimension::Field_EdgeOfFlightLine, Dimension::Uint8);
+    // const int indexClassification = schema.getDimensionIndex(Dimension::Field_Classification, Dimension::Uint8);
+    // const int indexScanAngleRank = schema.getDimensionIndex(Dimension::Field_ScanAngleRank, Dimension::Int8);
+    // const int indexUserData = schema.getDimensionIndex(Dimension::Field_UserData, Dimension::Uint8);
+    // const int indexPointSourceId = schema.getDimensionIndex(Dimension::Field_PointSourceId, Dimension::Uint16);
+    // 
+    // const int indexTime = (getReader().hasTimeData() ? schema.getDimensionIndex(Dimension::Field_Time, Dimension::Double) : 0);
+    // 
+    // const int indexRed = (getReader().hasColorData() ? schema.getDimensionIndex(Dimension::Field_Red, Dimension::Uint16) : 0);
+    // const int indexGreen = (getReader().hasColorData() ? schema.getDimensionIndex(Dimension::Field_Green, Dimension::Uint16) : 0);
+    // const int indexBlue = (getReader().hasColorData() ? schema.getDimensionIndex(Dimension::Field_Blue, Dimension::Uint16) : 0);
+    // 
+    // //const int indexWavePacketDescriptorIndex = (m_hasWaveData ? schema.getDimensionIndex(Dimension::Field_WavePacketDescriptorIndex) : 0);
+    // //const int indexWaveformDataOffset = (m_hasWaveData ? schema.getDimensionIndex(Dimension::Field_WaveformDataOffset) : 0);
+    // //const int indexReturnPointWaveformLocation = (m_hasWaveData ? schema.getDimensionIndex(Dimension::Field_ReturnPointWaveformLocation) : 0);
+    // //const int indexWaveformXt = (m_hasWaveData ? schema.getDimensionIndex(Dimension::Field_WaveformXt) : 0);
+    // //const int indexWaveformYt = (m_hasWaveData ? schema.getDimensionIndex(Dimension::Field_WaveformYt) : 0);
+    // //const t indexWaveformZt = (m_hasWaveData ? schema.getDimensionIndex(Dimension::Field_WaveformZt) : 0);
+    // 
+    // for (i=0; i<numPoints; i++)
+    // {
+    //     bool ok = getExternalReader().ReadNextPoint();
+    //     if (!ok)


More information about the Liblas-commits mailing list