interrogateDatabase.I 4.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115
  1. // Filename: interrogateDatabase.I
  2. // Created by: drose (01Aug00)
  3. //
  4. ////////////////////////////////////////////////////////////////////
  5. //
  6. // PANDA 3D SOFTWARE
  7. // Copyright (c) 2001 - 2004, Disney Enterprises, Inc. All rights reserved
  8. //
  9. // All use of this software is subject to the terms of the Panda 3d
  10. // Software license. You should have received a copy of this license
  11. // along with this source code; you will also find a current copy of
  12. // the license at http://etc.cmu.edu/panda3d/docs/license/ .
  13. //
  14. // To contact the maintainers of this program write to
  15. // [email protected] .
  16. //
  17. ////////////////////////////////////////////////////////////////////
  18. ////////////////////////////////////////////////////////////////////
  19. // Function: InterrogateDatabase::check_latest
  20. // Access: Public
  21. // Description: Checks that all the latest data for all the libraries
  22. // have been loaded. Loads them if not.
  23. ////////////////////////////////////////////////////////////////////
  24. INLINE void InterrogateDatabase::
  25. check_latest() {
  26. if (!_requests.empty()) {
  27. load_latest();
  28. }
  29. }
  30. ////////////////////////////////////////////////////////////////////
  31. // Function: InterrogateDatabase::lookup_type_by_name
  32. // Access: Public
  33. // Description: Returns the TypeIndex associated with the first type
  34. // found with the given name, or 0 if no type has this
  35. // name.
  36. ////////////////////////////////////////////////////////////////////
  37. INLINE TypeIndex InterrogateDatabase::
  38. lookup_type_by_name(const string &name) {
  39. check_latest();
  40. return lookup(name, _types_by_name, LT_type_name,
  41. &InterrogateDatabase::freshen_types_by_name);
  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. // Function: InterrogateDatabase::lookup_type_by_true_name
  58. // Access: Public
  59. // Description: Returns the TypeIndex associated with the first type
  60. // found with the given true name, or 0 if no type has
  61. // this name.
  62. ////////////////////////////////////////////////////////////////////
  63. INLINE TypeIndex InterrogateDatabase::
  64. lookup_type_by_true_name(const string &name) {
  65. check_latest();
  66. return lookup(name, _types_by_true_name, LT_type_true_name,
  67. &InterrogateDatabase::freshen_types_by_true_name);
  68. }
  69. ////////////////////////////////////////////////////////////////////
  70. // Function: InterrogateDatabase::lookup_manifest_by_name
  71. // Access: Public
  72. // Description: Returns the ManifestIndex associated with the first
  73. // manifest found with the given name, or 0 if no
  74. // manifest has this name.
  75. ////////////////////////////////////////////////////////////////////
  76. INLINE ManifestIndex InterrogateDatabase::
  77. lookup_manifest_by_name(const string &name) {
  78. check_latest();
  79. return lookup(name, _manifests_by_name, LT_manifest_name,
  80. &InterrogateDatabase::freshen_manifests_by_name);
  81. }
  82. ////////////////////////////////////////////////////////////////////
  83. // Function: InterrogateDatabase::lookup_element_by_name
  84. // Access: Public
  85. // Description: Returns the ElementIndex associated with the first
  86. // element found with the given name, or 0 if no element
  87. // has this name.
  88. ////////////////////////////////////////////////////////////////////
  89. INLINE ElementIndex InterrogateDatabase::
  90. lookup_element_by_name(const string &name) {
  91. check_latest();
  92. return lookup(name, _elements_by_name, LT_element_name,
  93. &InterrogateDatabase::freshen_elements_by_name);
  94. }
  95. ////////////////////////////////////////////////////////////////////
  96. // Function: InterrogateDatabase::lookup_element_by_scoped_name
  97. // Access: Public
  98. // Description: Returns the ElementIndex associated with the first
  99. // element found with the given scoped name, or 0 if no
  100. // element has this name.
  101. ////////////////////////////////////////////////////////////////////
  102. INLINE ElementIndex InterrogateDatabase::
  103. lookup_element_by_scoped_name(const string &name) {
  104. check_latest();
  105. return lookup(name, _elements_by_scoped_name, LT_element_scoped_name,
  106. &InterrogateDatabase::freshen_elements_by_scoped_name);
  107. }