#ifndef SOPHIAR2_DEBUG_MACRO_H #define SOPHIAR2_DEBUG_MACRO_H #include "core/timestamp_helper.hpp" #include #include #include #include #include #include #define FILE_LINE_TRACE {\ std::cout << fmt::format("F:{} L:{} T:{}", \ __FILE_NAME__, __LINE__, sophiar::current_timestamp()) \ << std::endl; } #define FILE_LINE_TRACE_WITH_THIS {\ std::cout << fmt::format("F:{} L:{} T:{} TH:{}", \ __FILE_NAME__, __LINE__, sophiar::current_timestamp(), (void *) this) \ << std::endl; } #define PRINT_PTR(obj) {\ std::cout << fmt::format("F:{} L:{} PTR: {}", __FILE_NAME__, __LINE__, \ (void*)std::addressof(obj)) << std::endl; } #define ENSURE(func) \ { \ bool ok = (func); \ if (!ok) return false; \ } #define CO_ENSURE(func) \ { \ bool ok = co_await (func); \ if (!ok) co_return false; \ } namespace sophiar { using boost::asio::awaitable; using boost::asio::use_awaitable; template inline awaitable coro_sleep(DurationType t) { boost::asio::high_resolution_timer timer(co_await boost::asio::this_coro::executor); timer.expires_from_now(t); co_await timer.async_wait(use_awaitable); co_return; } } #endif //SOPHIAR2_DEBUG_MACRO_H