[Liblas-commits] libpc: move *Layout classes into separate files

liblas-commits at liblas.org liblas-commits at liblas.org
Tue Mar 1 16:52:01 EST 2011


details:   http://hg.liblas.orglibpc/rev/3bb36d53330d
changeset: 146:3bb36d53330d
user:      Michael P. Gerlek <mpg at flaxen.com>
date:      Tue Mar 01 13:51:51 2011 -0800
description:
move *Layout classes into separate files

diffstat:

 include/libpc/Dimension.hpp       |   49 ----------
 include/libpc/DimensionLayout.hpp |  106 ++++++++++++++++++++++
 include/libpc/PointData.hpp       |    2 +-
 include/libpc/Schema.hpp          |   48 ---------
 include/libpc/SchemaLayout.hpp    |  105 +++++++++++++++++++++
 src/CMakeLists.txt                |    4 +
 src/Dimension.cpp                 |   75 ---------------
 src/DimensionLayout.cpp           |  128 ++++++++++++++++++++++++++
 src/Schema.cpp                    |  129 --------------------------
 src/SchemaLayout.cpp              |  183 ++++++++++++++++++++++++++++++++++++++
 test/unit/CMakeLists.txt          |    2 +
 test/unit/DimensionLayoutTest.cpp |   64 +++++++++++++
 test/unit/DimensionTest.cpp       |   21 ----
 test/unit/SchemaLayoutTest.cpp    |   97 ++++++++++++++++++++
 test/unit/SchemaTest.cpp          |   53 -----------
 15 files changed, 690 insertions(+), 376 deletions(-)

diffs (truncated from 1202 to 300 lines):

diff -r 4083a8ad908e -r 3bb36d53330d include/libpc/Dimension.hpp
--- a/include/libpc/Dimension.hpp	Tue Mar 01 13:40:24 2011 -0800
+++ b/include/libpc/Dimension.hpp	Tue Mar 01 13:51:51 2011 -0800
@@ -266,55 +266,6 @@
 };
 
 
-class LIBPC_DLL DimensionLayout
-{
-public:
-    DimensionLayout(const Dimension&);
-    DimensionLayout& operator=(DimensionLayout const& rhs);
-    DimensionLayout(DimensionLayout const& other);
-
-    bool operator==(const DimensionLayout& other) const;
-    bool operator!=(const DimensionLayout& other) const;
-
-    const Dimension& getDimension() const
-    {
-        return m_dimension;
-    }
-
-    /// The byte location to start reading/writing
-    /// point data from in a composited schema.  liblas::Schema
-    /// will set these values for you when liblas::Dimension are
-    /// added to the liblas::Schema.
-    inline std::size_t getByteOffset() const
-    {
-        return m_byteOffset;
-    }
-
-    inline void setByteOffset(std::size_t v)
-    {
-        m_byteOffset = v;
-    }
-
-    /// The index position of the index.  In a standard ePointFormat0
-    /// data record, the X dimension would have a position of 0, while
-    /// the Y dimension would have a position of 1, for example.
-    inline std::size_t getPosition() const
-    {
-        return m_position;
-    }
-
-    inline void setPosition(std::size_t v)
-    {
-        m_position = v;
-    }
-
-private:
-    Dimension m_dimension;
-    std::size_t m_byteOffset;
-    std::size_t m_position;
-};
-
-
 LIBPC_DLL std::ostream& operator<<(std::ostream& os, libpc::Dimension const& d);
 
 
