opensurgsim
SurgSim
Framework
Assert.h
Go to the documentation of this file.
1
// This file is a part of the OpenSurgSim project.
2
// Copyright 2013, SimQuest Solutions Inc.
3
//
4
// Licensed under the Apache License, Version 2.0 (the "License");
5
// you may not use this file except in compliance with the License.
6
// You may obtain a copy of the License at
7
//
8
// http://www.apache.org/licenses/LICENSE-2.0
9
//
10
// Unless required by applicable law or agreed to in writing, software
11
// distributed under the License is distributed on an "AS IS" BASIS,
12
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13
// See the License for the specific language governing permissions and
14
// limitations under the License.
15
20
21
#ifndef SURGSIM_FRAMEWORK_ASSERT_H
22
#define SURGSIM_FRAMEWORK_ASSERT_H
23
24
#include "SurgSim/Framework/Logger.h"
25
#include "SurgSim/Framework/AssertMessage.h"
26
27
namespace
SurgSim
28
{
29
namespace
Framework
30
{
31
36
39
40
41
#if !defined(SURGSIM_ASSERT_LOGGER)
42
#define SURGSIM_ASSERT_LOGGER ::SurgSim::Framework::Logger::getDefaultLogger()
46
#endif
47
52
#if defined(__func__)
53
#define SURGSIM_CURRENT_FUNCTION __func__
54
#elif defined(__FUNCSIG__)
55
#define SURGSIM_CURRENT_FUNCTION __FUNCSIG__
56
#elif defined(__PRETTY_FUNCTION__)
57
#define SURGSIM_CURRENT_FUNCTION __PRETTY_FUNCTION__
58
#elif defined(__FUNCTION__)
59
#define SURGSIM_CURRENT_FUNCTION __FUNCTION__
60
#else
61
#define SURGSIM_CURRENT_FUNCTION "???"
62
#endif
63
68
#define SURGSIM_MAKE_STRING(x) #x
69
77
#define SURGSIM_ASSERT(condition) \
78
if ((condition)) \
79
{ \
80
} \
81
else \
82
/* important: no curly braces around this! */
\
83
::SurgSim::Framework::AssertMessage(SURGSIM_ASSERT_LOGGER) << "*** Assertion failed: " << \
84
SURGSIM_MAKE_STRING(condition) << " ***" << std::endl << \
85
" in " << SURGSIM_CURRENT_FUNCTION << std::endl << \
86
" at " << __FILE__ << ":" << __LINE__ << std::endl
87
95
#define SURGSIM_FAILURE() \
96
::SurgSim::Framework::AssertMessage(SURGSIM_ASSERT_LOGGER) << "*** Failure ***" << std::endl << \
97
" in " << SURGSIM_CURRENT_FUNCTION << std::endl << \
98
" at " << __FILE__ << ":" << __LINE__ << std::endl
99
100
102
103
};
// namespace Framework
104
};
// namespace SurgSim
105
106
#endif // SURGSIM_FRAMEWORK_ASSERT_H
SurgSim
Wraps glewInit() to separate the glew opengl definitions from the osg opengl definitions only imgui n...
Definition:
AddRandomSphereBehavior.cpp:36
Generated by
1.8.12