Panda3D
|
00001 // Filename: physxObject.h 00002 // Created by: enn0x (11Sep09) 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 #ifndef PHYSXOBJECT_H 00016 #define PHYSXOBJECT_H 00017 00018 #include "pandabase.h" 00019 #include "typedReferenceCount.h" 00020 00021 #ifdef HAVE_PYTHON 00022 #undef _POSIX_C_SOURCE 00023 #include <Python.h> 00024 #endif // HAVE_PYTHON 00025 00026 //////////////////////////////////////////////////////////////////// 00027 // Class : PhysxObject 00028 // Description : 00029 //////////////////////////////////////////////////////////////////// 00030 class EXPCL_PANDAPHYSX PhysxObject : public TypedReferenceCount { 00031 00032 #ifdef HAVE_PYTHON 00033 PUBLISHED: 00034 INLINE void set_python_tag(const string &key, PyObject *value); 00035 INLINE PyObject *get_python_tag(const string &key) const; 00036 INLINE bool has_python_tag(const string &key) const; 00037 INLINE void clear_python_tag(const string &key); 00038 INLINE bool has_python_tags() const; 00039 #endif // HAVE_PYTHON 00040 00041 PUBLISHED: 00042 virtual void ls() const = 0; 00043 virtual void ls(ostream &out, int indent_level=0) const = 0; 00044 00045 protected: 00046 INLINE PhysxObject(); 00047 INLINE ~PhysxObject(); 00048 00049 enum ErrorType { 00050 ET_empty, 00051 ET_ok, 00052 ET_released, 00053 ET_fail, 00054 }; 00055 00056 ErrorType _error_type; 00057 00058 #ifdef HAVE_PYTHON 00059 private: 00060 typedef phash_map<string, PyObject *, string_hash> PythonTagData; 00061 PythonTagData _python_tag_data; 00062 #endif // HAVE_PYTHON 00063 00064 //////////////////////////////////////////////////////////////////// 00065 public: 00066 static TypeHandle get_class_type() { 00067 return _type_handle; 00068 } 00069 static void init_type() { 00070 TypedReferenceCount::init_type(); 00071 register_type(_type_handle, "PhysxObject", 00072 TypedReferenceCount::get_class_type()); 00073 } 00074 virtual TypeHandle get_type() const { 00075 return get_class_type(); 00076 } 00077 virtual TypeHandle force_init_type() { 00078 init_type(); 00079 return get_class_type(); 00080 } 00081 00082 private: 00083 static TypeHandle _type_handle; 00084 }; 00085 00086 #include "physxObject.I" 00087 00088 #endif // PHYSXOBJECT_H