Panda3D
 All Classes Functions Variables Enumerations
interrogateDatabase.I
1 // Filename: interrogateDatabase.I
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 
16 ////////////////////////////////////////////////////////////////////
17 // Function: InterrogateDatabase::check_latest
18 // Access: Public
19 // Description: Checks that all the latest data for all the libraries
20 // have been loaded. Loads them if not.
21 ////////////////////////////////////////////////////////////////////
22 INLINE void InterrogateDatabase::
23 check_latest() {
24  if (!_requests.empty()) {
25  load_latest();
26  }
27 }
28 
29 ////////////////////////////////////////////////////////////////////
30 // Function: InterrogateDatabase::lookup_type_by_name
31 // Access: Public
32 // Description: Returns the TypeIndex associated with the first type
33 // found with the given name, or 0 if no type has this
34 // name.
35 ////////////////////////////////////////////////////////////////////
36 INLINE TypeIndex InterrogateDatabase::
37 lookup_type_by_name(const string &name) {
38  check_latest();
39  return lookup(name, _types_by_name, LT_type_name,
40  &InterrogateDatabase::freshen_types_by_name);
41 }
42 
43 ////////////////////////////////////////////////////////////////////
44 // Function: InterrogateDatabase::lookup_type_by_scoped_name
45 // Access: Public
46 // Description: Returns the TypeIndex associated with the first type
47 // found with the given scoped name, or 0 if no type has
48 // this name.
49 ////////////////////////////////////////////////////////////////////
50 INLINE TypeIndex InterrogateDatabase::
51 lookup_type_by_scoped_name(const string &name) {
52  check_latest();
53  return lookup(name, _types_by_scoped_name, LT_type_scoped_name,
54  &InterrogateDatabase::freshen_types_by_scoped_name);
55 }
56 
57 ////////////////////////////////////////////////////////////////////
58 // Function: InterrogateDatabase::lookup_type_by_true_name
59 // Access: Public
60 // Description: Returns the TypeIndex associated with the first type
61 // found with the given true name, or 0 if no type has
62 // this name.
63 ////////////////////////////////////////////////////////////////////
64 INLINE TypeIndex InterrogateDatabase::
65 lookup_type_by_true_name(const string &name) {
66  check_latest();
67  return lookup(name, _types_by_true_name, LT_type_true_name,
68  &InterrogateDatabase::freshen_types_by_true_name);
69 }
70 
71 ////////////////////////////////////////////////////////////////////
72 // Function: InterrogateDatabase::lookup_manifest_by_name
73 // Access: Public
74 // Description: Returns the ManifestIndex associated with the first
75 // manifest found with the given name, or 0 if no
76 // manifest has this name.
77 ////////////////////////////////////////////////////////////////////
78 INLINE ManifestIndex InterrogateDatabase::
79 lookup_manifest_by_name(const string &name) {
80  check_latest();
81  return lookup(name, _manifests_by_name, LT_manifest_name,
82  &InterrogateDatabase::freshen_manifests_by_name);
83 }
84 
85 ////////////////////////////////////////////////////////////////////
86 // Function: InterrogateDatabase::lookup_element_by_name
87 // Access: Public
88 // Description: Returns the ElementIndex associated with the first
89 // element found with the given name, or 0 if no element
90 // has this name.
91 ////////////////////////////////////////////////////////////////////
92 INLINE ElementIndex InterrogateDatabase::
93 lookup_element_by_name(const string &name) {
94  check_latest();
95  return lookup(name, _elements_by_name, LT_element_name,
96  &InterrogateDatabase::freshen_elements_by_name);
97 }
98 
99 ////////////////////////////////////////////////////////////////////
100 // Function: InterrogateDatabase::lookup_element_by_scoped_name
101 // Access: Public
102 // Description: Returns the ElementIndex associated with the first
103 // element found with the given scoped name, or 0 if no
104 // element has this name.
105 ////////////////////////////////////////////////////////////////////
106 INLINE ElementIndex InterrogateDatabase::
107 lookup_element_by_scoped_name(const string &name) {
108  check_latest();
109  return lookup(name, _elements_by_scoped_name, LT_element_scoped_name,
110  &InterrogateDatabase::freshen_elements_by_scoped_name);
111 }
TypeIndex lookup_type_by_name(const string &name)
Returns the TypeIndex associated with the first type found with the given name, or 0 if no type has t...
ManifestIndex lookup_manifest_by_name(const string &name)
Returns the ManifestIndex associated with the first manifest found with the given name...
ElementIndex lookup_element_by_name(const string &name)
Returns the ElementIndex associated with the first element found with the given name, or 0 if no element has this name.
ElementIndex lookup_element_by_scoped_name(const string &name)
Returns the ElementIndex associated with the first element found with the given scoped name...
TypeIndex lookup_type_by_scoped_name(const string &name)
Returns the TypeIndex associated with the first type found with the given scoped name, or 0 if no type has this name.
TypeIndex lookup_type_by_true_name(const string &name)
Returns the TypeIndex associated with the first type found with the given true name, or 0 if no type has this name.