Skip to content

Commit

Permalink
GEOS error and debug handling
Browse files Browse the repository at this point in the history
  • Loading branch information
hobu committed Jan 25, 2016
1 parent 431a90e commit b0eeed2
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 20 deletions.
4 changes: 2 additions & 2 deletions include/pdal/GEOSUtils.hpp
Expand Up @@ -83,7 +83,7 @@ class PDAL_DLL ErrorHandler
char buf[1024];

vsnprintf(buf, sizeof(buf), message, args);
std::cout << "GEOS error: " << buf << std::endl;
std::cerr<< "GEOS error: " << buf << std::endl;

va_end(args);

Expand All @@ -110,7 +110,7 @@ class PDAL_DLL ErrorHandler
char buf[1024];

vsnprintf(buf, sizeof(buf), message, args);
std::cout << "GEOS notice: " << buf << std::endl;
std::cerr<< "GEOS notice: " << buf << std::endl;

va_end(args);

Expand Down
5 changes: 3 additions & 2 deletions src/CMakeLists.txt
Expand Up @@ -201,7 +201,7 @@ endif()
# Targets installation

#
# On Linux, we install a linker script as libpdalcpp.so. That file
# On Lixxxxxxxxxxxxxxxxxxnux, we install a linker script as libpdalcpp.so. That file
# specifies linking in libpdal_base.so and libpdal_util.so. This allows
# users to link a single library, libpdalcpp
#
Expand All @@ -213,4 +213,5 @@ endif()

install(DIRECTORY "${PDAL_HEADERS_DIR}/"
DESTINATION "${PDAL_INCLUDE_INSTALL_DIR}"
FILES_MATCHING PATTERN "*.h" PATTERN "*.hpp")
PATTERN "/CMakeFiles/*" EXCLUDE
)
23 changes: 7 additions & 16 deletions src/GEOSUtils.cpp
Expand Up @@ -67,13 +67,13 @@ ErrorHandler::ErrorHandler(bool isDebug, LogPtr log)
#endif

#ifdef GEOSContext_setErrorMessageHandler_r
GEOSContext_setErrorMessageHandler_r(ctx, &ErrorHandler::error_trampoline, &this);
GEOSContext_setErrorMessageHandler_r(ctx, &ErrorHandler::error_trampoline, this);
#else
GEOSContext_setErrorHandler_r(ctx, &ErrorHandler::error_trampoline);
#endif

#ifdef GEOSContext_setNoticeHandler_r
GEOSContext_setNoticeHandler_r(ctx, &ErrorHandler::notice_trampoline, &this);
GEOSContext_setNoticeHandler_r(ctx, &ErrorHandler::notice_trampoline, this);
#else
GEOSContext_setErrorHandler_r(ctx, &ErrorHandler::notice_trampoline);
#endif
Expand All @@ -82,26 +82,17 @@ ErrorHandler::ErrorHandler(bool isDebug, LogPtr log)
void ErrorHandler::log(char const* msg)
{
std::ostringstream oss;

// if (code == CE_Failure || code == CE_Fatal)
// error(code, num, msg);
// else if (code == CE_Debug)
// {
// oss << "GDAL debug: " << msg;
// if (m_log)
// m_log->get(LogLevel::Debug) << oss.str() << std::endl;
// }
oss << "GEOS debug: " << msg;
if (m_log)
m_log->get(LogLevel::Debug) << oss.str() << std::endl;
}


void ErrorHandler::error(char const* msg)
{
std::ostringstream oss;
// if (code == CE_Failure || code == CE_Fatal)
// {
// oss << "GDAL Failure number = " << num << ": " << msg;
// throw pdal_error(oss.str());
// }
oss << "GEOS failure: '" << msg <<"'";
throw pdal_error(oss.str());
}


Expand Down

0 comments on commit b0eeed2

Please sign in to comment.