Panda3D
 All Classes Functions Variables Enumerations
config_interrogatedb.cxx
1 // Filename: config_interrogatedb.cxx
2 // Created by: drose (01Aug00)
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 #include "config_interrogatedb.h"
16 #include "interrogate_request.h"
17 #include "configVariableBool.h"
18 #include "configVariableSearchPath.h"
19 #include "dconfig.h"
20 
21 #if defined(WIN32_VC) && defined(_DEBUG)
22 // _DEBUG assumes you are linking to msvcrt70d.dll, not msvcrt70.dll
23 #define USE_WIN32_DBGHEAP
24 #include <crtdbg.h>
25 #endif
26 
27 Configure(config_interrogatedb);
28 NotifyCategoryDef(interrogatedb, "");
29 
30 ConfigureFn(config_interrogatedb) {
31  // interrogate_request_library("types");
32 
33 #ifdef USE_WIN32_DBGHEAP
34  ConfigVariableBool use_win32_dbgheap("use-win32-dbgheap", false);
35  ConfigVariableBool win32_report_leaks("win32-report-leaks", false);
36 
37  int dbg_flags = _CrtSetDbgFlag( _CRTDBG_REPORT_FLAG );
38 
39  if (use_win32_dbgheap.get_string_value() == "full") {
40  // "full" means check the heap after *every* alloc/dealloc.
41  // Expensive.
42  dbg_flags |= (_CRTDBG_ALLOC_MEM_DF | _CRTDBG_CHECK_ALWAYS_DF |
43  _CRTDBG_CHECK_CRT_DF);
44 
45  } else {
46  // Otherwise, it's a bool flag. true means check the heap
47  // normally, false means don't do any debug checking.
48  if (!use_win32_dbgheap) {
49  // deflt disable complete heap verify every 1024 allocations (VC7 deflt).
50  // With vc7 stl small-string-optimization causing more allocs,
51  // this can cause order-of-magnitude slowdowns in dbg builds
52  dbg_flags = 0;
53  }
54  }
55 
56  if (win32_report_leaks) {
57  // Report memory still allocated at program termination. Not sure
58  // how useful this is, as many things get allocated once and never
59  // freed, but they aren't really leaks.
60  dbg_flags |= _CRTDBG_LEAK_CHECK_DF;
61  }
62 
63  _CrtSetDbgFlag(dbg_flags);
64 #endif
65 }
66 
67 ConfigVariableSearchPath interrogatedb_path
68 ("interrogatedb-path", "The search path for interrogate's *.in files.");
69 
This is similar to a ConfigVariableList, but it returns its list as a DSearchPath, as a list of directories.
This is a convenience class to specialize ConfigVariable as a boolean type.