[Liblas-commits] r1337 - in trunk: include/liblas/detail src
src/detail
liblas-commits at liblas.org
liblas-commits at liblas.org
Thu Aug 13 20:12:57 EDT 2009
Author: mloskot
Date: Thu Aug 13 20:12:55 2009
New Revision: 1337
URL: http://liblas.org/changeset/1337
Log:
Replaced UNREFERENCED_PARAM macro with self-describing template boost::ignore_unused_variable_warning (available also w/o Boost enabled). Added missing std headers and namespace qualification.
Modified:
trunk/include/liblas/detail/utility.hpp
trunk/src/detail/reader.cpp
trunk/src/detail/writer.cpp
trunk/src/lasspatialreference.cpp
trunk/src/lasvariablerecord.cpp
Modified: trunk/include/liblas/detail/utility.hpp
==============================================================================
--- trunk/include/liblas/detail/utility.hpp (original)
+++ trunk/include/liblas/detail/utility.hpp Thu Aug 13 20:12:55 2009
@@ -53,12 +53,9 @@
#include <limits>
#include <sstream>
#include <stdexcept>
-
-//
-// Private macros definition
-//
-#ifndef UNREFERENCED_PARAMETER
-#define UNREFERENCED_PARAMETER(param) ((void)param)
+// boost
+#ifdef HAVE_BOOST
+#include <boost/concept_check.hpp>
#endif
/// Defines utilities for internal use in libLAS.
@@ -66,6 +63,22 @@
/// interface of libLAS.
namespace liblas { namespace detail {
+
+// Utilities stolen from Boost and accessible for compilation
+// without Boost support (optional) enabled.
+#ifndef HAVE_BOOST
+
+template <class T>
+inline void ignore_unused_variable_warning(T const&) {}
+
+#else
+
+using boost::ignore_unused_variable_warning;
+
+#endif // HAVE_BOOST
+
+
+
/// Compile-time calculation size of array defined statically.
template <typename T, std::size_t N>
inline std::size_t static_array_size(T (&t)[N])
@@ -151,6 +164,7 @@
char description[32];
};
+
struct GeoKeysHeader
{
uint16_t keyDirectoryVersion;
@@ -345,7 +359,7 @@
else if (srtm.bad())
throw std::runtime_error("fatal I/O error occured");
#else
- UNREFERENCED_PARAMETER(srtm);
+ ignore_unused_variable_warning(srtm);
#endif
}
Modified: trunk/src/detail/reader.cpp
==============================================================================
--- trunk/src/detail/reader.cpp (original)
+++ trunk/src/detail/reader.cpp Thu Aug 13 20:12:55 2009
@@ -43,6 +43,7 @@
#include <liblas/detail/reader10.hpp>
#include <liblas/detail/reader11.hpp>
#include <liblas/detail/reader12.hpp>
+#include <liblas/detail/utility.hpp>
#include <liblas/lasheader.hpp>
#include <liblas/laspoint.hpp>
#include <liblas/lasclassification.hpp>
@@ -233,7 +234,7 @@
point.SetY(y);
point.SetZ(z);
#else
- UNREFERENCED_PARAMETER(point);
+ detail::ignore_unused_variable_warning(point);
#endif
}
Modified: trunk/src/detail/writer.cpp
==============================================================================
--- trunk/src/detail/writer.cpp (original)
+++ trunk/src/detail/writer.cpp Thu Aug 13 20:12:55 2009
@@ -43,6 +43,7 @@
#include <liblas/detail/writer10.hpp>
#include <liblas/detail/writer11.hpp>
#include <liblas/detail/writer12.hpp>
+#include <liblas/detail/utility.hpp>
#include <liblas/lasheader.hpp>
#include <liblas/laspoint.hpp>
#include <liblas/lasspatialreference.hpp>
@@ -51,12 +52,16 @@
#include <ogr_srs_api.h>
#endif
-
// std
-#include <fstream>
#include <cassert>
#include <cstdlib> // std::size_t
+#include <fstream>
+#include <iosfwd>
+#include <ostream>
+#include <sstream>
#include <stdexcept>
+#include <string>
+#include <vector>
namespace liblas { namespace detail {
@@ -212,7 +217,7 @@
p.SetY(y);
p.SetZ(z);
#else
- UNREFERENCED_PARAMETER(p);
+ detail::ignore_unused_variable_warning(p);
#endif
}
Writer* WriterFactory::Create(std::ostream& ofs, LASHeader const& header)
Modified: trunk/src/lasspatialreference.cpp
==============================================================================
--- trunk/src/lasspatialreference.cpp (original)
+++ trunk/src/lasspatialreference.cpp Thu Aug 13 20:12:55 2009
@@ -41,7 +41,10 @@
#include <liblas/lasspatialreference.hpp>
#include <liblas/detail/utility.hpp>
-#include <iostream>
+// std
+#include <stdexcept>
+#include <string>
+#include <vector>
namespace liblas
{
@@ -406,7 +409,7 @@
ResetVLRs();
#else
- UNREFERENCED_PARAMETER(v);
+ detail::ignore_unused_variable_warning(v);
throw std::runtime_error("GDAL is not available, LASSpatialReference could not be set from WKT");
#endif
}
@@ -502,7 +505,7 @@
std::free(proj4def);
}
#else
- UNREFERENCED_PARAMETER(v);
+ detail::ignore_unused_variable_warning(v);
#endif
// if we have libgeotiff but not GDAL, we'll use the
Modified: trunk/src/lasvariablerecord.cpp
==============================================================================
--- trunk/src/lasvariablerecord.cpp (original)
+++ trunk/src/lasvariablerecord.cpp Thu Aug 13 20:12:55 2009
@@ -223,7 +223,8 @@
std::streampos begin = out.tellp();
std::cout << "begin: " << begin << std::endl;
std::cout << "Dumping " << d.GetRecordLength() <<" bytes out for VLR" << "Size is : " << d.GetData().size() <<std::endl;
- for (size_t i=0;i<d.GetData().size();i++) {
+ for (std::size_t i=0;i<d.GetData().size();i++)
+ {
// out << d.GetData()[i];
}
out << &(d.GetData()[0]);
@@ -252,7 +253,7 @@
// and we don't know the orientation of the bytes - hobu
LIBLAS_SWAP_BYTES_N(buffer, length);
- for (size_t i=0; i < length; i++){
+ for (std::size_t i=0; i < length; i++){
data.push_back(buffer[i]);
}
delete buffer;
More information about the Liblas-commits
mailing list