[Liblas-commits] libpc: cleaned up source conventions
liblas-commits at liblas.org
liblas-commits at liblas.org
Fri Feb 11 13:14:01 EST 2011
details: http://hg.liblas.orglibpc/rev/77935e0f953b
changeset: 36:77935e0f953b
user: Michael P. Gerlek <mpg at flaxen.com>
date: Fri Feb 11 09:22:07 2011 -0800
description:
cleaned up source conventions
Subject: libpc: added exceptions and versioning support
details: http://hg.liblas.orglibpc/rev/6165d4718fc7
changeset: 37:6165d4718fc7
user: Michael P. Gerlek <mpg at flaxen.com>
date: Fri Feb 11 10:13:52 2011 -0800
description:
added exceptions and versioning support
diffstat:
apps/pc2pc.cpp | 15 +-
include/libpc/Bounds.hpp | 382 +++++++++++++++++++-----------------------
include/libpc/Range.hpp | 85 +++++---
include/libpc/exceptions.hpp | 126 ++++++++++++++
include/libpc/version.hpp | 87 +++++++++
src/CMakeLists.txt | 3 +
src/ColorFilter.cpp | 2 +-
src/FauxReader.cpp | 12 +-
src/version.cpp | 132 ++++++++++++++
9 files changed, 592 insertions(+), 252 deletions(-)
diffs (truncated from 1197 to 300 lines):
diff -r 8dfc2ec4ff27 -r 6165d4718fc7 apps/pc2pc.cpp
--- a/apps/pc2pc.cpp Fri Feb 11 08:28:32 2011 -0800
+++ b/apps/pc2pc.cpp Fri Feb 11 10:13:52 2011 -0800
@@ -10,6 +10,9 @@
**************************************************************************/
#include <iostream>
+#include "libpc/exceptions.hpp"
+#include "libpc/version.hpp"
+#include "libpc/version.hpp"
#include "libpc/Bounds.hpp"
using namespace libpc;
@@ -19,7 +22,17 @@
int main(int, char* [])
{
Bounds<double> bounds(1,2,3,4,5,6);
- std::cout << bounds;
+ std::cout << bounds << std::endl;
+
+ int major = LIBPC_VERSION_MAJOR;
+ int minor = LIBPC_VERSION_MINOR;
+ int patch = LIBPC_VERSION_PATCH;
+ int version = LIBPC_VERSION;
+ std::string verstring = LIBPC_VERSION_STRING;
+ std::cout << major << " " << minor << " " << patch << " (" << version << ")" << std::endl;
+
+ std::cout << " string: " << GetVersion() << std::endl;
+
return 0;
}
#if 0
diff -r 8dfc2ec4ff27 -r 6165d4718fc7 include/libpc/Bounds.hpp
--- a/include/libpc/Bounds.hpp Fri Feb 11 08:28:32 2011 -0800
+++ b/include/libpc/Bounds.hpp Fri Feb 11 10:13:52 2011 -0800
@@ -64,24 +64,22 @@
typedef typename std::vector< Range<T> > RangeVec;
private:
- RangeVec ranges;
+ RangeVec m_ranges;
public:
-
Bounds<T>()
{
- ranges.resize(0);
+ m_ranges.resize(0);
}
Bounds(Bounds const& other)
- :
- ranges(other.ranges)
+ : m_ranges(other.m_ranges)
{
}
- Bounds(RangeVec const& rngs)
+ Bounds(RangeVec const& ranges)
:
- ranges(rngs)
+ m_ranges(ranges)
{
}
@@ -92,15 +90,15 @@
T maxy,
T maxz)
{
- ranges.resize(3);
+ m_ranges.resize(3);
- ranges[0].minimum = minx;
- ranges[1].minimum = miny;
- ranges[2].minimum = minz;
+ m_ranges[0].setMinimum(minx);
+ m_ranges[1].setMinimum(miny);
+ m_ranges[2].setMinimum(minz);
- ranges[0].maximum = maxx;
- ranges[1].maximum = maxy;
- ranges[2].maximum = maxz;
+ m_ranges[0].setMaximum(maxx);
+ m_ranges[1].setMaximum(maxy);
+ m_ranges[2].setMaximum(maxz);
#ifdef DEBUG
verify();
@@ -114,13 +112,13 @@
T maxy)
{
- ranges.resize(2);
+ m_ranges.resize(2);
- ranges[0].minimum = minx;
- ranges[1].minimum = miny;
+ m_ranges[0].setMinimum(minx);
+ m_ranges[1].setMinimum(miny);
- ranges[0].maximum = maxx;
- ranges[1].maximum = maxy;
+ m_ranges[0].setMaximum(maxx);
+ m_ranges[1].setMaximum(maxy);
#ifdef DEBUG
verify();
@@ -128,26 +126,26 @@
}
-////Bounds( const Point& min, const Point& max)
-////{
-//// ranges.resize(3);
-////
-//// ranges[0].minimum = min.GetX();
-//// ranges[1].minimum = min.GetY();
-//// ranges[2].minimum = min.GetZ();
-////
-//// ranges[0].maximum = max.GetX();
-//// ranges[1].maximum = max.GetY();
-//// ranges[2].maximum = max.GetZ();
-////
-////#ifdef DEBUG
-//// verify();
-////#endif
-////}
+ ////Bounds( const Point& min, const Point& max)
+ ////{
+ //// m_ranges.resize(3);
+ ////
+ //// m_ranges[0].minimum = min.GetX();
+ //// m_ranges[1].minimum = min.GetY();
+ //// m_ranges[2].minimum = min.GetZ();
+ ////
+ //// m_ranges[0].maximum = max.GetX();
+ //// m_ranges[1].maximum = max.GetY();
+ //// m_ranges[2].maximum = max.GetZ();
+ ////
+ ////#ifdef DEBUG
+ //// verify();
+ ////#endif
+ ////}
- T (min)(std::size_t const& index) const
+ T minimum(std::size_t const& index) const
{
- if (ranges.size() <= index)
+ if (m_ranges.size() <= index)
{
// std::ostringstream msg;
// msg << "Bounds dimensions, " << ranges.size() <<", is less "
@@ -155,104 +153,70 @@
// throw std::runtime_error(msg.str());
return 0;
}
- return ranges[index].minimum;
+ return m_ranges[index].minimum();
}
- void (min)(std::size_t const& index, T v)
+ void setMinimum(std::size_t const& index, T v)
{
- if (ranges.size() <= index)
+ if (m_ranges.size() <= index)
{
- ranges.resize(index + 1);
+ m_ranges.resize(index + 1);
}
- ranges[index].minimum = v;
+ m_ranges[index].setMinimum(v);
}
- T (max)(std::size_t const& index) const
+ T maximum(std::size_t const& index) const
{
- if (ranges.size() <= index)
+ if (m_ranges.size() <= index)
{
// std::ostringstream msg;
- // msg << "Bounds dimensions, " << ranges.size() <<", is less "
+ // msg << "Bounds dimensions, " << m_ranges.size() <<", is less "
// << "than the given index, " << index;
// throw std::runtime_error(msg.str());
return 0;
}
- return ranges[index].maximum;
+ return m_ranges[index].maximum();
}
- void (max)(std::size_t const& index, T v)
+ void setMaximum(std::size_t const& index, T v)
{
- if (ranges.size() <= index)
+ if (m_ranges.size() <= index)
{
- ranges.resize(index + 1);
+ m_ranges.resize(index + 1);
}
- ranges[index].maximum = v;
+ m_ranges[index].setMaximum(v);
}
-////liblas::Point (min)() {
-//// liblas::Point p;
-//// try
-//// {
-//// p.SetCoordinates(ranges[0].minimum, ranges[1].minimum, ranges[2].minimum);
-//// }
-//// catch (std::runtime_error const& e)
-//// {
-//// ::boost::ignore_unused_variable_warning(e);
-//// p.SetCoordinates(ranges[0].minimum, ranges[1].minimum, 0);
-////
-//// }
-////
-//// return p;
-////}
-////
-////liblas::Point (max)() {
-//// liblas::Point p;
-//// try
-//// {
-//// p.SetCoordinates(ranges[0].maximum, ranges[1].maximum, ranges[2].maximum);
-//// }
-//// catch (std::runtime_error const& e)
-//// {
-//// ::boost::ignore_unused_variable_warning(e);
-//// p.SetCoordinates(ranges[0].maximum, ranges[1].maximum, 0);
-////
-//// }
-//// return p;
-////}
-
-#if 0
-// BUG: what are the semantics of these?
- T minx() const
- {
- if (ranges.size() == 0) return 0;
- return ranges[0].minimum;
- }
- T miny() const
- {
- if (ranges.size() < 2) return 0;
- return ranges[1].minimum;
- }
- T minz() const
- {
- if (ranges.size() < 3) return 0;
- return ranges[2].minimum;
- }
- T maxx() const
- {
- if (ranges.size() == 0) return 0;
- return ranges[0].maximum;
- }
- T maxy() const
- {
- if (ranges.size() < 2) return 0;
- return ranges[1].maximum;
- }
- T maxz() const
- {
- if (ranges.size() < 3) return 0;
- return ranges[2].maximum;
- }
-#endif
+ ////liblas::Point (min)() {
+ //// liblas::Point p;
+ //// try
+ //// {
+ //// p.SetCoordinates(m_ranges[0].minimum, m_ranges[1].minimum, m_ranges[2].minimum);
+ //// }
+ //// catch (std::runtime_error const& e)
+ //// {
+ //// ::boost::ignore_unused_variable_warning(e);
+ //// p.SetCoordinates(m_ranges[0].minimum, m_ranges[1].minimum, 0);
+ ////
+ //// }
+ ////
+ //// return p;
+ ////}
+ ////
+ ////liblas::Point (max)() {
+ //// liblas::Point p;
+ //// try
+ //// {
+ //// p.SetCoordinates(m_ranges[0].maximum, m_ranges[1].maximum, m_ranges[2].maximum);
+ //// }
+ //// catch (std::runtime_error const& e)
+ //// {
+ //// ::boost::ignore_unused_variable_warning(e);
+ //// p.SetCoordinates(m_ranges[0].maximum, m_ranges[1].maximum, 0);
+ ////
+ //// }
+ //// return p;
+ ////}
inline bool operator==(Bounds<T> const& rhs) const
{
More information about the Liblas-commits
mailing list