GPRidge v1.0.0
GPR-accelerated saddle point searches on potential energy surfaces
☾
Toggle main menu visibility
Loading...
Searching...
No Matches
ErrorManager.h
Go to the documentation of this file.
1
// SPDX-License-Identifier: MIT
2
// Copyright (c) gpridge developers
3
// See LICENSE for details.
4
5
/*
6
* ErrorManager.h
7
*
8
* Created on: 17 Jun 2020
9
* Author: Maxim Masterov
10
* Company: SURFSara
11
*/
12
13
#ifndef MANAGERS_IO_ERRORMANAGER_H_
14
#define MANAGERS_IO_ERRORMANAGER_H_
15
16
#include <cstdlib>
17
#include <iostream>
18
#include <string>
19
20
namespace
gpr
{
21
namespace
io
{
22
26
class
ErrorManager
{
27
public
:
28
ErrorManager
() { }
29
~ErrorManager
() { }
30
36
template
<
typename
T>
37
inline
ErrorManager
&
operator<<
(
const
T& data)
38
{
39
// NOTE: logs to stderr; file logging uses LogManager
40
std::cerr << data;
41
return
*
this
;
42
}
43
52
inline
static
void
assertMsg
(
const
bool
expression,
53
const
std::string& message,
const
char
* file,
54
const
char
* func,
const
int
line)
55
{
56
if
(!expression) {
57
std::cerr <<
"[ "
<< file <<
"]::"
<< func <<
"::"
<< line <<
" "
58
<< message <<
"\n"
;
59
exit(1);
60
}
61
}
62
};
63
64
}
/* namespace io */
65
}
/* namespace gpr */
66
67
#define assertMsg(expression, msg) \
68
io::ErrorManager::assertMsg(expression, msg, __FILE__, __FUNCTION__, \
69
__LINE__)
70
71
#endif
/* MANAGERS_IO_ERRORMANAGER_H_ */
gpr::io::ErrorManager::ErrorManager
ErrorManager()
Definition
ErrorManager.h:28
gpr::io::ErrorManager::~ErrorManager
~ErrorManager()
Definition
ErrorManager.h:29
gpr::io::ErrorManager::operator<<
ErrorManager & operator<<(const T &data)
Writes data to the log.
Definition
ErrorManager.h:37
gpr::io::ErrorManager::assertMsg
static void assertMsg(const bool expression, const std::string &message, const char *file, const char *func, const int line)
Prints error message and terminates the program.
Definition
ErrorManager.h:52
gpr::io
Definition
SeededSearch.h:8
gpr
Gaussian-process regression, kernels, priors, and the searches that run on the surrogate.
Definition
Macros.h:16
managers
io
ErrorManager.h
Generated by
1.17.0
Generated by
Doxygen 1.17.0
Analytics by
Antics
provided by
TurtleTech ehf