Debian Codegraph @

py/ymport/foamfile/VerifyMacros.cpp

raw
1 /*************************************************************************
2 * 2022 Tóth János *
3 * *
4 * This program is free software; it is licensed under the terms of the *
5 * GNU General Public License v2 or later. See file LICENSE for details. *
6 *************************************************************************/
7
8 #include "VerifyMacros.hpp"
9
10 #include <boost/filesystem.hpp>
11 #include <stdexcept>
12
13 namespace yade {
14 namespace ymport {
15 namespace foamfile {
16
17 void _verify(bool cond, const char* file, int line, const char* msg)
18 {
19 if (cond == false) {
20 boost::filesystem::path p(file);
21
22 std::string message = p.filename().string() + ":" + std::to_string(line) + ": " + std::string(msg);
23 throw std::runtime_error(message);
24 }
25 }
26
27 } // namespace foamfile
28 } // namespace ymport
29 } // namespace yade