00001 // Filename: interrogateComponent.I 00002 // Created by: drose (08Aug00) 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: InterrogateComponent::Constructor 00022 // Access: Public 00023 // Description: 00024 //////////////////////////////////////////////////////////////////// 00025 INLINE InterrogateComponent:: 00026 InterrogateComponent(InterrogateModuleDef *def) : 00027 _def(def) 00028 { 00029 } 00030 00031 //////////////////////////////////////////////////////////////////// 00032 // Function: InterrogateComponent::Copy Constructor 00033 // Access: Public 00034 // Description: 00035 //////////////////////////////////////////////////////////////////// 00036 INLINE InterrogateComponent:: 00037 InterrogateComponent(const InterrogateComponent ©) : 00038 _def(copy._def), 00039 _name(copy._name) 00040 { 00041 } 00042 00043 //////////////////////////////////////////////////////////////////// 00044 // Function: InterrogateComponent::Copy Assignment Operator 00045 // Access: Public 00046 // Description: 00047 //////////////////////////////////////////////////////////////////// 00048 INLINE void InterrogateComponent:: 00049 operator = (const InterrogateComponent ©) { 00050 _def = copy._def; 00051 _name = copy._name; 00052 } 00053 00054 //////////////////////////////////////////////////////////////////// 00055 // Function: InterrogateComponent::has_library_name 00056 // Access: Public 00057 // Description: Returns true if we have a known library name, false if 00058 // we do not. See get_library_name(). 00059 //////////////////////////////////////////////////////////////////// 00060 INLINE bool InterrogateComponent:: 00061 has_library_name() const { 00062 const char *name = get_library_name(); 00063 return (name != (const char *)NULL && name[0] != '\0'); 00064 } 00065 00066 //////////////////////////////////////////////////////////////////// 00067 // Function: InterrogateComponent::get_library_name 00068 // Access: Public 00069 // Description: Returns the library name, if it is known, or NULL if 00070 // it is not. This is the name of the library that this 00071 // particular component was built into. Typically this 00072 // will be a one-to-one correspondance with an 00073 // invocation of the interrogate command. Typical 00074 // examples are "libutil" and "liblinmath". 00075 //////////////////////////////////////////////////////////////////// 00076 INLINE const char *InterrogateComponent:: 00077 get_library_name() const { 00078 if (_def != (InterrogateModuleDef *)NULL) { 00079 return _def->library_name; 00080 } 00081 return (const char *)NULL; 00082 } 00083 00084 //////////////////////////////////////////////////////////////////// 00085 // Function: InterrogateComponent::has_module_name 00086 // Access: Public 00087 // Description: Returns true if we have a known module name, false if 00088 // we do not. See get_module_name(). 00089 //////////////////////////////////////////////////////////////////// 00090 INLINE bool InterrogateComponent:: 00091 has_module_name() const { 00092 const char *name = get_module_name(); 00093 return (name != (const char *)NULL && name[0] != '\0'); 00094 } 00095 00096 //////////////////////////////////////////////////////////////////// 00097 // Function: InterrogateComponent::get_module_name 00098 // Access: Public 00099 // Description: Returns the module name, if it is known, or NULL if 00100 // it is not. This is the name of the module that this 00101 // particular component is associated with. This is a 00102 // higher grouping than library. Typical examples are 00103 // "panda" and "pandaegg". 00104 //////////////////////////////////////////////////////////////////// 00105 INLINE const char *InterrogateComponent:: 00106 get_module_name() const { 00107 if (_def != (InterrogateModuleDef *)NULL) { 00108 return _def->module_name; 00109 } 00110 return (const char *)NULL; 00111 } 00112 00113 //////////////////////////////////////////////////////////////////// 00114 // Function: InterrogateComponent::has_name 00115 // Access: Public 00116 // Description: 00117 //////////////////////////////////////////////////////////////////// 00118 INLINE bool InterrogateComponent:: 00119 has_name() const { 00120 return !_name.empty(); 00121 } 00122 00123 //////////////////////////////////////////////////////////////////// 00124 // Function: InterrogateComponent::get_name 00125 // Access: Public 00126 // Description: 00127 //////////////////////////////////////////////////////////////////// 00128 INLINE const string &InterrogateComponent:: 00129 get_name() const { 00130 return _name; 00131 }