00001 // Filename: interrogateDatabase.I 00002 // Created by: drose (01Aug00) 00003 // 00004 //////////////////////////////////////////////////////////////////// 00005 // 00006 // PANDA 3D SOFTWARE 00007 // Copyright (c) 2001, Disney Enterprises, Inc. All rights reserved 00008 // 00009 // All use of this software is subject to the terms of the Panda 3d 00010 // Software license. You should have received a copy of this license 00011 // along with this source code; you will also find a current copy of 00012 // the license at http://www.panda3d.org/license.txt . 00013 // 00014 // To contact the maintainers of this program write to 00015 // panda3d@yahoogroups.com . 00016 // 00017 //////////////////////////////////////////////////////////////////// 00018 00019 00020 //////////////////////////////////////////////////////////////////// 00021 // Function: InterrogateDatabase::check_latest 00022 // Access: Public 00023 // Description: Checks that all the latest data for all the libraries 00024 // have been loaded. Loads them if not. 00025 //////////////////////////////////////////////////////////////////// 00026 INLINE void InterrogateDatabase:: 00027 check_latest() { 00028 if (!_requests.empty()) { 00029 load_latest(); 00030 } 00031 } 00032 00033 //////////////////////////////////////////////////////////////////// 00034 // Function: InterrogateDatabase::lookup_type_by_name 00035 // Access: Public 00036 // Description: Returns the TypeIndex associated with the first type 00037 // found with the given name, or 0 if no type has this 00038 // name. 00039 //////////////////////////////////////////////////////////////////// 00040 INLINE TypeIndex InterrogateDatabase:: 00041 lookup_type_by_name(const string &name) { 00042 check_latest(); 00043 return lookup(name, _types_by_name, LT_type_name, 00044 &InterrogateDatabase::freshen_types_by_name); 00045 } 00046 00047 //////////////////////////////////////////////////////////////////// 00048 // Function: InterrogateDatabase::lookup_type_by_scoped_name 00049 // Access: Public 00050 // Description: Returns the TypeIndex associated with the first type 00051 // found with the given scoped name, or 0 if no type has 00052 // this name. 00053 //////////////////////////////////////////////////////////////////// 00054 INLINE TypeIndex InterrogateDatabase:: 00055 lookup_type_by_scoped_name(const string &name) { 00056 check_latest(); 00057 return lookup(name, _types_by_scoped_name, LT_type_scoped_name, 00058 &InterrogateDatabase::freshen_types_by_scoped_name); 00059 } 00060 00061 //////////////////////////////////////////////////////////////////// 00062 // Function: InterrogateDatabase::lookup_type_by_true_name 00063 // Access: Public 00064 // Description: Returns the TypeIndex associated with the first type 00065 // found with the given true name, or 0 if no type has 00066 // this name. 00067 //////////////////////////////////////////////////////////////////// 00068 INLINE TypeIndex InterrogateDatabase:: 00069 lookup_type_by_true_name(const string &name) { 00070 check_latest(); 00071 return lookup(name, _types_by_true_name, LT_type_true_name, 00072 &InterrogateDatabase::freshen_types_by_true_name); 00073 } 00074 00075 //////////////////////////////////////////////////////////////////// 00076 // Function: InterrogateDatabase::lookup_manifest_by_name 00077 // Access: Public 00078 // Description: Returns the ManifestIndex associated with the first 00079 // manifest found with the given name, or 0 if no 00080 // manifest has this name. 00081 //////////////////////////////////////////////////////////////////// 00082 INLINE ManifestIndex InterrogateDatabase:: 00083 lookup_manifest_by_name(const string &name) { 00084 check_latest(); 00085 return lookup(name, _manifests_by_name, LT_manifest_name, 00086 &InterrogateDatabase::freshen_manifests_by_name); 00087 } 00088 00089 //////////////////////////////////////////////////////////////////// 00090 // Function: InterrogateDatabase::lookup_element_by_name 00091 // Access: Public 00092 // Description: Returns the ElementIndex associated with the first 00093 // element found with the given name, or 0 if no element 00094 // has this name. 00095 //////////////////////////////////////////////////////////////////// 00096 INLINE ElementIndex InterrogateDatabase:: 00097 lookup_element_by_name(const string &name) { 00098 check_latest(); 00099 return lookup(name, _elements_by_name, LT_element_name, 00100 &InterrogateDatabase::freshen_elements_by_name); 00101 } 00102 00103 //////////////////////////////////////////////////////////////////// 00104 // Function: InterrogateDatabase::lookup_element_by_scoped_name 00105 // Access: Public 00106 // Description: Returns the ElementIndex associated with the first 00107 // element found with the given scoped name, or 0 if no 00108 // element has this name. 00109 //////////////////////////////////////////////////////////////////// 00110 INLINE ElementIndex InterrogateDatabase:: 00111 lookup_element_by_scoped_name(const string &name) { 00112 check_latest(); 00113 return lookup(name, _elements_by_scoped_name, LT_element_scoped_name, 00114 &InterrogateDatabase::freshen_elements_by_scoped_name); 00115 }