parameterRemap.I 4.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113
  1. // Filename: parameterRemap.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: ParameterRemap::Constructor
  16. // Access: Public
  17. // Description:
  18. ////////////////////////////////////////////////////////////////////
  19. INLINE ParameterRemap::
  20. ParameterRemap(CPPType *orig_type) :
  21. _orig_type(orig_type),
  22. _new_type(orig_type)
  23. {
  24. _is_valid = true;
  25. _temporary_type = (CPPType *)NULL;
  26. _default_value = (CPPExpression *)NULL;
  27. }
  28. ////////////////////////////////////////////////////////////////////
  29. // Function: ParameterRemap::is_valid
  30. // Access: Public
  31. // Description:
  32. ////////////////////////////////////////////////////////////////////
  33. INLINE bool ParameterRemap::
  34. is_valid() const {
  35. return _is_valid;
  36. }
  37. ////////////////////////////////////////////////////////////////////
  38. // Function: ParameterRemap::get_orig_type
  39. // Access: Public
  40. // Description: Returns the type of the original, C++ parameter or
  41. // return value.
  42. ////////////////////////////////////////////////////////////////////
  43. INLINE CPPType *ParameterRemap::
  44. get_orig_type() const {
  45. return _orig_type;
  46. }
  47. ////////////////////////////////////////////////////////////////////
  48. // Function: ParameterRemap::get_new_type
  49. // Access: Public
  50. // Description: Returns the type of the wrapper's parameter or return
  51. // value. This is the type that will be reported in the
  52. // interrogate database, and the type that the scripting
  53. // language is expected to deal with.
  54. ////////////////////////////////////////////////////////////////////
  55. INLINE CPPType *ParameterRemap::
  56. get_new_type() const {
  57. return _new_type;
  58. }
  59. ////////////////////////////////////////////////////////////////////
  60. // Function: ParameterRemap::get_temporary_type
  61. // Access: Public
  62. // Description: Returns the type of any temporary variables used to
  63. // hold the return value before returning it. This is
  64. // normally the same as get_new_type(), but in some
  65. // circumstances it may need to be different.
  66. ////////////////////////////////////////////////////////////////////
  67. INLINE CPPType *ParameterRemap::
  68. get_temporary_type() const {
  69. if (_temporary_type == (CPPType *)NULL) {
  70. return _new_type;
  71. } else {
  72. return _temporary_type;
  73. }
  74. }
  75. ////////////////////////////////////////////////////////////////////
  76. // Function: ParameterRemap::has_default_value
  77. // Access: Public
  78. // Description: Returns true if this particular parameter has a
  79. // default value defined.
  80. ////////////////////////////////////////////////////////////////////
  81. INLINE bool ParameterRemap::
  82. has_default_value() const {
  83. return (_default_value != (CPPExpression *)NULL);
  84. }
  85. ////////////////////////////////////////////////////////////////////
  86. // Function: ParameterRemap::get_default_value
  87. // Access: Public
  88. // Description: Returns the expression corresponding to this parameter's
  89. // default value.
  90. ////////////////////////////////////////////////////////////////////
  91. INLINE CPPExpression *ParameterRemap::
  92. get_default_value() const {
  93. return _default_value;
  94. }
  95. ////////////////////////////////////////////////////////////////////
  96. // Function: ParameterRemap::set_default_value
  97. // Access: Public
  98. // Description: Records a default value to be associated with this
  99. // parameter.
  100. ////////////////////////////////////////////////////////////////////
  101. INLINE void ParameterRemap::
  102. set_default_value(CPPExpression *expr) {
  103. _default_value = expr;
  104. }