Crocoddyl
Loading...
Searching...
No Matches
exception.hpp
1
2
// BSD 3-Clause License
3
//
4
// Copyright (C) 2019-2023, University of Edinburgh, LAAS-CNRS,
5
// Heriot-Watt University
6
// Copyright note valid unless otherwise stated in individual files.
7
// All rights reserved.
9
10
#ifndef CROCODDYL_CORE_UTILS_EXCEPTION_HPP_
11
#define CROCODDYL_CORE_UTILS_EXCEPTION_HPP_
12
13
#include <exception>
14
#include <sstream>
15
16
#define NOEXCEPT noexcept
17
18
#define throw_pretty(m) \
19
{ \
20
std::stringstream ss; \
21
ss << m; \
22
throw crocoddyl::Exception(ss.str(), __FILE__, __PRETTY_FUNCTION__, \
23
__LINE__); \
24
}
25
26
#ifndef NDEBUG
27
#define assert_pretty(condition, m) \
28
if (!(condition)) { \
29
std::stringstream ss; \
30
ss << m; \
31
throw crocoddyl::Exception(ss.str(), __FILE__, __PRETTY_FUNCTION__, \
32
__LINE__); \
33
}
34
#else
35
#define assert_pretty(condition, m) ((void)0)
36
#endif
37
namespace
crocoddyl {
38
39
class
Exception
:
public
std::exception {
40
public
:
41
explicit
Exception
(
const
std::string &msg,
const
char
*file,
const
char
*func,
42
int
line);
43
virtual
~Exception
() NOEXCEPT;
44
virtual
const
char
*what()
const
NOEXCEPT;
45
46
std::string getMessage()
const
;
47
std::string getExtraData()
const
;
48
49
private
:
50
std::string exception_msg_;
51
std::string extra_data_;
52
std::string msg_;
53
};
54
55
}
// namespace crocoddyl
56
57
#endif
// CROCODDYL_CORE_UTILS_EXCEPTION_HPP_
crocoddyl::Exception
Definition
exception.hpp:39
include
crocoddyl
core
utils
exception.hpp
Generated by
1.9.8