/src/LPM/external.protobuf/include/google/protobuf/arena_config.h
Line | Count | Source (jump to first uncovered line) |
1 | | // Protocol Buffers - Google's data interchange format |
2 | | // Copyright 2008 Google Inc. All rights reserved. |
3 | | // https://developers.google.com/protocol-buffers/ |
4 | | // |
5 | | // Redistribution and use in source and binary forms, with or without |
6 | | // modification, are permitted provided that the following conditions are |
7 | | // met: |
8 | | // |
9 | | // * Redistributions of source code must retain the above copyright |
10 | | // notice, this list of conditions and the following disclaimer. |
11 | | // * Redistributions in binary form must reproduce the above |
12 | | // copyright notice, this list of conditions and the following disclaimer |
13 | | // in the documentation and/or other materials provided with the |
14 | | // distribution. |
15 | | // * Neither the name of Google Inc. nor the names of its |
16 | | // contributors may be used to endorse or promote products derived from |
17 | | // this software without specific prior written permission. |
18 | | // |
19 | | // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS |
20 | | // "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT |
21 | | // LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR |
22 | | // A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT |
23 | | // OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, |
24 | | // SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT |
25 | | // LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, |
26 | | // DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY |
27 | | // THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT |
28 | | // (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE |
29 | | // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
30 | | |
31 | | #ifndef GOOGLE_PROTOBUF_ARENA_CONFIG_H__ |
32 | | #define GOOGLE_PROTOBUF_ARENA_CONFIG_H__ |
33 | | |
34 | | #include <atomic> |
35 | | #include <cstddef> |
36 | | |
37 | | // Must be included last. |
38 | | #include "google/protobuf/port_def.inc" |
39 | | |
40 | | namespace google { |
41 | | namespace protobuf { |
42 | | namespace internal { |
43 | | namespace arena_config_internal { |
44 | | |
45 | | // We use an atomic here only for correctness so that we can read/write |
46 | | // concurrently. We don't have memory order requirements so we use relaxed |
47 | | // memory ordering. |
48 | | PROTOBUF_EXPORT extern std::atomic<size_t> default_arena_max_block_size; |
49 | | |
50 | | } // namespace arena_config_internal |
51 | | |
52 | | // The default value to use for DefaultArenaMaxBlockSize when |
53 | | // SetDefaultArenaMaxBlockSize hasn't been called. |
54 | | PROTOBUF_EXPORT extern const size_t kDefaultDefaultArenaMaxBlockSize; |
55 | | |
56 | | // The default value to use for arena max block size when no value is provided |
57 | | // in ArenaOptions. |
58 | 0 | inline size_t GetDefaultArenaMaxBlockSize() { |
59 | 0 | return arena_config_internal::default_arena_max_block_size.load( |
60 | 0 | std::memory_order_relaxed); |
61 | 0 | } |
62 | 0 | inline void SetDefaultArenaMaxBlockSize(size_t default_arena_max_block_size) { |
63 | 0 | return arena_config_internal::default_arena_max_block_size.store( |
64 | 0 | default_arena_max_block_size, std::memory_order_relaxed); |
65 | 0 | } |
66 | | |
67 | | } // namespace internal |
68 | | } // namespace protobuf |
69 | | } // namespace google |
70 | | |
71 | | #include "google/protobuf/port_undef.inc" |
72 | | |
73 | | #endif // GOOGLE_PROTOBUF_ARENA_CONFIG_H__ |