[Liblas-commits] libpc: tweak libLAS library detection to account for lib naming ...

liblas-commits at liblas.org liblas-commits at liblas.org
Mon Mar 14 15:09:03 EDT 2011


details:   http://hg.liblas.orglibpc/rev/96728b382993
changeset: 224:96728b382993
user:      Howard Butler <hobu.inc at gmail.com>
date:      Mon Mar 14 11:49:36 2011 -0500
description:
tweak libLAS library detection to account for lib naming on win32
Subject: libpc: put common libpc::driver.oci stuff into a single file

details:   http://hg.liblas.orglibpc/rev/cb823c59552b
changeset: 225:cb823c59552b
user:      Howard Butler <hobu.inc at gmail.com>
date:      Mon Mar 14 12:07:20 2011 -0500
description:
put common libpc::driver.oci stuff into a single file
Subject: libpc: move more stuff into common.hpp

details:   http://hg.liblas.orglibpc/rev/7286d652d315
changeset: 226:7286d652d315
user:      Howard Butler <hobu.inc at gmail.com>
date:      Mon Mar 14 12:19:31 2011 -0500
description:
move more stuff into common.hpp
Subject: libpc: move gdal debug stuff into common.cpp

details:   http://hg.liblas.orglibpc/rev/73220672f6ab
changeset: 227:73220672f6ab
user:      Howard Butler <hobu.inc at gmail.com>
date:      Mon Mar 14 12:19:45 2011 -0500
description:
move gdal debug stuff into common.cpp
Subject: libpc: move more stuff into common spot

details:   http://hg.liblas.orglibpc/rev/59f74b23f9c0
changeset: 228:59f74b23f9c0
user:      Howard Butler <hobu.inc at gmail.com>
date:      Mon Mar 14 12:20:09 2011 -0500
description:
move more stuff into common spot
Subject: libpc: start on libpc::driver::oci::Reader scaffolding

details:   http://hg.liblas.orglibpc/rev/8b81f9a870c6
changeset: 229:8b81f9a870c6
user:      Howard Butler <hobu.inc at gmail.com>
date:      Mon Mar 14 12:20:27 2011 -0500
description:
start on libpc::driver::oci::Reader scaffolding
Subject: libpc: giant messy merge

details:   http://hg.liblas.orglibpc/rev/c4371adc6197
changeset: 230:c4371adc6197
user:      Howard Butler <hobu.inc at gmail.com>
date:      Mon Mar 14 14:08:54 2011 -0500
description:
giant messy merge

diffstat:

 apps/pc2pc.cpp                     |   19 +-
 cmake/modules/FindLibLAS.cmake     |    6 +-
 include/libpc/CacheFilter.hpp      |   29 +-
 include/libpc/Dimension.hpp        |    2 +-
 include/libpc/FauxReader.hpp       |    2 +-
 include/libpc/Filter.hpp           |   10 +-
 include/libpc/LasReader.hpp        |    2 +-
 include/libpc/LruCache.hpp         |  162 -------------
 include/libpc/PointDataCache.hpp   |  199 +++++++++++++++++
 include/libpc/Producer.hpp         |   13 +-
 include/libpc/Stage.hpp            |   36 +-
 include/libpc/chipper.hpp          |    3 +
 src/CMakeLists.txt                 |    3 +-
 src/CacheFilter.cpp                |  119 ++++++---
 src/CropFilter.cpp                 |    6 +-
 src/Dimension.cpp                  |    2 +-
 src/FauxReader.cpp                 |    6 +-
 src/Filter.cpp                     |   20 -
 src/LasHeader.cpp                  |    2 +-
 src/LasReader.cpp                  |    6 +-
 src/LasWriter.cpp                  |    6 +-
 src/PointDataCache.cpp             |   16 +
 src/Producer.cpp                   |   27 --
 src/Stage.cpp                      |   27 +-
 src/drivers/liblas/reader.cpp      |   14 +-
 src/drivers/liblas/reader.hpp      |    4 +-
 src/drivers/liblas/writer.cpp      |    6 +-
 src/drivers/oci/CMakeLists.txt     |    3 +-
 src/drivers/oci/block.cpp          |   53 ----
 src/drivers/oci/block.hpp          |   65 -----
 src/drivers/oci/common.cpp         |  150 ++++++++++++
 src/drivers/oci/common.hpp         |   92 +++++++
 src/drivers/oci/reader.cpp         |   76 ++++++
 src/drivers/oci/reader.hpp         |   74 ++++++
 src/drivers/oci/writer.cpp         |  432 ++++++++++++++++++++++++++++--------
 src/drivers/oci/writer.hpp         |   55 +---
 test/unit/CMakeLists.txt           |    2 +-
 test/unit/CacheFilterTest.cpp      |   53 +--
 test/unit/DecimationFilterTest.cpp |    2 +-
 test/unit/FauxReaderTest.cpp       |    4 +-
 test/unit/LruCacheTest.cpp         |  116 ---------
 test/unit/MosaicFilterTest.cpp     |    2 +-
 test/unit/PointDataCacheTest.cpp   |   92 +++++++
 43 files changed, 1266 insertions(+), 752 deletions(-)

