00001 // Filename: typedObject.I 00002 // Created by: drose (11May01) 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: TypedObject::Constructor 00022 // Access: Public 00023 // Description: 00024 //////////////////////////////////////////////////////////////////// 00025 INLINE TypedObject:: 00026 TypedObject() { 00027 } 00028 00029 //////////////////////////////////////////////////////////////////// 00030 // Function: TypedObject::Copy Constructor 00031 // Access: Public 00032 // Description: 00033 //////////////////////////////////////////////////////////////////// 00034 INLINE TypedObject:: 00035 TypedObject(const TypedObject &) { 00036 } 00037 00038 //////////////////////////////////////////////////////////////////// 00039 // Function: TypedObject::Copy Assignment Operator 00040 // Access: Public 00041 // Description: 00042 //////////////////////////////////////////////////////////////////// 00043 INLINE void TypedObject:: 00044 operator = (const TypedObject &) { 00045 } 00046 00047 //////////////////////////////////////////////////////////////////// 00048 // Function: TypedObject::get_type_index 00049 // Access: Public 00050 // Description: Returns the internal index number associated with 00051 // this object's TypeHandle, a unique number for each 00052 // different type. This is equivalent to 00053 // get_type().get_index(). 00054 //////////////////////////////////////////////////////////////////// 00055 INLINE int TypedObject:: 00056 get_type_index() const { 00057 return get_type().get_index(); 00058 } 00059 00060 //////////////////////////////////////////////////////////////////// 00061 // Function: TypedObject::is_of_type 00062 // Access: Public 00063 // Description: Returns true if the current object is or derives from 00064 // the indicated type. 00065 //////////////////////////////////////////////////////////////////// 00066 INLINE bool TypedObject:: 00067 is_of_type(TypeHandle handle) const { 00068 return get_type().is_derived_from(handle, (TypedObject *)this); 00069 } 00070 00071 //////////////////////////////////////////////////////////////////// 00072 // Function: TypedObject::is_exact_type 00073 // Access: Public 00074 // Description: Returns true if the current object is the indicated 00075 // type exactly. 00076 //////////////////////////////////////////////////////////////////// 00077 INLINE bool TypedObject:: 00078 is_exact_type(TypeHandle handle) const { 00079 #ifndef NDEBUG 00080 // Call get_name() to force the type to look itself up if necessary. 00081 get_type().get_name((TypedObject *)this); 00082 #endif 00083 return get_type() == handle; 00084 }