36 #ifndef SMART_ASSERT_H 37 #define SMART_ASSERT_H 88 void addValue (
const std::string& val,
const std::string& str)
90 M_values.push_back ( valueAndString_Type ( val, str) );
127 const std::string&
file()
const 204 bool is (
const T&)
const 213 bool is (
char*
const& val)
222 bool is (
const char*
const& val)
248 M_context.setExpression ( expr);
250 if ( ( logger() == 0) || handlers().size() < 4)
277 template<
class type>
280 std::ostringstream out;
283 bool bIsNull = f.is ( val);
293 M_context.addValue ( out.str(), msg);
333 return level ( lvl_error, strMsg.c_str() );
346 static void setLog (
const char* strFileName)
360 static void setLog ( assertFunction_Type log)
365 static void setHandler (
int nLevel, assertFunction_Type handler)
367 handlers() [ nLevel] = handler;
397 static assertFunction_Type inst;
409 static assertFunction_Type
handler (
int nLevel)
411 handlerCollection_Type::const_iterator found = handlers().find ( nLevel);
412 if ( found != handlers().end() )
414 return found->second;
419 return handlers().find ( lvl_debug)->second;
439 #ifdef LIFEV_SMART_ASSERT_DEBUG_MODE 441 #if LIFEV_SMART_ASSERT_DEBUG_MODE == 1
442 #define LIFEV_SMART_ASSERT_DEBUG 444 #undef LIFEV_SMART_ASSERT_DEBUG 450 #ifdef HAVE_LIFEV_DEBUG 451 #define LIFEV_SMART_ASSERT_DEBUG 453 #undef LIFEV_SMART_ASSERT_DEBUG 459 #ifdef LIFEV_SMART_ASSERT_DEBUG 461 #define LIFEV_SMART_ASSERT( expr) 463 else ::LifeV::SmartAssert::makeAssert( #expr).printContext( __FILE__, __LINE__).SMART_ASSERT_A 468 #define LIFEV_SMART_ASSERT( expr) 479 #define LIFEV_SMART_VERIFY( expr) 481 else ::LifeV::SmartAssert::makeAssert( #expr).error().printContext( __FILE__, __LINE__).SMART_ASSERT_A 489 #define LIFEV_SMART_ASSERT_OP(x, next) const int & level() const
void setFileLine(const char *file, int line)
static void setLog(assertFunction_Type log)
void setDefaultLogName(const char *str)
static handlerCollection_Type & handlers()
void defaultFatalHandler(const AssertContext &context)
void defaultLogger(const AssertContext &context)
Assert & fatal(const char *strMsg=0)
Assert & warn(const char *strMsg=0)
Assert & printContext(const char *file, int line)
static assertFunction_Type handler(int nLevel)
Assert & debug(const char *strMsg=0)
#define LIFEV_SMART_ASSERT_OP(x, next)
static void setLog(std::ostream &out)
inline ::LifeV::Assert makeAssert(const char *expr)
Assert & level(int nLevel, const char *strMsg=0)
std::pair< std::string, std::string > valueAndString_Type
#define LIFEV_SMART_VERIFY(expr)
static assertFunction_Type & logger()
void setLevel(int nLevel)
void dumpContextSummary(const AssertContext &context, std::ostream &out)
void updateInverseJacobian(const UInt &iQuadPt)
void setLevelMsg(const char *strMsg)
void defaultWarnHandler(const AssertContext &context)
void defaultDebugHandler(const AssertContext &context)
const std::string & file() const
const valueArray_Type & values() const
Assert & error(const std::string strMsg)
static void setHandler(int nLevel, assertFunction_Type handler)
Assert & msg(const char *strMsg)
const std::string & expression() const
contains details about a failed assertion
void setExpression(const std::string &str)
void setDefaultLogStream(std::ostream &out)
void(* assertFunction_Type)(const AssertContext &context)
std::vector< valueAndString_Type > valueArray_Type
void defaultErrorHandler(const AssertContext &context)
static void setLog(const char *strFileName)
Assert & printCurrentValue(const type &val, const char *msg)
void dumpContextDetail(const AssertContext &context, std::ostream &out)
const std::string & message() const
Assert & error(const char *strMsg=0)
void addValue(const std::string &val, const std::string &str)
bool is(const char *const &val)
Assert(const Assert &other)
#define SMART_ASSERT_A(x)
std::map< int, assertFunction_Type > handlerCollection_Type
bool is(char *const &val)
std::string getTypeofLevel(int nLevel)
#define LIFEV_SMART_ASSERT(expr)