parameterRemap.I 4.2 KB

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