Vowpal Wabbit
Loading...
Searching...
No Matches
Macros
vw_throw.h File Reference
#include "vw/common/vw_exception.h"
#include <sstream>

Macros

#define VW_EXPAND(x)   x
 
#define VW_GET_MACRO(_1, _2, NAME, ...)   NAME
 
#define THROW_OR_RETURN(...)    VW_EXPAND(VW_GET_MACRO(__VA_ARGS__, THROW_OR_RETURN_NORMAL, THROW_OR_RETURN_VOID, UNUSED)(__VA_ARGS__))
 
#define THROW(args)
 
#define THROW_EX(ex, args)
 
#define VW_ASSERT(condition, args)    if (!(condition)) { THROW(args); }
 
#define THROW_OR_RETURN_NORMAL(args, retval)
 
#define THROW_OR_RETURN_VOID(args)
 

Macro Definition Documentation

◆ THROW

#define THROW (   args)
Value:
{ \
std::ostringstream __msg; \
__msg << args; \
throw VW::vw_exception(VW_FILENAME, VW_LINE, __msg.str()); \
}
Definition: vw_exception.h:33
#define VW_LINE
Definition: vw_exception.h:28
#define VW_FILENAME
Definition: vw_exception.h:25

◆ THROW_EX

#define THROW_EX (   ex,
  args 
)
Value:
{ \
std::ostringstream __msg; \
__msg << args; \
throw ex(VW_FILENAME, VW_LINE, __msg.str()); \
}

◆ THROW_OR_RETURN

#define THROW_OR_RETURN (   ...)     VW_EXPAND(VW_GET_MACRO(__VA_ARGS__, THROW_OR_RETURN_NORMAL, THROW_OR_RETURN_VOID, UNUSED)(__VA_ARGS__))

◆ THROW_OR_RETURN_NORMAL

#define THROW_OR_RETURN_NORMAL (   args,
  retval 
)
Value:
do { \
std::ostringstream __msgA; \
__msgA << args; \
throw VW::vw_exception(VW_FILENAME, VW_LINE, __msgA.str()); \
} while (0)

◆ THROW_OR_RETURN_VOID

#define THROW_OR_RETURN_VOID (   args)
Value:
do { \
std::ostringstream __msgB; \
__msgB << args; \
throw VW::vw_exception(VW_FILENAME, VW_LINE, __msgB.str()); \
} while (0)

◆ VW_ASSERT

#define VW_ASSERT (   condition,
  args 
)     if (!(condition)) { THROW(args); }

◆ VW_EXPAND

#define VW_EXPAND (   x)    x

◆ VW_GET_MACRO

#define VW_GET_MACRO (   _1,
  _2,
  NAME,
  ... 
)    NAME