From a5caefd001f39692038c7d2d1b98e4067f4078be Mon Sep 17 00:00:00 2001 From: Jonathan Guinet <jonathan.guinet@c-s.fr> Date: Fri, 13 May 2011 17:26:36 +0200 Subject: [PATCH] ENH: add debug output in otbParser --- Code/Common/otbParser.cxx | 17 ++++++++++++++++- Code/Common/otbParser.h | 3 ++- 2 files changed, 18 insertions(+), 2 deletions(-) diff --git a/Code/Common/otbParser.cxx b/Code/Common/otbParser.cxx index 125168d880..1c5cffa60c 100644 --- a/Code/Common/otbParser.cxx +++ b/Code/Common/otbParser.cxx @@ -18,6 +18,7 @@ #include "otbMath.h" #include "itkMacro.h" #include "otbParser.h" +#include "otbMacro.h" namespace otb { @@ -114,7 +115,7 @@ bool Parser::CheckExpr() } catch(ParserType::ExceptionType &e) { - ExceptionHandler(e); + ExceptionHandlerDebug(e); return false; } @@ -140,6 +141,20 @@ void Parser::ExceptionHandler(ParserType::ExceptionType &e) } +void Parser::ExceptionHandlerDebug(ParserType::ExceptionType &e) +{ + otbGenericMsgDebugMacro( << std::endl + << "Message: " << e.GetMsg() << std::endl + << "Formula: " << e.GetExpr() << std::endl + << "Token: " << e.GetToken() << std::endl + << "Position: " << e.GetPos() << std::endl + << std::endl); +// << "Errc: " << e.GetCode() << std::endl); +} + + + + // Get the map with the variables const std::map<std::string, Parser::ValueType*>& Parser::GetVar() const { diff --git a/Code/Common/otbParser.h b/Code/Common/otbParser.h index 640b1c8f05..da34bffbf0 100644 --- a/Code/Common/otbParser.h +++ b/Code/Common/otbParser.h @@ -83,7 +83,8 @@ public: /** Convert parser specific exception into itk exception */ virtual void ExceptionHandler(ExceptionType &e); - + /** Convert parser specific exception into itk debug macro */ + virtual void ExceptionHandlerDebug(ExceptionType &e); protected: Parser(); -- GitLab