[Liblas-commits] hg-main-tree: make getCapacity const

liblas-commits at liblas.org liblas-commits at liblas.org
Fri Mar 18 09:53:43 EDT 2011


details:   http://hg.libpc.orghg-main-tree/rev/2a7b213bc081
changeset: 355:2a7b213bc081
user:      Howard Butler <hobu.inc at gmail.com>
date:      Thu Mar 17 14:46:20 2011 -0500
description:
make getCapacity const
Subject: hg-main-tree: some (broken) chipper work

details:   http://hg.libpc.orghg-main-tree/rev/155b08e88b32
changeset: 356:155b08e88b32
user:      Howard Butler <hobu.inc at gmail.com>
date:      Thu Mar 17 14:46:41 2011 -0500
description:
some (broken) chipper work
Subject: hg-main-tree: merge

details:   http://hg.libpc.orghg-main-tree/rev/990c53cc56c5
changeset: 357:990c53cc56c5
user:      Howard Butler <hobu.inc at gmail.com>
date:      Thu Mar 17 14:46:55 2011 -0500
description:
merge
Subject: hg-main-tree: add copy and assignment constructors to PointData

details:   http://hg.libpc.orghg-main-tree/rev/75e3b0f7c6d3
changeset: 358:75e3b0f7c6d3
user:      Howard Butler <hobu.inc at gmail.com>
date:      Fri Mar 18 08:53:06 2011 -0500
description:
add copy and assignment constructors to PointData
Subject: hg-main-tree: fix up chipper::Block constructor

details:   http://hg.libpc.orghg-main-tree/rev/9617d8b88b30
changeset: 359:9617d8b88b30
user:      Howard Butler <hobu.inc at gmail.com>
date:      Fri Mar 18 08:53:27 2011 -0500
description:
fix up chipper::Block constructor
Subject: hg-main-tree: merge

details:   http://hg.libpc.orghg-main-tree/rev/a8af49df848a
changeset: 360:a8af49df848a
user:      Howard Butler <hobu.inc at gmail.com>
date:      Fri Mar 18 08:53:33 2011 -0500
description:
merge

diffstat:

 cmake/modules/FindOracle.cmake |   1 +
 include/libpc/Chipper.hpp      |   7 ++++++-
 include/libpc/PointData.hpp    |   7 ++++---
 include/libpc/libpc_config.hpp |   5 +++++
 src/Chipper.cpp                |  12 +++++++++++-
 src/PointData.cpp              |  27 +++++++++++++++++++++++++++
 6 files changed, 54 insertions(+), 5 deletions(-)

diffs (165 lines):

diff -r a04aceb325c4 -r a8af49df848a cmake/modules/FindOracle.cmake
--- a/cmake/modules/FindOracle.cmake	Thu Mar 17 14:35:05 2011 -0500
+++ b/cmake/modules/FindOracle.cmake	Fri Mar 18 08:53:33 2011 -0500
@@ -50,6 +50,7 @@
 set(ORACLE_OCCI_NAMES libocci occi oraocci10 oraocci11)
 
 set(ORACLE_LIB_DIR 
+  ${ORACLE_HOME}
   ${ORACLE_HOME}/lib
   ${ORACLE_HOME}/OCI/lib/MSVC)
 
diff -r a04aceb325c4 -r a8af49df848a include/libpc/Chipper.hpp
--- a/include/libpc/Chipper.hpp	Thu Mar 17 14:35:05 2011 -0500
+++ b/include/libpc/Chipper.hpp	Fri Mar 18 08:53:33 2011 -0500
@@ -2,6 +2,7 @@
 #define LIBLAS_CHIPPER_H
 
 #include <libpc/Stage.hpp>
+#include <libpc/PointData.hpp>
 #include <libpc/Bounds.hpp>
 #include <libpc/export.hpp>
 #include <libpc/Dimension.hpp>
