00001 // Filename: interrogateFunctionWrapper.I 00002 // Created by: drose (06Aug00) 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: InterrogateFunctionWrapper::Constructor 00022 // Access: Public 00023 // Description: 00024 //////////////////////////////////////////////////////////////////// 00025 INLINE InterrogateFunctionWrapper:: 00026 InterrogateFunctionWrapper(InterrogateModuleDef *def) : 00027 InterrogateComponent(def) 00028 { 00029 _flags = 0; 00030 _function = 0; 00031 _return_type = 0; 00032 _return_value_destructor = 0; 00033 } 00034 00035 //////////////////////////////////////////////////////////////////// 00036 // Function: InterrogateFunctionWrapper::Copy Constructor 00037 // Access: Public 00038 // Description: 00039 //////////////////////////////////////////////////////////////////// 00040 INLINE InterrogateFunctionWrapper:: 00041 InterrogateFunctionWrapper(const InterrogateFunctionWrapper ©) { 00042 (*this) = copy; 00043 } 00044 00045 //////////////////////////////////////////////////////////////////// 00046 // Function: InterrogateFunctionWrapper::Copy Assignment Operator 00047 // Access: Public 00048 // Description: 00049 //////////////////////////////////////////////////////////////////// 00050 INLINE void InterrogateFunctionWrapper:: 00051 operator = (const InterrogateFunctionWrapper ©) { 00052 InterrogateComponent::operator = (copy); 00053 _flags = copy._flags; 00054 _function = copy._function; 00055 _return_type = copy._return_type; 00056 _return_value_destructor = copy._return_value_destructor; 00057 _unique_name = copy._unique_name; 00058 _parameters = copy._parameters; 00059 } 00060 00061 //////////////////////////////////////////////////////////////////// 00062 // Function: InterrogateFunctionWrapper::get_function 00063 // Access: Public 00064 // Description: Returns the FunctionIndex of the function that this 00065 // wrapper corresponds to. 00066 //////////////////////////////////////////////////////////////////// 00067 INLINE FunctionIndex InterrogateFunctionWrapper:: 00068 get_function() const { 00069 return _function; 00070 } 00071 00072 //////////////////////////////////////////////////////////////////// 00073 // Function: InterrogateFunctionWrapper::is_callable_by_name 00074 // Access: Public 00075 // Description: 00076 //////////////////////////////////////////////////////////////////// 00077 INLINE bool InterrogateFunctionWrapper:: 00078 is_callable_by_name() const { 00079 return (_flags & F_callable_by_name) != 0; 00080 } 00081 00082 //////////////////////////////////////////////////////////////////// 00083 // Function: InterrogateFunctionWrapper::has_return_value 00084 // Access: Public 00085 // Description: 00086 //////////////////////////////////////////////////////////////////// 00087 INLINE bool InterrogateFunctionWrapper:: 00088 has_return_value() const { 00089 return (_flags & F_has_return) != 0; 00090 } 00091 00092 //////////////////////////////////////////////////////////////////// 00093 // Function: InterrogateFunctionWrapper::get_return_type 00094 // Access: Public 00095 // Description: 00096 //////////////////////////////////////////////////////////////////// 00097 INLINE TypeIndex InterrogateFunctionWrapper:: 00098 get_return_type() const { 00099 return _return_type; 00100 } 00101 00102 //////////////////////////////////////////////////////////////////// 00103 // Function: InterrogateFunctionWrapper::caller_manages_return_value 00104 // Access: Public 00105 // Description: 00106 //////////////////////////////////////////////////////////////////// 00107 INLINE bool InterrogateFunctionWrapper:: 00108 caller_manages_return_value() const { 00109 return (_flags & F_caller_manages) != 0; 00110 } 00111 00112 //////////////////////////////////////////////////////////////////// 00113 // Function: InterrogateFunctionWrapper::get_return_value_destructor 00114 // Access: Public 00115 // Description: 00116 //////////////////////////////////////////////////////////////////// 00117 INLINE FunctionIndex InterrogateFunctionWrapper:: 00118 get_return_value_destructor() const { 00119 return _return_value_destructor; 00120 } 00121 00122 //////////////////////////////////////////////////////////////////// 00123 // Function: InterrogateFunctionWrapper::number_of_parameters 00124 // Access: Public 00125 // Description: 00126 //////////////////////////////////////////////////////////////////// 00127 INLINE int InterrogateFunctionWrapper:: 00128 number_of_parameters() const { 00129 return _parameters.size(); 00130 } 00131 00132 //////////////////////////////////////////////////////////////////// 00133 // Function: InterrogateFunctionWrapper::parameter_get_type 00134 // Access: Public 00135 // Description: 00136 //////////////////////////////////////////////////////////////////// 00137 INLINE TypeIndex InterrogateFunctionWrapper:: 00138 parameter_get_type(int n) const { 00139 if (n >= 0 && n < (int)_parameters.size()) { 00140 return _parameters[n]._type; 00141 } 00142 return 0; 00143 } 00144 00145 //////////////////////////////////////////////////////////////////// 00146 // Function: InterrogateFunctionWrapper::parameter_has_name 00147 // Access: Public 00148 // Description: 00149 //////////////////////////////////////////////////////////////////// 00150 INLINE bool InterrogateFunctionWrapper:: 00151 parameter_has_name(int n) const { 00152 if (n >= 0 && n < (int)_parameters.size()) { 00153 return (_parameters[n]._parameter_flags & PF_has_name) != 0; 00154 } 00155 return false; 00156 } 00157 00158 //////////////////////////////////////////////////////////////////// 00159 // Function: InterrogateFunctionWrapper::parameter_get_name 00160 // Access: Public 00161 // Description: 00162 //////////////////////////////////////////////////////////////////// 00163 INLINE const string &InterrogateFunctionWrapper:: 00164 parameter_get_name(int n) const { 00165 static string bogus_string; 00166 if (n >= 0 && n < (int)_parameters.size()) { 00167 return _parameters[n]._name; 00168 } 00169 return bogus_string; 00170 } 00171 00172 //////////////////////////////////////////////////////////////////// 00173 // Function: InterrogateFunctionWrapper::parameter_is_this 00174 // Access: Public 00175 // Description: 00176 //////////////////////////////////////////////////////////////////// 00177 INLINE bool InterrogateFunctionWrapper:: 00178 parameter_is_this(int n) const { 00179 if (n >= 0 && n < (int)_parameters.size()) { 00180 return (_parameters[n]._parameter_flags & PF_is_this) != 0; 00181 } 00182 return false; 00183 } 00184 00185 //////////////////////////////////////////////////////////////////// 00186 // Function: InterrogateFunctionWrapper::get_unique_name 00187 // Access: Public 00188 // Description: 00189 //////////////////////////////////////////////////////////////////// 00190 INLINE const string &InterrogateFunctionWrapper:: 00191 get_unique_name() const { 00192 return _unique_name; 00193 } 00194 00195 INLINE ostream & 00196 operator << (ostream &out, const InterrogateFunctionWrapper &wrapper) { 00197 wrapper.output(out); 00198 return out; 00199 } 00200 00201 INLINE istream & 00202 operator >> (istream &in, InterrogateFunctionWrapper &wrapper) { 00203 wrapper.input(in); 00204 return in; 00205 } 00206 00207 INLINE ostream & 00208 operator << (ostream &out, const InterrogateFunctionWrapper::Parameter &p) { 00209 p.output(out); 00210 return out; 00211 } 00212 00213 INLINE istream & 00214 operator >> (istream &in, InterrogateFunctionWrapper::Parameter &p) { 00215 p.input(in); 00216 return in; 00217 } 00218