diffs (truncated from 2730 to 300 lines):

diff -r 221d3a3d6a54 -r c4371adc6197 apps/pc2pc.cpp
--- a/apps/pc2pc.cpp	Thu Mar 10 21:20:01 2011 -0600
+++ b/apps/pc2pc.cpp	Mon Mar 14 14:08:54 2011 -0500
@@ -12,7 +12,7 @@
 
 #include <iostream>
 
-//#include "libpc/exceptions.hpp"
+#include "libpc/exceptions.hpp"
 //#include "libpc/libpc_config.hpp"
 //#include "libpc/Bounds.hpp"
 //#include "libpc/Color.hpp"
@@ -31,7 +31,9 @@
 #include "libpc/../../src/drivers/liblas/writer.hpp"
 #include "libpc/../../src/drivers/liblas/reader.hpp"
 
+#ifdef HAVE_ORACLE
 #include "libpc/../../src/drivers/oci/writer.hpp"
+#endif
 
 #include "Application.hpp"
 
@@ -120,11 +122,13 @@
         writer.write(np);
     }
 
+#ifdef HAVE_ORACLE
 
     else if (hasOption("oracle"))
     {
-        LasReader reader(*ifs);
-        std::cout << "running oracle test" << std::endl;
+#ifdef HAVE_ORACLE
+        LiblasReader reader(*ifs);
+    
         const boost::uint64_t numPoints = reader.getHeader().getNumPoints();
         
         libpc::driver::oci::Options options;
@@ -135,7 +139,7 @@
         tree.put("debug", true);
         tree.put("verbose", true);
         
-        CacheFilter cache(reader);
+        CacheFilter cache(reader, 1, 1024);
         
         libpc::driver::oci::Writer writer(cache, options);
         
@@ -146,9 +150,12 @@
 
         size_t np = (size_t)numPoints;
         assert(numPoints == np); // BUG
-         writer.write(np);
+        writer.write(np);
+#else
+        throw configuration_error("libPC not compiled with Oracle support");
+#endif
     }    
-
+#endif
     else
     {
         LiblasReader reader(*ifs);
diff -r 221d3a3d6a54 -r c4371adc6197 cmake/modules/FindLibLAS.cmake
--- a/cmake/modules/FindLibLAS.cmake	Thu Mar 10 21:20:01 2011 -0600
+++ b/cmake/modules/FindLibLAS.cmake	Mon Mar 14 14:08:54 2011 -0500
@@ -46,7 +46,11 @@
   /tmp/lasjunk/include
   ${OSGEO4W_ROOT_DIR}/include)
 
