ocra-recipes
Doxygen documentation for the ocra-recipes repository
Main Page
Related Pages
Modules
Namespaces
Classes
Files
Examples
File List
File Members
ocra
include
ocra
optim
ocra_assert.h
Go to the documentation of this file.
1
#ifndef _OCRA_ASSERT_H_
2
#define _OCRA_ASSERT_H_
3
4
namespace
ocra
5
{
6
template
<
bool
condition>
struct
ocra_static_assert
{};
7
8
template
<>
9
struct
ocra_static_assert
<true>
10
{
11
enum
12
{
13
TYPE_MUST_BE_A_VECTOR_OR_A_DYNAMIC_MATRIX
14
};
15
};
16
17
}
18
19
#ifdef _MSC_VER
20
21
#define OCRA_STATIC_ASSERT(OCRA_ASSERT_CONDITION,MSG) \
22
{ocra::ocra_static_assert<OCRA_ASSERT_CONDITION ? true : false>::MSG;}
23
24
#else
25
26
#define OCRA_STATIC_ASSERT(CONDITION,MSG) \
27
if (ocra::ocra_static_assert<CONDITION ? true : false>::MSG) {}
28
29
#endif
30
31
32
struct
ocra_assertion_fired
{};
33
34
#undef ocra_assert
35
36
#ifndef NDEBUG
37
# ifndef OCRA_ASSERT_ACTIVE
38
# define OCRA_ASSERT_ACTIVE
39
# endif
40
#endif
41
42
#ifdef OCRA_ASSERT_ACTIVE
43
44
# include <cstdio>
45
# define ocra_assert(ocra_expression) if(!(ocra_expression)) { fprintf(stderr, #ocra_expression"\n"); fflush(stderr); throw ocra_assertion_fired(); }
46
47
#else // OCRA_ASSERT_ACTIVE not defined
48
49
# define ocra_assert(ocra_expression) ((void)0)
50
51
#endif // OCRA_ASSERT_ACTIVE
52
53
54
#endif // _OCRA_ASSERT_H_
55
56
57
// cmake:sourcegroup=utils
ocra
Optimization-based Robot Controller namespace. a library of classes to write and solve optimization p...
Definition:
ContactAvoidanceConstraint.h:14
ocra_assertion_fired
Definition:
ocra_assert.h:32
ocra::ocra_static_assert
Definition:
ocra_assert.h:6
Generated on Wed Mar 21 2018 09:00:38 for ocra-recipes by
1.8.11