00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022 INLINE PhysxObject::
00023 PhysxObject() {
00024
00025 _error_type = ET_empty;
00026 }
00027
00028
00029
00030
00031
00032
00033 INLINE PhysxObject::
00034 ~PhysxObject() {
00035
00036 #ifdef HAVE_PYTHON
00037
00038
00039 PythonTagData::const_iterator ti;
00040 for (ti = _python_tag_data.begin(); ti != _python_tag_data.end(); ++ti) {
00041 PyObject *value = (*ti).second;
00042 Py_XDECREF(value);
00043 }
00044 #endif // HAVE_PYTHON
00045 }
00046
00047 #ifdef HAVE_PYTHON
00048
00049
00050
00051
00052
00053 INLINE bool PhysxObject::
00054 has_python_tags() const {
00055
00056 return _python_tag_data.empty() ? false : true;
00057 }
00058
00059
00060
00061
00062
00063
00064 INLINE void PhysxObject::
00065 set_python_tag(const string &key, PyObject *value) {
00066
00067 Py_XINCREF(value);
00068
00069 pair<PythonTagData::iterator, bool> result;
00070 result = _python_tag_data.insert(PythonTagData::value_type(key, value));
00071
00072 if (!result.second) {
00073
00074
00075
00076
00077 PythonTagData::iterator ti = result.first;
00078 PyObject *old_value = (*ti).second;
00079 Py_XDECREF(old_value);
00080 (*ti).second = value;
00081 }
00082 }
00083
00084
00085
00086
00087
00088
00089 INLINE PyObject *PhysxObject::
00090 get_python_tag(const string &key) const {
00091
00092 PythonTagData::const_iterator ti;
00093 ti = _python_tag_data.find(key);
00094
00095 if (ti != _python_tag_data.end()) {
00096 PyObject *result = (*ti).second;
00097 Py_XINCREF(result);
00098 return result;
00099 }
00100
00101 Py_INCREF(Py_None);
00102 return Py_None;
00103 }
00104
00105
00106
00107
00108
00109
00110 INLINE bool PhysxObject::
00111 has_python_tag(const string &key) const {
00112
00113 PythonTagData::const_iterator ti;
00114 ti = _python_tag_data.find(key);
00115 return (ti != _python_tag_data.end());
00116 }
00117
00118
00119
00120
00121
00122
00123 INLINE void PhysxObject::
00124 clear_python_tag(const string &key) {
00125
00126 PythonTagData::iterator ti;
00127 ti = _python_tag_data.find(key);
00128
00129 if (ti != _python_tag_data.end()) {
00130 PyObject *value = (*ti).second;
00131 Py_XDECREF(value);
00132 _python_tag_data.erase(ti);
00133 }
00134 }
00135 #endif // HAVE_PYTHON
00136