VMware GemFire Native C++ Reference
9.2.4
Assert.hpp
Go to the documentation of this file.
1
#pragma once
2
3
#ifndef GEODE_ASSERT_H_
4
#define GEODE_ASSERT_H_
5
6
/*
7
* Licensed to the Apache Software Foundation (ASF) under one or more
8
* contributor license agreements. See the NOTICE file distributed with
9
* this work for additional information regarding copyright ownership.
10
* The ASF licenses this file to You under the Apache License, Version 2.0
11
* (the "License"); you may not use this file except in compliance with
12
* the License. You may obtain a copy of the License at
13
*
14
* http://www.apache.org/licenses/LICENSE-2.0
15
*
16
* Unless required by applicable law or agreed to in writing, software
17
* distributed under the License is distributed on an "AS IS" BASIS,
18
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
19
* See the License for the specific language governing permissions and
20
* limitations under the License.
21
*/
22
23
#include "geode_globals.hpp"
24
31
namespace
apache
{
32
namespace
geode
{
33
namespace
client {
34
40
class
CPPCACHE_EXPORT
Assert
{
41
public
:
45
inline
static
void
assertTrue
(
bool
expression,
const
char
* expressionText,
46
const
char
* file,
int
line) {
47
if
(!expression) {
48
throwAssertion(expressionText, file, line);
49
}
50
}
51
54
static
void
throwAssertion(
const
char
* expressionText,
const
char
* file,
55
int
line);
56
};
57
}
// namespace client
58
}
// namespace geode
59
}
// namespace apache
60
62
#define GF_R_ASSERT(x) \
63
apache::geode::client::Assert::assertTrue(x, #x, __FILE__, __LINE__)
64
65
#ifndef GF_DEBUG_ASSERTS
66
67
#define GF_DEBUG_ASSERTS 0
68
#endif
69
70
#ifndef GF_DEVEL_ASSERTS
71
#define GF_DEVEL_ASSERTS 0
72
#endif
73
74
#if GF_DEVEL_ASSERTS == 1
75
#undef GF_DEBUG_ASSERTS
76
#define GF_DEBUG_ASSERTS 1
77
#endif
78
79
#if GF_DEBUG_ASSERTS == 1
80
#undef GF_DEVEL_ASSERTS
81
#define GF_DEVEL_ASSERTS 1
82
#endif
83
85
#if GF_DEBUG_ASSERTS == 1
86
#define GF_D_ASSERT(x) \
87
apache::geode::client::Assert::assertTrue(x, #x, __FILE__, __LINE__)
88
#else
89
#define GF_D_ASSERT(x)
90
#endif
91
93
#if GF_DEVEL_ASSERTS == 1
94
#define GF_DEV_ASSERT(x) \
95
apache::geode::client::Assert::assertTrue(x, #x, __FILE__, __LINE__)
96
#else
97
#define GF_DEV_ASSERT(x)
98
#endif
99
100
#endif // GEODE_ASSERT_H_
apache
Each enum represents a predefined RegionAttributes in a {}.
Definition:
Assert.hpp:31
apache::geode::client::Assert::assertTrue
static void assertTrue(bool expression, const char *expressionText, const char *file, int line)
If the given expression is true, does nothing, otherwise calls throwAssertion .
Definition:
Assert.hpp:45
geode
CPPCACHE_EXPORT
#define CPPCACHE_EXPORT
Defines a Geode CPPCACHE export.
Definition:
geode_base.hpp:58
apache::geode::client::Assert
Definition:
Assert.hpp:40
Pivotal GemFire C++ Cache API Documentation