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