23 #ifndef COM_DAFER45_TBTK_MACRO 24 #define COM_DAFER45_TBTK_MACRO 34 #define TBTK_VERSION_STRING std::to_string(TBTK_VERSION_MAJOR) + "." \ 35 + std::to_string(TBTK_VERSION_MINOR) + "." \ 36 + std::to_string(TBTK_VERSION_PATCH) 38 #define TBTK_ABOUT_STRING \ 40 "Version:\t" + TBTK_VERSION_STRING + "\n" \ 41 "Git hash:\t" TBTK_VERSION_GIT_HASH 43 inline std::string TBTK_GET_CURRENT_TIME_STRING(){
44 std::chrono::time_point<std::chrono::system_clock> timePoint
45 = std::chrono::system_clock::now();
46 std::time_t now = std::chrono::system_clock::to_time_t(timePoint);
48 return std::ctime(&now);
51 #define TBTK_RUNTIME_CONTEXT_STRING \ 52 TBTK_ABOUT_STRING + "\n" \ 53 + "Date:\t" + TBTK_GET_CURRENT_TIME_STRING() 56 #define TBTKAssert(expression, function, message, hint) ; 57 #define TBTKExceptionAssert(expression, exception); 58 #define TBTKExit(function, message, hint) exit(1); 60 #define TBTKAssert(expression, function, message, hint) \ 62 TBTK::Streams::err << "Error in " << function << "\n"; \ 63 TBTK::Streams::err << "\t" << message << "\n"; \ 64 std::stringstream hintStream; \ 66 if(std::strcmp(hintStream.str().c_str(), "") != 0) \ 67 TBTK::Streams::err << "\tHint: " << hint << "\n"; \ 68 TBTK::Streams::err << "\tWhere: " << __FILE__ << ", " << __LINE__ << "\n"; \ 69 if(TBTK::Streams::logIsOpen()) \ 70 TBTK::Streams::closeLog(); \ 74 #define TBTKExceptionAssert(expression, exception) \ 78 #define TBTKExit(function, message, hint) \ 79 TBTK::Streams::err << "Error in " << function << "\n"; \ 80 TBTK::Streams::err << "\t" << message << "\n"; \ 81 std::stringstream hintStream; \ 83 if(std::strcmp(hintStream.str().c_str(), "") != 0) \ 84 TBTK::Streams::err << "\tHint: " << hint << "\n"; \ 85 TBTK::Streams::err << "\tWhere: " << __FILE__ << ", " << __LINE__ << "\n"; \ 86 if(TBTK::Streams::logIsOpen()) \ 87 TBTK::Streams::closeLog(); \ 91 #define TBTKNotYetImplemented(function) \ 92 TBTK::Streams::err << "Error in " << function << "\n"; \ 93 TBTK::Streams::err << "\tNot yet implemented.\n"; \ 94 TBTK::Streams::err << "\tWhere: " << __FILE__ << ", " << __LINE__ << "\n"; \ 95 if(TBTK::Streams::logIsOpen()) \ 96 TBTK::Streams::closeLog(); \ 99 #define TBTKReadableCodeBlock(code) ; 101 #define TBTKWhere std::string(__FILE__) + ", " + std::to_string(__LINE__)