Panda3D
|
00001 // Filename: typedObject.I 00002 // Created by: drose (11May01) 00003 // 00004 //////////////////////////////////////////////////////////////////// 00005 // 00006 // PANDA 3D SOFTWARE 00007 // Copyright (c) Carnegie Mellon University. All rights reserved. 00008 // 00009 // All use of this software is subject to the terms of the revised BSD 00010 // license. You should have received a copy of this license along 00011 // with this source code in a file named "LICENSE." 00012 // 00013 //////////////////////////////////////////////////////////////////// 00014 00015 00016 //////////////////////////////////////////////////////////////////// 00017 // Function: TypedObject::Constructor 00018 // Access: Public 00019 // Description: 00020 //////////////////////////////////////////////////////////////////// 00021 INLINE TypedObject:: 00022 TypedObject() { 00023 } 00024 00025 //////////////////////////////////////////////////////////////////// 00026 // Function: TypedObject::Copy Constructor 00027 // Access: Public 00028 // Description: 00029 //////////////////////////////////////////////////////////////////// 00030 INLINE TypedObject:: 00031 TypedObject(const TypedObject &) { 00032 } 00033 00034 //////////////////////////////////////////////////////////////////// 00035 // Function: TypedObject::Copy Assignment Operator 00036 // Access: Public 00037 // Description: 00038 //////////////////////////////////////////////////////////////////// 00039 INLINE void TypedObject:: 00040 operator = (const TypedObject &) { 00041 } 00042 00043 //////////////////////////////////////////////////////////////////// 00044 // Function: TypedObject::get_type_index 00045 // Access: Published 00046 // Description: Returns the internal index number associated with 00047 // this object's TypeHandle, a unique number for each 00048 // different type. This is equivalent to 00049 // get_type().get_index(). 00050 //////////////////////////////////////////////////////////////////// 00051 INLINE int TypedObject:: 00052 get_type_index() const { 00053 return get_type().get_index(); 00054 } 00055 00056 //////////////////////////////////////////////////////////////////// 00057 // Function: TypedObject::is_of_type 00058 // Access: Published 00059 // Description: Returns true if the current object is or derives from 00060 // the indicated type. 00061 //////////////////////////////////////////////////////////////////// 00062 INLINE bool TypedObject:: 00063 is_of_type(TypeHandle handle) const { 00064 return get_type().is_derived_from(handle, (TypedObject *)this); 00065 } 00066 00067 //////////////////////////////////////////////////////////////////// 00068 // Function: TypedObject::is_exact_type 00069 // Access: Published 00070 // Description: Returns true if the current object is the indicated 00071 // type exactly. 00072 //////////////////////////////////////////////////////////////////// 00073 INLINE bool TypedObject:: 00074 is_exact_type(TypeHandle handle) const { 00075 #ifndef NDEBUG 00076 // Call get_name() to force the type to look itself up if necessary. 00077 get_type().get_name((TypedObject *)this); 00078 #endif 00079 return get_type() == handle; 00080 } 00081 00082 //////////////////////////////////////////////////////////////////// 00083 // Function: TypedObject::get_best_parent_from_Set 00084 // Access: Public 00085 // Description: 00086 //////////////////////////////////////////////////////////////////// 00087 INLINE int TypedObject:: 00088 get_best_parent_from_Set(const std::set<int> &inset) const { 00089 return get_type().get_best_parent_from_Set(inset); 00090 } 00091 00092 //////////////////////////////////////////////////////////////////// 00093 // Function: TypedObject::as_typed_object 00094 // Access: Public 00095 // Description: Returns the object, upcast (if necessary) to a 00096 // TypedObject pointer. 00097 //////////////////////////////////////////////////////////////////// 00098 INLINE TypedObject *TypedObject:: 00099 as_typed_object() { 00100 return this; 00101 } 00102 00103 //////////////////////////////////////////////////////////////////// 00104 // Function: TypedObject::as_typed_object 00105 // Access: Public 00106 // Description: Returns the object, upcast (if necessary) to a 00107 // TypedObject pointer. 00108 //////////////////////////////////////////////////////////////////// 00109 INLINE const TypedObject *TypedObject:: 00110 as_typed_object() const { 00111 return this; 00112 } 00113