00001 // Filename: configFlags.I 00002 // Created by: drose (21Oct04) 00003 // 00004 //////////////////////////////////////////////////////////////////// 00005 // 00006 // PANDA 3D SOFTWARE 00007 // Copyright (c) Carnegie Mellon University. All rights reserved. 00008 // 00009 // All use of this software is subject to the terms of the revised BSD 00010 // license. You should have received a copy of this license along 00011 // with this source code in a file named "LICENSE." 00012 // 00013 //////////////////////////////////////////////////////////////////// 00014 00015 00016 //////////////////////////////////////////////////////////////////// 00017 // Function: ConfigFlags::is_cache_valid 00018 // Access: Protected, Static 00019 // Description: Returns true if the local object's cache is still 00020 // valid (based on a comparison of the supplied 00021 // local_modified value with the global_modified value). 00022 //////////////////////////////////////////////////////////////////// 00023 INLINE bool ConfigFlags:: 00024 is_cache_valid(AtomicAdjust::Integer local_modified) { 00025 return local_modified == _global_modified; 00026 } 00027 00028 //////////////////////////////////////////////////////////////////// 00029 // Function: ConfigFlags::mark_cache_valid 00030 // Access: Protected, Static 00031 // Description: Updates the indicated local_modified value so that 00032 // the cache will appear to be valid, until someone next 00033 // calls invalidate_cache(). 00034 //////////////////////////////////////////////////////////////////// 00035 INLINE void ConfigFlags:: 00036 mark_cache_valid(AtomicAdjust::Integer &local_modified) { 00037 local_modified = _global_modified; 00038 } 00039 00040 //////////////////////////////////////////////////////////////////// 00041 // Function: ConfigFlags::initial_invalid_cache 00042 // Access: Protected, Static 00043 // Description: Returns a value that will be appropriate for 00044 // initializing a local_modified value. This value will 00045 // indicate an invalid cache in the next call to 00046 // is_cache_valid(). 00047 //////////////////////////////////////////////////////////////////// 00048 INLINE AtomicAdjust::Integer ConfigFlags:: 00049 initial_invalid_cache() { 00050 return _global_modified - 1; 00051 } 00052 00053 //////////////////////////////////////////////////////////////////// 00054 // Function: ConfigFlags::invalidate_cache 00055 // Access: Protected, Static 00056 // Description: Invalidates all of the global ConfigVariable caches 00057 // in the world at once, by incrementing the 00058 // global_modified counter. 00059 //////////////////////////////////////////////////////////////////// 00060 INLINE void ConfigFlags:: 00061 invalidate_cache() { 00062 AtomicAdjust::inc(_global_modified); 00063 }