1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
|
// Copyright 2016 The Draco Authors.
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
//
#ifndef DRACO_CORE_MACROS_H_
#define DRACO_CORE_MACROS_H_
#include "assert.h"
#include "draco/draco_features.h"
#ifdef ANDROID_LOGGING
#include <android/log.h>
#define LOG_TAG "draco"
#define LOGI(...) __android_log_print(ANDROID_LOG_INFO, LOG_TAG, __VA_ARGS__)
#define LOGE(...) __android_log_print(ANDROID_LOG_ERROR, LOG_TAG, __VA_ARGS__)
#else
#define LOGI printf
#define LOGE printf
#endif
#include <iostream>
namespace draco {
#define DISALLOW_COPY_AND_ASSIGN(TypeName) \
TypeName(const TypeName &) = delete; \
void operator=(const TypeName &) = delete;
#ifndef FALLTHROUGH_INTENDED
#define FALLTHROUGH_INTENDED void(0);
#endif
#ifndef LOG
#define LOG(...) std::cout
#endif
#ifndef VLOG
#define VLOG(...) std::cout
#endif
} // namespace draco
#ifdef DRACO_DEBUG
#define DRACO_DCHECK(x) (assert(x));
#define DRACO_DCHECK_EQ(a, b) assert((a) == (b));
#define DRACO_DCHECK_NE(a, b) assert((a) != (b));
#define DRACO_DCHECK_GE(a, b) assert((a) >= (b));
#define DRACO_DCHECK_GT(a, b) assert((a) > (b));
#define DRACO_DCHECK_LE(a, b) assert((a) <= (b));
#define DRACO_DCHECK_LT(a, b) assert((a) < (b));
#define DRACO_DCHECK_NOTNULL(x) assert((x) != NULL);
#else
#define DRACO_DCHECK(x)
#define DRACO_DCHECK_EQ(a, b)
#define DRACO_DCHECK_NE(a, b)
#define DRACO_DCHECK_GE(a, b)
#define DRACO_DCHECK_GT(a, b)
#define DRACO_DCHECK_LE(a, b)
#define DRACO_DCHECK_LT(a, b)
#define DRACO_DCHECK_NOTNULL(x)
#endif
// Helper macros for concatenating macro values.
#define DRACO_MACROS_IMPL_CONCAT_INNER_(x, y) x##y
#define DRACO_MACROS_IMPL_CONCAT_(x, y) DRACO_MACROS_IMPL_CONCAT_INNER_(x, y)
// Expand the n-th argument of the macro. Used to select an argument based on
// the number of entries in a variadic macro argument. Example usage:
//
// #define FUNC_1(x) x
// #define FUNC_2(x, y) x + y
// #define FUNC_3(x, y, z) x + y + z
//
// #define VARIADIC_MACRO(...)
// DRACO_SELECT_NTH_FROM_3(__VA_ARGS__, FUNC_3, FUNC_2, FUNC_1) __VA_ARGS__
//
#define DRACO_SELECT_NTH_FROM_2(_1, _2, NAME) NAME
#define DRACO_SELECT_NTH_FROM_3(_1, _2, _3, NAME) NAME
#define DRACO_SELECT_NTH_FROM_4(_1, _2, _3, _4, NAME) NAME
// Macro that converts the Draco bit-stream into one uint16_t number.
// Useful mostly when checking version numbers.
#define DRACO_BITSTREAM_VERSION(MAJOR, MINOR) \
((static_cast<uint16_t>(MAJOR) << 8) | MINOR)
#endif // DRACO_CORE_MACROS_H_
|