MEPP2 Project
Base
Assert.h
Go to the documentation of this file.
1
// Copyright (c) 2012-2019 University of Lyon and CNRS (France).
2
// All rights reserved.
3
//
4
// This file is part of MEPP2; you can redistribute it and/or modify
5
// it under the terms of the GNU Lesser General Public License as
6
// published by the Free Software Foundation; either version 3 of
7
// the License, or (at your option) any later version.
8
//
9
// This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE
10
// WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
11
#pragma once
12
13
#include <iostream>
14
#include <boost/assert.hpp>
15
16
namespace
FEVV
{
17
38
class
Assert
39
{
40
public
:
45
Assert
() =
delete
;
46
51
Assert
(
const
Assert
&_Assert) =
delete
;
52
57
~Assert
() =
delete
;
58
70
static
bool
check
(
const
bool
_check,
71
const
std::string &_message,
72
const
std::string &_where =
""
)
73
{
74
std::string m;
75
m = (_where !=
""
) ?
"["
+ _where +
"] "
:
""
;
76
m += _message;
77
78
if
(!_check)
79
{
80
#if(defined(UNIX))
81
std::cout <<
"\033[0m\033[1m\033[31m"
;
// Bold + red color
82
#endif
83
std::cout << m;
84
#if(defined(UNIX))
85
std::cout <<
"\033[0m"
;
// reset
86
#endif
87
std::cout << std::endl;
88
}
89
90
// BOOST_ASSERT_MSG( _check, m.c_str() );
91
92
return
_check;
93
}
94
};
95
}
// namespace FEVV
FEVV::Assert
This class may be used to draw Asserts in your code.
Definition:
Assert.h:39
FEVV::Assert::Assert
Assert()=delete
FEVV
Interfaces for plugins These interfaces will be used for different plugins.
Definition:
Assert.h:16
FEVV::Assert::Assert
Assert(const Assert &_Assert)=delete
FEVV::Assert::~Assert
~Assert()=delete
FEVV::Assert::check
static bool check(const bool _check, const std::string &_message, const std::string &_where="")
Definition:
Assert.h:70
Generated by
1.8.20