interrogateDatabase.I 4.6 KB

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