[Liblas-commits] hg: 3 new changesets
liblas-commits at liblas.org
liblas-commits at liblas.org
Thu Aug 26 15:31:04 EDT 2010
changeset c281567a8c69 in /Volumes/Data/www/liblas.org/hg
details: http://hg.liblas.orghg?cmd=changeset;node=c281567a8c69
summary: do not #ifdef strcmp, it is bad form. Instead #ifdef to LASCopyString and use that throughout C API
changeset f3e2897e4e9a in /Volumes/Data/www/liblas.org/hg
details: http://hg.liblas.orghg?cmd=changeset;node=f3e2897e4e9a
summary: merge
changeset a9c19590b2aa in /Volumes/Data/www/liblas.org/hg
details: http://hg.liblas.orghg?cmd=changeset;node=a9c19590b2aa
summary: merge
diffstat:
CMakeLists.txt | 1 +
include/liblas/capi/las_config.h | 8 +++-
include/liblas/lasschema.hpp | 66 ++++++++++++++++++++++++++++++++++++++++
src/las_c_api.cpp | 28 ++++++++--------
4 files changed, 87 insertions(+), 16 deletions(-)
diffs (241 lines):
diff -r fecab7e80f92 -r a9c19590b2aa CMakeLists.txt
--- a/CMakeLists.txt Thu Aug 26 13:17:50 2010 -0500
+++ b/CMakeLists.txt Thu Aug 26 14:30:54 2010 -0500
@@ -77,6 +77,7 @@
if(WIN32)
if (MSVC)
if (MSVC80 OR MSVC90 OR MSVC10)
+ add_definitions(-D_CRT_SECURE_NO_DEPRECATE)
add_definitions(-D_CRT_SECURE_NO_WARNINGS)
add_definitions(-D_CRT_NONSTDC_NO_WARNING)
add_definitions(-D_SCL_SECURE_NO_WARNINGS)
diff -r fecab7e80f92 -r a9c19590b2aa include/liblas/capi/las_config.h
--- a/include/liblas/capi/las_config.h Thu Aug 26 13:17:50 2010 -0500
+++ b/include/liblas/capi/las_config.h Thu Aug 26 14:30:54 2010 -0500
@@ -84,10 +84,14 @@
# define MAX(a,b) ((a>b) ? a : b)
#endif
-#ifdef _MSC_VER
-#define strdup _strdup
+#if defined(_MSC_VER) && \
+ (_MSC_FULL_VER >= 150000000)
+#define LASCopyString _strdup
+#else
+#define LASCopyString strdup
#endif
+
#endif /* LAS_CONFIG_H_INCLUDED */
diff -r fecab7e80f92 -r a9c19590b2aa include/liblas/lasschema.hpp
--- a/include/liblas/lasschema.hpp Thu Aug 26 13:17:50 2010 -0500
+++ b/include/liblas/lasschema.hpp Thu Aug 26 14:30:54 2010 -0500
@@ -44,8 +44,11 @@
// boost
#include <boost/cstdint.hpp>
+#include <boost/any.hpp>
// std
#include <iosfwd>
+#include <limits>
+#include <string>
namespace liblas {
@@ -98,6 +101,69 @@
boost::uint16_t calculate_base_size();
};
+class Dimension
+{
+public:
+ Dimension(std::string const& name) : m_name(name) {};
+
+ std::string const& GetName() { return m_name; }
+
+ /// bits, logical size of point record
+ virtual std::size_t GetSize() const = 0;
+
+ /// bytes, physical/serialisation size of record
+ virtual std::size_t GetByteSize() const = 0;
+private:
+
+ std::string m_name;
+};
+
+template <typename T>
+class NumericDimension : public Dimension
+{
+public:
+
+ NumericDimension(T type, std::string const& name ) : Dimension(name),
+ m_max(std::numeric_limits<T>::max()),
+ m_min(std::numeric_limits<T>::min()),
+ m_type(type)
+ {
+
+ };
+
+ NumericDimension& operator=(NumericDimension const& rhs);
+ NumericDimension(Dimension const& other);
+
+ ~NumericDimension() {};
+
+
+ T const& GetMin() { return m_min; }
+ void SetMax(T const& max) { m_max = max; }
+
+ T const& GetMax() { return m_max; }
+ void SetMin(T const& min) { m_min = min; }
+
+ /// bits, logical size of point record
+ std::size_t GetSize() const
+ {
+ return sizeof(m_type) * 8;
+ }
+
+ /// bytes, physical/serialisation size of record
+ std::size_t GetByteSize() const
+ {
+ return sizeof(m_type);
+ }
+
+
+private:
+
+ T m_min;
+ T m_max;
+
+
+ T m_type;
+};
} // namespace liblas
#endif // LIBLAS_SCHEMA_HPP_INCLUDED
diff -r fecab7e80f92 -r a9c19590b2aa src/las_c_api.cpp
--- a/src/las_c_api.cpp Thu Aug 26 13:17:50 2010 -0500
+++ b/src/las_c_api.cpp Thu Aug 26 14:30:54 2010 -0500
@@ -187,7 +187,7 @@
return NULL;
else {
liblas::Error err = errors.top();
- return strdup(err.GetMessage().c_str());
+ return LASCopyString(err.GetMessage().c_str());
}
}
@@ -196,7 +196,7 @@
return NULL;
else {
liblas::Error err = errors.top();
- return strdup(err.GetMethod().c_str());
+ return LASCopyString(err.GetMethod().c_str());
}
}
@@ -839,7 +839,7 @@
VALIDATE_LAS_POINTER1(hHeader, "LASHeader_GetFileSignature", NULL);
std::string signature = ((liblas::Header*) hHeader)->GetFileSignature();
- return strdup(signature.c_str());
+ return LASCopyString(signature.c_str());
}
LAS_DLL boost::uint16_t LASHeader_GetFileSourceId(const LASHeaderH hHeader) {
@@ -873,7 +873,7 @@
VALIDATE_LAS_POINTER1(hHeader, "LASHeader_GetProjectId", 0);
liblas::guid id = ((liblas::Header*) hHeader)->GetProjectId();
- return strdup(id.to_string().c_str());
+ return LASCopyString(id.to_string().c_str());
}
LAS_DLL LASErrorEnum LASHeader_SetProjectId(LASHeaderH hHeader, const char* value) {
@@ -940,7 +940,7 @@
// caller owns it
std::string sysid = ((liblas::Header*) hHeader)->GetSystemId();
- return strdup(sysid.c_str());
+ return LASCopyString(sysid.c_str());
}
LAS_DLL LASErrorEnum LASHeader_SetSystemId(LASHeaderH hHeader, const char* value) {
@@ -962,7 +962,7 @@
// caller owns it
std::string softid = ((liblas::Header*) hHeader)->GetSoftwareId();
- return strdup(softid.c_str());
+ return LASCopyString(softid.c_str());
}
LAS_DLL LASErrorEnum LASHeader_SetSoftwareId(LASHeaderH hHeader, const char* value) {
@@ -1563,11 +1563,11 @@
}
LAS_DLL char* LAS_GetVersion() {
- return strdup(liblas::GetVersion().c_str());
+ return LASCopyString(liblas::GetVersion().c_str());
}
LAS_DLL char* LAS_GetFullVersion(void) {
- return strdup(liblas::GetFullVersion().c_str());
+ return LASCopyString(liblas::GetFullVersion().c_str());
}
@@ -1585,7 +1585,7 @@
LAS_DLL char* LASVLR_GetUserId(const LASVLRH hVLR) {
VALIDATE_LAS_POINTER1(hVLR, "LASVLR_GetUserId", 0);
liblas::VariableRecord* vlr = (liblas::VariableRecord*)hVLR;
- return strdup(vlr->GetUserId(true).c_str());
+ return LASCopyString(vlr->GetUserId(true).c_str());
}
LAS_DLL LASErrorEnum LASVLR_SetUserId(LASVLRH hVLR, const char* value) {
@@ -1605,7 +1605,7 @@
LAS_DLL char* LASVLR_GetDescription(const LASVLRH hVLR) {
VALIDATE_LAS_POINTER1(hVLR, "LASVLR_GetDescription", 0);
liblas::VariableRecord* vlr = (liblas::VariableRecord*)hVLR;
- return strdup(vlr->GetDescription(true).c_str());
+ return LASCopyString(vlr->GetDescription(true).c_str());
}
LAS_DLL LASErrorEnum LASVLR_SetDescription(LASVLRH hVLR, const char* value) {
@@ -1756,7 +1756,7 @@
LAS_DLL char* LASGuid_AsString(LASGuidH hId) {
VALIDATE_LAS_POINTER1(hId, "LASGuid_AsString", 0);
liblas::guid* id= (liblas::guid*)hId;
- return strdup(id->to_string().c_str());
+ return LASCopyString(id->to_string().c_str());
}
@@ -1908,7 +1908,7 @@
VALIDATE_LAS_POINTER1(hSRS, "LASSRS_GetProj4", NULL);
liblas::SpatialReference* srs = (liblas::SpatialReference*)hSRS;
- return strdup((srs)->GetProj4().c_str());
+ return LASCopyString((srs)->GetProj4().c_str());
}
@@ -1933,7 +1933,7 @@
VALIDATE_LAS_POINTER1(hSRS, "LASSRS_GetWKT", NULL);
liblas::SpatialReference* srs = (liblas::SpatialReference*)hSRS;
- return strdup((srs)->GetWKT(liblas::SpatialReference::eHorizontalOnly).c_str());
+ return LASCopyString((srs)->GetWKT(liblas::SpatialReference::eHorizontalOnly).c_str());
}
@@ -1942,7 +1942,7 @@
VALIDATE_LAS_POINTER1(hSRS, "LASSRS_GetWKT_CompoundOK", NULL);
liblas::SpatialReference* srs = (liblas::SpatialReference*)hSRS;
- return strdup((srs)->GetWKT(liblas::SpatialReference::eCompoundOK).c_str());
+ return LASCopyString((srs)->GetWKT(liblas::SpatialReference::eCompoundOK).c_str());
}
More information about the Liblas-commits
mailing list