@@ -11,6 +12,8 @@
 namespace libpc
 {
 
+class Schema;
+    
 namespace chipper
 {
 
@@ -67,7 +70,7 @@
 
 class LIBPC_DLL Chipper;
 
-class LIBPC_DLL Block
+class LIBPC_DLL Block : libpc::PointData
 {
     friend class Chipper;
 
@@ -82,6 +85,8 @@
     // double m_ymax;
 
 public:
+    Block(Schema const& schema, boost::uint32_t capacity);
+    Block(Block const& block);
     std::vector<boost::uint32_t> GetIDs() const; 
     libpc::Bounds<double> const& GetBounds() const {return m_bounds;} 
     void SetBounds(libpc::Bounds<double> const& bounds) {m_bounds = bounds;}
diff -r a04aceb325c4 -r a8af49df848a include/libpc/PointData.hpp
--- a/include/libpc/PointData.hpp	Thu Mar 17 14:35:05 2011 -0500
+++ b/include/libpc/PointData.hpp	Fri Mar 18 08:53:33 2011 -0500
@@ -65,6 +65,9 @@
     // represents the state within the owning object, which in this case is a completely
     // empty buffer (similarly, all the points in the buffer are marked "invalid")
     PointData(const SchemaLayout&, boost::uint32_t capacity);
+    PointData(const PointData&); 
+    PointData& operator=(const PointData&); 
+
     ~PointData();
 
     const Bounds<double>& getSpatialBounds() const;
@@ -79,7 +82,7 @@
     
     // number of points in this buffer that have legit data; initially will be zero,
     // and after a read() call it will be in the range 0 to getNumPoints()-1
-    inline boost::uint32_t getCapacity() { return m_capacity; }
+    inline boost::uint32_t getCapacity() const { return m_capacity; }
 
     // schema (number and kinds of fields) for a point in this buffer
     const SchemaLayout& getSchemaLayout() const
@@ -116,8 +119,6 @@
     boost::uint32_t m_capacity;    
     Bounds<double> m_bounds;
 
-    PointData(const PointData&); // not implemented
-    PointData& operator=(const PointData&); // not implemented
 };
 
 
diff -r a04aceb325c4 -r a8af49df848a include/libpc/libpc_config.hpp
--- a/include/libpc/libpc_config.hpp	Thu Mar 17 14:35:05 2011 -0500
+++ b/include/libpc/libpc_config.hpp	Fri Mar 18 08:53:33 2011 -0500
@@ -41,6 +41,9 @@
  * OF SUCH DAMAGE.
  ****************************************************************************/
 
+#ifndef INCLUDED_LIBPC_CONFIG_HPP
+#define INCLUDED_LIBPC_CONFIG_HPP
+
 #include <string>
 #include <libpc/export.hpp>
 
@@ -60,3 +63,5 @@
 LIBPC_DLL int GetVersionPatch();
 
 } // namespace libpc
+
+#endif
diff -r a04aceb325c4 -r a8af49df848a src/Chipper.cpp
--- a/src/Chipper.cpp	Thu Mar 17 14:35:05 2011 -0500
+++ b/src/Chipper.cpp	Fri Mar 18 08:53:33 2011 -0500
@@ -79,6 +79,16 @@
 
 namespace libpc { namespace chipper {
 
+Block::Block(Schema const& schema, boost::uint32_t capacity)
+ : PointData(schema, capacity)
+{
+    
+}
+Block::Block(Block const& block)
+ : PointData(block.getSchema(), block.getCapacity())
+{
+    
+}
 vector<boost::uint32_t> Block::GetIDs() const
 {
     vector<boost::uint32_t> ids;
@@ -360,7 +370,7 @@
 void Chipper::Emit(RefList& wide, boost::uint32_t widemin, boost::uint32_t widemax,
     RefList& narrow, boost::uint32_t narrowmin, boost::uint32_t narrowmax )
 {
-    Block b;
+    Block b(m_stage.getHeader().getSchema(), m_threshold);
 
     b.m_list_p = &wide;
     if (wide.m_dir == DIR_X) { 
diff -r a04aceb325c4 -r a8af49df848a src/PointData.cpp
--- a/src/PointData.cpp	Thu Mar 17 14:35:05 2011 -0500
+++ b/src/PointData.cpp	Fri Mar 18 08:53:33 2011 -0500
@@ -57,6 +57,33 @@
     return;
 }
 
+PointData::PointData(PointData const& other) 
+    : m_schemaLayout(other.getSchemaLayout())
+    , m_data(0)
+    , m_pointSize(m_schemaLayout.getByteSize())
+    , m_numPoints(other.m_numPoints)
+    , m_capacity(other.m_capacity)
+    , m_bounds(other.m_bounds)
+{
+    m_data = new boost::uint8_t[m_pointSize * m_capacity];
+    
+    memcpy(m_data, other.m_data, m_pointSize*m_capacity);
+
+}
+
+PointData& PointData::operator=(PointData const& rhs)
+{
+    if (&rhs != this)
+    {
+        m_schemaLayout = rhs.getSchemaLayout();
+        m_data = new boost::uint8_t[m_schemaLayout.getByteSize() * rhs.getCapacity()];
+        m_pointSize = m_schemaLayout.getByteSize();
+        m_numPoints = rhs.getNumPoints();
+        m_capacity = rhs.getCapacity();
+        m_bounds = rhs.getSpatialBounds();
+    }
+    return *this;
+}
 
 PointData::~PointData()
 {


More information about the Liblas-commits mailing list