|
|
|||
File indexing completed on 2026-09-27 09:14:57
0001 // lAger: General Purpose l/A-event Generator 0002 // Copyright (C) 2016-2021 Sylvester Joosten <sjoosten@anl.gov> 0003 // 0004 // This file is part of lAger. 0005 // 0006 // lAger is free software: you can redistribute it and/or modify 0007 // it under the terms of the GNU General Public License as published by 0008 // the Free Shoftware Foundation, either version 3 of the License, or 0009 // (at your option) any later version. 0010 // 0011 // lAger is distributed in the hope that it will be useful, 0012 // but WITHOUT ANY WARRANTY; without even the implied warranty of 0013 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 0014 // GNU General Public License for more details. 0015 // 0016 // You should have received a copy of the GNU General Public License 0017 // along with lAger. If not, see <https://www.gnu.org/licenses/>. 0018 // 0019 0020 #ifndef LAGER_CORE_ASSERT_LOADED 0021 #define LAGER_CORE_ASSERT_LOADED 0022 0023 #include <lager/core/logger.hh> 0024 #include <lager/core/exception.hh> 0025 #include <string> 0026 0027 // ============================================================================= 0028 // throwing assert throws an lager::exception with verbose error message. 0029 // ============================================================================= 0030 #define tassert(condition, msg) \ 0031 if (!(condition)) { \ 0032 lager::tassert_impl(#condition, __FILE__, __LINE__, msg); \ 0033 } 0034 0035 // ============================================================================= 0036 // implementation: throwing assert 0037 // ============================================================================= 0038 namespace lager { 0039 inline void tassert_impl(const std::string& condition, 0040 const std::string& location, const int line, 0041 const std::string& msg) { 0042 LOG_ERROR(location, 0043 "l" + std::to_string(line) + ": assert(" + condition + ") failed"); 0044 throw lager::exception{msg, "assert"}; 0045 } 0046 } // ns lager 0047 0048 #endif
| [ Source navigation ] | [ Diff markup ] | [ Identifier search ] | [ general search ] |
|
This page was automatically generated by the 2.3.7 LXR engine. The LXR team |
|