crocoddyl
1.9.0
Contact RObot COntrol by Differential DYnamic programming Library (Crocoddyl)
Loading...
Searching...
No Matches
exception.hpp
1
2
// BSD 3-Clause License
3
//
4
// Copyright (C) 2019-2020, University of Edinburgh, LAAS-CNRS
5
// Copyright note valid unless otherwise stated in individual files.
6
// All rights reserved.
8
9
#ifndef CROCODDYL_CORE_UTILS_EXCEPTION_HPP_
10
#define CROCODDYL_CORE_UTILS_EXCEPTION_HPP_
11
12
#include <exception>
13
#include <sstream>
14
#include <iostream>
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__, __LINE__); \
23
}
24
25
#ifndef NDEBUG
26
#define assert_pretty(condition, m) \
27
if (!(condition)) { \
28
std::stringstream ss; \
29
ss << m; \
30
throw crocoddyl::Exception(ss.str(), __FILE__, __PRETTY_FUNCTION__, __LINE__); \
31
}
32
#else
33
#define assert_pretty(condition, m) ((void)0)
34
#endif
35
namespace
crocoddyl {
36
37
class
Exception
:
public
std::exception {
38
public
:
39
explicit
Exception
(
const
std::string &msg,
const
char
*file,
const
char
*func,
int
line);
40
virtual
~Exception
() NOEXCEPT;
41
virtual
const
char
*what()
const
NOEXCEPT;
42
43
std::string msg_;
44
};
45
46
}
// namespace crocoddyl
47
48
#endif
// CROCODDYL_CORE_UTILS_EXCEPTION_HPP_
crocoddyl::Exception
Definition:
exception.hpp:37
include
crocoddyl
core
utils
exception.hpp
Generated by
1.9.5