Panda3D
 All Classes Functions Variables Enumerations
configFlags.h
1 // Filename: configFlags.h
2 // Created by: drose (21Oct04)
3 //
4 ////////////////////////////////////////////////////////////////////
5 //
6 // PANDA 3D SOFTWARE
7 // Copyright (c) Carnegie Mellon University. All rights reserved.
8 //
9 // All use of this software is subject to the terms of the revised BSD
10 // license. You should have received a copy of this license along
11 // with this source code in a file named "LICENSE."
12 //
13 ////////////////////////////////////////////////////////////////////
14 
15 #ifndef CONFIGFLAGS_H
16 #define CONFIGFLAGS_H
17 
18 #include "dtoolbase.h"
19 #include "numeric_types.h"
20 #include "atomicAdjust.h"
21 
22 ////////////////////////////////////////////////////////////////////
23 // Class : ConfigFlags
24 // Description : This class is the base class of both ConfigVariable
25 // and ConfigVariableCore. It exists only to provide a
26 // convenient name scoping for some enumerated values
27 // common to both classes.
28 ////////////////////////////////////////////////////////////////////
29 class EXPCL_DTOOLCONFIG ConfigFlags {
30 PUBLISHED:
31  enum ValueType {
32  VT_undefined,
33  VT_list,
34  VT_string,
35  VT_filename,
36  VT_bool,
37  VT_int,
38  VT_double,
39  VT_enum,
40  VT_search_path,
41  VT_int64,
42  VT_color,
43  };
44 
45  enum VariableFlags {
46  // Trust level. We have the bottom twelve bits reserved for a
47  // trust level indicator; then the open and closed bits are a
48  // special case.
49  F_trust_level_mask = 0x00000fff,
50  F_open = 0x00001000,
51  F_closed = 0x00002000,
52 
53  // F_dynamic means that the variable name is generated dynamically
54  // (possibly from a very large pool) and should not be included in
55  // the normal list of variable names.
56  F_dynamic = 0x00004000,
57 
58  // F_dconfig means that the variable was constructed from the
59  // legacy DConfig system, rather than directly by the user. You
60  // shouldn't pass this in directly.
61  F_dconfig = 0x00008000,
62  };
63 
64 protected:
65  INLINE static bool is_cache_valid(AtomicAdjust::Integer local_modified);
66  INLINE static void mark_cache_valid(AtomicAdjust::Integer &local_modified);
67  INLINE static AtomicAdjust::Integer initial_invalid_cache();
68  INLINE static void invalidate_cache();
69 
70 private:
71  static TVOLATILE AtomicAdjust::Integer _global_modified;
72 };
73 
74 ostream &operator << (ostream &out, ConfigFlags::ValueType type);
75 
76 #include "configFlags.I"
77 
78 #endif
This class is the base class of both ConfigVariable and ConfigVariableCore.
Definition: configFlags.h:29