Panda3D
configFlags.I
Go to the documentation of this file.
1 /**
2  * PANDA 3D SOFTWARE
3  * Copyright (c) Carnegie Mellon University. All rights reserved.
4  *
5  * All use of this software is subject to the terms of the revised BSD
6  * license. You should have received a copy of this license along
7  * with this source code in a file named "LICENSE."
8  *
9  * @file configFlags.I
10  * @author drose
11  * @date 2004-10-21
12  */
13 
14 /**
15  * Returns true if the local object's cache is still valid (based on a
16  * comparison of the supplied local_modified value with the global_modified
17  * value).
18  */
19 ALWAYS_INLINE bool ConfigFlags::
20 is_cache_valid(AtomicAdjust::Integer local_modified) {
21  return local_modified == _global_modified;
22 }
23 
24 /**
25  * Updates the indicated local_modified value so that the cache will appear to
26  * be valid, until someone next calls invalidate_cache().
27  */
28 ALWAYS_INLINE void ConfigFlags::
29 mark_cache_valid(AtomicAdjust::Integer &local_modified) {
30  local_modified = _global_modified;
31 }
32 
33 /**
34  * Returns a value that will be appropriate for initializing a local_modified
35  * value. This value will indicate an invalid cache in the next call to
36  * is_cache_valid().
37  */
38 INLINE AtomicAdjust::Integer ConfigFlags::
39 initial_invalid_cache() {
40  return _global_modified - 1;
41 }
42 
43 /**
44  * Invalidates all of the global ConfigVariable caches in the world at once,
45  * by incrementing the global_modified counter.
46  */
47 INLINE void ConfigFlags::
48 invalidate_cache() {
49  AtomicAdjust::inc(_global_modified);
50 }
static void inc(Integer &var)
Atomically increments the indicated variable.