LSSTApplications  18.1.0
LSSTDataManagementBasePackage
Macros
asserts.h File Reference
#include "boost/format.hpp"
#include "lsst/pex/exceptions/Exception.h"

Go to the source code of this file.

Macros

#define LSST_THROW_IF_NE(N1, N2, EXC_CLASS, MSG)   if ((N1) != (N2)) throw LSST_EXCEPT(EXC_CLASS, (boost::format(MSG) % (N1) % (N2)).str())
 Check whether the given values are equal, and throw an LSST Exception if they are not. More...
 

Macro Definition Documentation

◆ LSST_THROW_IF_NE

#define LSST_THROW_IF_NE (   N1,
  N2,
  EXC_CLASS,
  MSG 
)    if ((N1) != (N2)) throw LSST_EXCEPT(EXC_CLASS, (boost::format(MSG) % (N1) % (N2)).str())

Check whether the given values are equal, and throw an LSST Exception if they are not.

The given message must include two Boost.Format placeholders for the two numbers.

For example:

LSST_THROW_IF_NE(3, 4, LengthError, "size of foo (%d) is not equal to size of bar (%d)");

Definition at line 38 of file asserts.h.