diff -r 4083a8ad908e -r 3bb36d53330d include/libpc/DimensionLayout.hpp
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/include/libpc/DimensionLayout.hpp	Tue Mar 01 13:51:51 2011 -0800
@@ -0,0 +1,106 @@
+/******************************************************************************
+ * $Id$
+ *
+ * Project:  libLAS - http://liblas.org - A BSD library for LAS format data.
+ * Purpose:  LAS Dimension implementation for C++ libLAS
+ * Author:   Howard Butler, hobu.inc at gmail.com
+ *
+ ******************************************************************************
+ * Copyright (c) 2010, Howard Butler
+ *
+ * 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 the Martin Isenburg or Iowa Department
+ *       of Natural Resources 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 LIBPC_DIMENSIONLAYOUT_HPP_INCLUDED
+#define LIBPC_DIMENSIONLAYOUT_HPP_INCLUDED
+
+#include <libpc/Dimension.hpp>
+
+
+namespace libpc
+{
+
+
+class LIBPC_DLL DimensionLayout
+{
+public:
+    DimensionLayout(const Dimension&);
+    DimensionLayout& operator=(DimensionLayout const& rhs);
+    DimensionLayout(DimensionLayout const& other);
+
+    bool operator==(const DimensionLayout& other) const;
+    bool operator!=(const DimensionLayout& other) const;
+
+    const Dimension& getDimension() const
+    {
+        return m_dimension;
+    }
+
+    /// The byte location to start reading/writing
+    /// point data from in a composited schema.  liblas::Schema
+    /// will set these values for you when liblas::Dimension are
+    /// added to the liblas::Schema.
+    inline std::size_t getByteOffset() const
+    {
+        return m_byteOffset;
+    }
+
+    inline void setByteOffset(std::size_t v)
+    {
+        m_byteOffset = v;
+    }
+
+    /// The index position of the index.  In a standard ePointFormat0
+    /// data record, the X dimension would have a position of 0, while
+    /// the Y dimension would have a position of 1, for example.
+    inline std::size_t getPosition() const
+    {
+        return m_position;
+    }
+
+    inline void setPosition(std::size_t v)
+    {
+        m_position = v;
+    }
+
+private:
+    Dimension m_dimension;
+    std::size_t m_byteOffset;
+    std::size_t m_position;
+};
+
+
+LIBPC_DLL std::ostream& operator<<(std::ostream& os, libpc::DimensionLayout const& d);
+
+
+} // namespace libpc
+
+#endif // LIBPC_DIMENSIONLAYOUT_HPP_INCLUDED
diff -r 4083a8ad908e -r 3bb36d53330d include/libpc/PointData.hpp
--- a/include/libpc/PointData.hpp	Tue Mar 01 13:40:24 2011 -0800
+++ b/include/libpc/PointData.hpp	Tue Mar 01 13:51:51 2011 -0800
@@ -38,7 +38,7 @@
 #include <boost/cstdint.hpp>
 
 #include "libpc/export.hpp"
-#include "libpc/Schema.hpp"
+#include "libpc/SchemaLayout.hpp"
 
 namespace libpc
 {
diff -r 4083a8ad908e -r 3bb36d53330d include/libpc/Schema.hpp
--- a/include/libpc/Schema.hpp	Tue Mar 01 13:40:24 2011 -0800
+++ b/include/libpc/Schema.hpp	Tue Mar 01 13:51:51 2011 -0800
@@ -115,55 +115,7 @@
 };
 
 
-class LIBPC_DLL SchemaLayout
-{
-public:
-    typedef std::vector<DimensionLayout> DimensionLayouts;
-    typedef std::vector<DimensionLayout>::iterator DimensionLayoutsIter;
-    typedef std::vector<DimensionLayout>::const_iterator DimensionLayoutsCIter;
-
-    SchemaLayout(const Schema&);
-    SchemaLayout(SchemaLayout const& other);
-
-    SchemaLayout& operator=(SchemaLayout const& rhs);
-
-    bool operator==(const SchemaLayout& other) const;
-    bool operator!=(const SchemaLayout& other) const;
-
-    const Schema& getSchema() const 
-    {
-      return m_schema;
-    }
-
-    /// Fetch total byte size -- sum of all dimensions
-    std::size_t getByteSize() const;
-
-    void calculateSizes();
-
-    const DimensionLayout& getDimensionLayout(std::size_t index) const
-    {
-        return m_dimensionLayouts[index];
-    }
-
-    DimensionLayout& getDimensionLayout(std::size_t index)
-    {
-        return m_dimensionLayouts[index];
-    }
-
-    const std::vector<DimensionLayout>& getDimensionLayouts() const
-    {
-        return m_dimensionLayouts;
-    }
-
-private:
-    Schema m_schema;
-    std::vector<DimensionLayout> m_dimensionLayouts;
-    std::size_t m_byteSize;
-};
-
-
 LIBPC_DLL std::ostream& operator<<(std::ostream& os, Schema const&);
-LIBPC_DLL std::ostream& operator<<(std::ostream& os, SchemaLayout const&);
 
 
 } // namespace liblas
diff -r 4083a8ad908e -r 3bb36d53330d include/libpc/SchemaLayout.hpp
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/include/libpc/SchemaLayout.hpp	Tue Mar 01 13:51:51 2011 -0800
@@ -0,0 +1,105 @@
+/******************************************************************************
+ * $Id$
+ *
+ * Project:  libLAS - http://liblas.org - A BSD library for LAS format data.
+ * Purpose:  LAS Schema implementation for C++ libLAS
+ * Author:   Howard Butler, hobu.inc at gmail.com
+ *
+ ******************************************************************************
+ * Copyright (c) 2010, Howard Butler
+ *
+ * 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 the Martin Isenburg or Iowa Department
+ *       of Natural Resources 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 LIBPC_SCHEMALAYOUT_HPP_INCLUDED
+#define LIBPC_SCHEMALAYOUT_HPP_INCLUDED
+
+#include "libpc/Schema.hpp"
+#include "libpc/DimensionLayout.hpp"
+
+
+namespace libpc
+{
+
+
+class LIBPC_DLL SchemaLayout
+{
+public:
+    typedef std::vector<DimensionLayout> DimensionLayouts;


More information about the Liblas-commits mailing list