refactored the new floorplan
new helper methods/operator toe geo classes
This commit is contained in:
20
Assertions.h
20
Assertions.h
@@ -13,45 +13,47 @@
|
||||
namespace Assert {
|
||||
|
||||
|
||||
static inline void doThrow(const char* err) {
|
||||
template <typename STR> static inline void doThrow(const STR err) {
|
||||
#ifdef WITH_ASSERTIONS
|
||||
std::string str = "in: ";
|
||||
str += __PRETTY_FUNCTION__;
|
||||
str += " error: ";
|
||||
str += err;
|
||||
throw Exception(err);
|
||||
#else
|
||||
(void) err;
|
||||
#endif
|
||||
}
|
||||
|
||||
template <typename T> static inline void equal(const T v1, const T v2, const char* err) {
|
||||
template <typename T, typename STR> static inline void equal(const T v1, const T v2, const STR err) {
|
||||
if (v1 != v2) {doThrow(err);}
|
||||
}
|
||||
|
||||
template <typename T> static inline void isTrue(const T v, const char* err) {
|
||||
template <typename T, typename STR> static inline void isTrue(const T v, const STR err) {
|
||||
if (!v) {doThrow(err);}
|
||||
}
|
||||
|
||||
template <typename T> static inline void isFalse(const T v, const char* err) {
|
||||
template <typename T, typename STR> static inline void isFalse(const T v, const STR err) {
|
||||
if (v) {doThrow(err);}
|
||||
}
|
||||
|
||||
template <typename T> static inline void isNull(const T v, const char* err) {
|
||||
template <typename T, typename STR> static inline void isNull(const T v, const STR err) {
|
||||
if (v != nullptr) {doThrow(err);}
|
||||
}
|
||||
|
||||
template <typename T> static inline void isNotNull(const T v, const char* err) {
|
||||
template <typename T, typename STR> static inline void isNotNull(const T v, const STR err) {
|
||||
if (v == nullptr) {doThrow(err);}
|
||||
}
|
||||
|
||||
template <typename T> static inline void isNotNaN(const T v, const char* err) {
|
||||
template <typename T, typename STR> static inline void isNotNaN(const T v, const STR err) {
|
||||
if (v != v) {doThrow(err);}
|
||||
}
|
||||
|
||||
template <typename T> static inline void isNot0(const T v, const char* err) {
|
||||
template <typename T, typename STR> static inline void isNot0(const T v, const STR err) {
|
||||
if (v == 0) {doThrow(err);}
|
||||
}
|
||||
|
||||
template <typename T> static inline void isBetween(const T v, const T min, const T max, const char* err) {
|
||||
template <typename T, typename STR> static inline void isBetween(const T v, const T min, const T max, const STR err) {
|
||||
if (v < min || v > max) {doThrow(err);}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user