00001 // Filename: interrogateFunction.I 00002 // Created by: drose (01Aug00) 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: InterrogateFunction::Constructor 00022 // Access: Public 00023 // Description: 00024 //////////////////////////////////////////////////////////////////// 00025 INLINE InterrogateFunction:: 00026 InterrogateFunction(InterrogateModuleDef *def) : 00027 InterrogateComponent(def) 00028 { 00029 _flags = 0; 00030 _class = 0; 00031 _instances = (Instances *)NULL; 00032 } 00033 00034 //////////////////////////////////////////////////////////////////// 00035 // Function: InterrogateFunction::Copy Constructor 00036 // Access: Public 00037 // Description: 00038 //////////////////////////////////////////////////////////////////// 00039 INLINE InterrogateFunction:: 00040 InterrogateFunction(const InterrogateFunction ©) { 00041 (*this) = copy; 00042 } 00043 00044 //////////////////////////////////////////////////////////////////// 00045 // Function: InterrogateFunction::is_global 00046 // Access: Public 00047 // Description: Returns true if the function is marked as 'global'. 00048 // This means only that it should appear in the global 00049 // function list. 00050 //////////////////////////////////////////////////////////////////// 00051 INLINE bool InterrogateFunction:: 00052 is_global() const { 00053 return (_flags & F_global) != 0; 00054 } 00055 00056 //////////////////////////////////////////////////////////////////// 00057 // Function: InterrogateFunction::is_virtual 00058 // Access: Public 00059 // Description: Returns true if the function is virtual, for whatever 00060 // that's worth. 00061 //////////////////////////////////////////////////////////////////// 00062 INLINE bool InterrogateFunction:: 00063 is_virtual() const { 00064 return (_flags & F_virtual) != 0; 00065 } 00066 00067 //////////////////////////////////////////////////////////////////// 00068 // Function: InterrogateFunction::is_method 00069 // Access: Public 00070 // Description: Returns true if the function is a class method. 00071 //////////////////////////////////////////////////////////////////// 00072 INLINE bool InterrogateFunction:: 00073 is_method() const { 00074 return (_flags & F_method) != 0; 00075 } 00076 00077 //////////////////////////////////////////////////////////////////// 00078 // Function: InterrogateFunction::get_class 00079 // Access: Public 00080 // Description: Return the class that owns the method, if is_method() 00081 // returns true. 00082 //////////////////////////////////////////////////////////////////// 00083 INLINE TypeIndex InterrogateFunction:: 00084 get_class() const { 00085 return _class; 00086 } 00087 00088 //////////////////////////////////////////////////////////////////// 00089 // Function: InterrogateFunction::has_scoped_name 00090 // Access: Public 00091 // Description: 00092 //////////////////////////////////////////////////////////////////// 00093 INLINE bool InterrogateFunction:: 00094 has_scoped_name() const { 00095 return !_scoped_name.empty(); 00096 } 00097 00098 //////////////////////////////////////////////////////////////////// 00099 // Function: InterrogateFunction::get_scoped_name 00100 // Access: Public 00101 // Description: 00102 //////////////////////////////////////////////////////////////////// 00103 INLINE const string &InterrogateFunction:: 00104 get_scoped_name() const { 00105 return _scoped_name; 00106 } 00107 00108 //////////////////////////////////////////////////////////////////// 00109 // Function: InterrogateFunction::has_comment 00110 // Access: Public 00111 // Description: 00112 //////////////////////////////////////////////////////////////////// 00113 INLINE bool InterrogateFunction:: 00114 has_comment() const { 00115 return !_comment.empty(); 00116 } 00117 00118 //////////////////////////////////////////////////////////////////// 00119 // Function: InterrogateFunction::get_comment 00120 // Access: Public 00121 // Description: 00122 //////////////////////////////////////////////////////////////////// 00123 INLINE const string &InterrogateFunction:: 00124 get_comment() const { 00125 return _comment; 00126 } 00127 00128 //////////////////////////////////////////////////////////////////// 00129 // Function: InterrogateFunction::has_prototype 00130 // Access: Public 00131 // Description: 00132 //////////////////////////////////////////////////////////////////// 00133 INLINE bool InterrogateFunction:: 00134 has_prototype() const { 00135 return !_prototype.empty(); 00136 } 00137 00138 //////////////////////////////////////////////////////////////////// 00139 // Function: InterrogateFunction::get_prototype 00140 // Access: Public 00141 // Description: 00142 //////////////////////////////////////////////////////////////////// 00143 INLINE const string &InterrogateFunction:: 00144 get_prototype() const { 00145 return _prototype; 00146 } 00147 00148 //////////////////////////////////////////////////////////////////// 00149 // Function: InterrogateFunction::number_of_c_wrappers 00150 // Access: Public 00151 // Description: 00152 //////////////////////////////////////////////////////////////////// 00153 INLINE int InterrogateFunction:: 00154 number_of_c_wrappers() const { 00155 return _c_wrappers.size(); 00156 } 00157 00158 //////////////////////////////////////////////////////////////////// 00159 // Function: InterrogateFunction::get_c_wrapper 00160 // Access: Public 00161 // Description: 00162 //////////////////////////////////////////////////////////////////// 00163 INLINE FunctionWrapperIndex InterrogateFunction:: 00164 get_c_wrapper(int n) const { 00165 if (n >= 0 && n < (int)_c_wrappers.size()) { 00166 return _c_wrappers[n]; 00167 } 00168 return 0; 00169 } 00170 00171 //////////////////////////////////////////////////////////////////// 00172 // Function: InterrogateFunction::number_of_python_wrappers 00173 // Access: Public 00174 // Description: 00175 //////////////////////////////////////////////////////////////////// 00176 INLINE int InterrogateFunction:: 00177 number_of_python_wrappers() const { 00178 return _python_wrappers.size(); 00179 } 00180 00181 //////////////////////////////////////////////////////////////////// 00182 // Function: InterrogateFunction::get_python_wrapper 00183 // Access: Public 00184 // Description: 00185 //////////////////////////////////////////////////////////////////// 00186 INLINE FunctionWrapperIndex InterrogateFunction:: 00187 get_python_wrapper(int n) const { 00188 if (n >= 0 && n < (int)_python_wrappers.size()) { 00189 return _python_wrappers[n]; 00190 } 00191 return 0; 00192 } 00193 00194 00195 INLINE ostream & 00196 operator << (ostream &out, const InterrogateFunction &function) { 00197 function.output(out); 00198 return out; 00199 } 00200 00201 INLINE istream & 00202 operator >> (istream &in, InterrogateFunction &function) { 00203 function.input(in); 00204 return in; 00205 }