Program Listing for File fang_assert.hpp¶
↰ Return to documentation for file (fang-mcb-project/src/system/assert/fang_assert.hpp)
#ifndef FANG_ROBOTICS_MCB_WRAP_TRAP_SYSTEM_FANG_ASSERT_HPP
#define FANG_ROBOTICS_MCB_WRAP_TRAP_SYSTEM_FANG_ASSERT_HPP
#include "modm/architecture/interface/assert.hpp"
#include <string>
#include <cassert>
#ifndef NDEBUG
#ifndef PLATFORM_HOSTED
#define FANG_ASSERT(CONDITION, DESC) \
{ \
const std::string FANG_ASSERT_FILE{__FILE__}; \
const std::string FANG_ASSERT_LINE{"Line " + std::to_string(__LINE__)}; \
const std::string DESCRIPTION \
{ \
FANG_ASSERT_FILE + \
" : " + FANG_ASSERT_LINE + \
" : " + DESC \
}; \
modm_assert(CONDITION, "Danger! Danger!", DESCRIPTION.c_str()); \
}
#else
#define FANG_ASSERT(CONDITION, DESC) \
{ \
assert(CONDITION && DESC); \
}
#endif
#endif
#endif