Panda3D
|
00001 // Filename: configFlags.h 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 #ifndef CONFIGFLAGS_H 00016 #define CONFIGFLAGS_H 00017 00018 #include "dtoolbase.h" 00019 #include "numeric_types.h" 00020 #include "atomicAdjust.h" 00021 00022 //////////////////////////////////////////////////////////////////// 00023 // Class : ConfigFlags 00024 // Description : This class is the base class of both ConfigVariable 00025 // and ConfigVariableCore. It exists only to provide a 00026 // convenient name scoping for some enumerated values 00027 // common to both classes. 00028 //////////////////////////////////////////////////////////////////// 00029 class EXPCL_DTOOLCONFIG ConfigFlags { 00030 PUBLISHED: 00031 enum ValueType { 00032 VT_undefined, 00033 VT_list, 00034 VT_string, 00035 VT_filename, 00036 VT_bool, 00037 VT_int, 00038 VT_double, 00039 VT_enum, 00040 VT_search_path, 00041 VT_int64, 00042 }; 00043 00044 enum VariableFlags { 00045 // Trust level. We have the bottom twelve bits reserved for a 00046 // trust level indicator; then the open and closed bits are a 00047 // special case. 00048 F_trust_level_mask = 0x00000fff, 00049 F_open = 0x00001000, 00050 F_closed = 0x00002000, 00051 00052 // F_dynamic means that the variable name is generated dynamically 00053 // (possibly from a very large pool) and should not be included in 00054 // the normal list of variable names. 00055 F_dynamic = 0x00004000, 00056 00057 // F_dconfig means that the variable was constructed from the 00058 // legacy DConfig system, rather than directly by the user. You 00059 // shouldn't pass this in directly. 00060 F_dconfig = 0x00008000, 00061 }; 00062 00063 protected: 00064 INLINE static bool is_cache_valid(AtomicAdjust::Integer local_modified); 00065 INLINE static void mark_cache_valid(AtomicAdjust::Integer &local_modified); 00066 INLINE static AtomicAdjust::Integer initial_invalid_cache(); 00067 INLINE static void invalidate_cache(); 00068 00069 private: 00070 static TVOLATILE AtomicAdjust::Integer _global_modified; 00071 }; 00072 00073 ostream &operator << (ostream &out, ConfigFlags::ValueType type); 00074 00075 #include "configFlags.I" 00076 00077 #endif 00078