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 <iostream>
15
#include <sstream>
16
17
#define NOEXCEPT noexcept
18
19
#define throw_pretty(m) \
20
{ \
21
std::stringstream ss; \
22
ss << m; \
23
throw crocoddyl::Exception(ss.str(), __FILE__, __PRETTY_FUNCTION__, \
24
__LINE__); \
25
}
26
27
#ifndef NDEBUG
28
#define assert_pretty(condition, m) \
29
if (!(condition)) { \
30
std::stringstream ss; \
31
ss << m; \
32
throw crocoddyl::Exception(ss.str(), __FILE__, __PRETTY_FUNCTION__, \
33
__LINE__); \
34
}
35
#else
36
#define assert_pretty(condition, m) ((void)0)
37
#endif
38
namespace
crocoddyl {
39
40
class
Exception
:
public
std::exception {
41
public
:
42
explicit
Exception
(
const
std::string &msg,
const
char
*file,
const
char
*func,
43
int
line);
44
virtual
~Exception
() NOEXCEPT;
45
virtual
const
char
*what()
const
NOEXCEPT;
46
47
std::string getMessage()
const
;
48
std::string getExtraData()
const
;
49
50
private
:
51
std::string exception_msg_;
52
std::string extra_data_;
53
std::string msg_;
54
};
55
56
}
// namespace crocoddyl
57
58
#endif
// CROCODDYL_CORE_UTILS_EXCEPTION_HPP_
crocoddyl::Exception
Definition
exception.hpp:40
include
crocoddyl
core
utils
exception.hpp
Generated by
1.9.8