-SET(LIBLAS_NAMES ${OSGEO4W_IMPORT_LIBRARY} liblas)
+if(WIN32)
+    SET(LIBLAS_NAMES ${OSGEO4W_IMPORT_LIBRARY} liblas)
+else()
+    SET(LIBLAS_NAMES ${OSGEO4W_IMPORT_LIBRARY} las)
+endif()
 
 FIND_LIBRARY(LIBLAS_LIBRARY
   NAMES ${LIBLAS_NAMES}
diff -r 221d3a3d6a54 -r c4371adc6197 include/libpc/CacheFilter.hpp
--- a/include/libpc/CacheFilter.hpp	Thu Mar 10 21:20:01 2011 -0600
+++ b/include/libpc/CacheFilter.hpp	Mon Mar 14 14:08:54 2011 -0500
@@ -40,6 +40,8 @@
 namespace libpc
 {
 
+class PointDataCache;
+
 // This is just a very simple MRU filter -- future versions will be smarter.
 // This cache has the following constraints:
 //   - only one block is cached
@@ -48,32 +50,41 @@
 class LIBPC_DLL CacheFilter : public Filter
 {
 public:
-    CacheFilter(Stage& prevStage);
+    CacheFilter(Stage& prevStage, boost::uint32_t numBlocks, boost::uint32_t blockSize);
     ~CacheFilter();
 
     const std::string& getName() const;
 
+    // override
+    void seekToPoint(boost::uint64_t index);
+
+    // clear cache (but leave cache params unchanged)
+    void resetCache();
+
+    // clear cache, and change cache params too
+    void resetCache(boost::uint32_t numBlocks, boost::uint32_t blockSize);
+
     // number of points requested from this filter via read()
     boost::uint64_t getNumPointsRequested() const;
 
     // num points this filter read from the previous stage
     boost::uint64_t getNumPointsRead() const;
 
-    // override
-    boost::uint64_t getCurrentPointIndex() const;
-
-    // override
-    void seekToPoint(boost::uint64_t index);
+    void getCacheStats(boost::uint64_t& numCacheLookupMisses,
+                       boost::uint64_t& numCacheLookupHits,
+                       boost::uint64_t& numCacheInsertMisses,
+                       boost::uint64_t& numCacheInsertHits) const;
 
 private:
     boost::uint32_t readBuffer(PointData&);
 
-    boost::uint64_t m_currentPointIndex;
-    boost::uint64_t m_storedPointIndex;
-    PointData* m_storedPointData;
     boost::uint64_t m_numPointsRequested;
     boost::uint64_t m_numPointsRead;
 
+    PointDataCache* m_cache;
+    boost::uint32_t m_maxCacheBlocks;
+    boost::uint32_t m_cacheBlockSize;
+
     CacheFilter& operator=(const CacheFilter&); // not implemented
     CacheFilter(const CacheFilter&); // not implemented
 };
diff -r 221d3a3d6a54 -r c4371adc6197 include/libpc/Dimension.hpp
--- a/include/libpc/Dimension.hpp	Thu Mar 10 21:20:01 2011 -0600
+++ b/include/libpc/Dimension.hpp	Mon Mar 14 14:08:54 2011 -0500
@@ -79,7 +79,7 @@
         Field_ScanAngleRank,
         Field_UserData,
         Field_PointSourceId,
-        Field_GpsTime,
+        Field_Time,
         Field_Red,
         Field_Green,
         Field_Blue,
diff -r 221d3a3d6a54 -r c4371adc6197 include/libpc/FauxReader.hpp
--- a/include/libpc/FauxReader.hpp	Thu Mar 10 21:20:01 2011 -0600
+++ b/include/libpc/FauxReader.hpp	Mon Mar 14 14:08:54 2011 -0500
@@ -71,7 +71,7 @@
     void seekToPoint(boost::uint64_t);
 
 private:
-    boost::uint32_t readBuffer(PointData& data);
+    boost::uint32_t readBuffer(PointData&);
 
     Mode m_mode;
 
diff -r 221d3a3d6a54 -r c4371adc6197 include/libpc/Filter.hpp
--- a/include/libpc/Filter.hpp	Thu Mar 10 21:20:01 2011 -0600
+++ b/include/libpc/Filter.hpp	Mon Mar 14 14:08:54 2011 -0500
@@ -47,19 +47,11 @@
 public:
     Filter(Stage& prevStage);
 
-    // default behaviour for filters is just to call readBegin() on the previous stage
-    virtual void readBegin(boost::uint32_t numPointsToRead);
-
-    // default behaviour for filters is just to call readEnd() on the previous stage
-    virtual void readEnd(boost::uint32_t numPointsRead);
-
+protected:
     // advance (or retreat) to the Nth point in the file (absolute, 
     // default behaviour for filters is just to call seek on the previous stage
     virtual void seekToPoint(boost::uint64_t pointNum);
 
-    // default behaviour for filters is just to call the previous stage
-    virtual boost::uint64_t getCurrentPointIndex() const;
-
 protected:
     Stage& m_prevStage;
 
diff -r 221d3a3d6a54 -r c4371adc6197 include/libpc/LasReader.hpp
--- a/include/libpc/LasReader.hpp	Thu Mar 10 21:20:01 2011 -0600
+++ b/include/libpc/LasReader.hpp	Mon Mar 14 14:08:54 2011 -0500
@@ -57,7 +57,7 @@
     const LasHeader& getLasHeader() const;
 
 protected:
-    virtual boost::uint32_t readBuffer(PointData&);
+    boost::uint32_t readBuffer(PointData&);
 
     LasHeader& getLasHeader();
     void setLasHeader(const LasHeader&);
diff -r 221d3a3d6a54 -r c4371adc6197 include/libpc/LruCache.hpp
--- a/include/libpc/LruCache.hpp	Thu Mar 10 21:20:01 2011 -0600
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,162 +0,0 @@
-/*
- * Copyright (c) 2010, Tim Day <timday at timday.com>
- *
- * Permission to use, copy, modify, and/or distribute this software for any
- * purpose with or without fee is hereby granted, provided that the above
- * copyright notice and this permission notice appear in all copies.
- *
- * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
- * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
- * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
- * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
- * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
- * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
- * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
- */
-
-// This code is from http://www.bottlenose.demon.co.uk/article/lru.htm.  It is
-// under a Internet Systems Consortium (ISC) license (an OSI-approved BSD-alike license).
-
-#ifndef INCLUDED_LIBPC_LRUCACHE_HPP
-#define INCLUDED_LIBPC_LRUCACHE_HPP
-
-
-#ifdef _MSC_VER
-#  pragma warning(push)
-#  pragma warning(disable: 4512)  // assignment operator could not be generated
-#endif
-#include <boost/bimap.hpp>
-#include <boost/bimap/list_of.hpp>
-#include <boost/bimap/set_of.hpp>
-#include <boost/function.hpp>
-#ifdef _MSC_VER
-#  pragma warning(pop)
-#endif
-
-namespace libpc
-{
-
-class PointData;
-
-
-class LruCache
-{
-public:
-
-    typedef int dummy_type;
-
-    // Bimap with key access on left view, key access
-    // history on right view, and associated value.
-    typedef boost::bimaps::bimap<
-    boost::bimaps::set_of<boost::uint32_t>,
-          boost::bimaps::list_of<dummy_type>,
-          boost::bimaps::with_info<PointData*>
-          > cache_type;
-
-    // Constuctor specifies the cached function and
-    // the maximum number of records to be stored.
-    LruCache(size_t c)
-        :_capacity(c)
-    {
-        assert(_capacity!=0);
-    }
-
-    ~LruCache()
-    {
-        for (cache_type::left_iterator it =_cache.left.begin(); it != _cache.left.end(); ++it)
-        {
-           PointData* data = it->info;
-           delete data;
-        }
-        return;
-    }
-
-    PointData* lookup(boost::uint32_t k)
-    {
-        // Attempt to find existing record
-        const cache_type::left_iterator it =_cache.left.find(k);
-
-        if (it==_cache.left.end())
-        {
-            // We don't have it:
-            return NULL;
-        }
-        else
-        {
-            // We do have it:
-            return it->info;
-        }
-    }
-
-    // Obtain value of the cached function for k
-    PointData* insert(boost::uint32_t k, PointData* v)
-    {
-        // Attempt to find existing record
-        const cache_type::left_iterator it =_cache.left.find(k);


More information about the Liblas-commits mailing list