Panda3D
physxObject.h
Go to the documentation of this file.
1 /**
2  * PANDA 3D SOFTWARE
3  * Copyright (c) Carnegie Mellon University. All rights reserved.
4  *
5  * All use of this software is subject to the terms of the revised BSD
6  * license. You should have received a copy of this license along
7  * with this source code in a file named "LICENSE."
8  *
9  * @file physxObject.h
10  * @author enn0x
11  * @date 2009-09-11
12  */
13 
14 #ifndef PHYSXOBJECT_H
15 #define PHYSXOBJECT_H
16 
17 #include "pandabase.h"
18 #include "typedReferenceCount.h"
19 
20 #ifdef HAVE_PYTHON
21 #undef _POSIX_C_SOURCE
22 #include <Python.h>
23 #endif // HAVE_PYTHON
24 
25 /**
26  *
27  */
28 class EXPCL_PANDAPHYSX PhysxObject : public TypedReferenceCount {
29 
30 #ifdef HAVE_PYTHON
31 PUBLISHED:
32  INLINE void set_python_tag(const std::string &key, PyObject *value);
33  INLINE PyObject *get_python_tag(const std::string &key) const;
34  INLINE bool has_python_tag(const std::string &key) const;
35  INLINE void clear_python_tag(const std::string &key);
36  INLINE bool has_python_tags() const;
37 #endif // HAVE_PYTHON
38 
39 PUBLISHED:
40  virtual void ls() const = 0;
41  virtual void ls(std::ostream &out, int indent_level=0) const = 0;
42 
43 protected:
44  INLINE PhysxObject();
45  INLINE ~PhysxObject();
46 
47  enum ErrorType {
48  ET_empty,
49  ET_ok,
50  ET_released,
51  ET_fail,
52  };
53 
54  ErrorType _error_type;
55 
56 #ifdef HAVE_PYTHON
57 private:
58  typedef phash_map<std::string, PyObject *, string_hash> PythonTagData;
59  PythonTagData _python_tag_data;
60 #endif // HAVE_PYTHON
61 
62 public:
63  static TypeHandle get_class_type() {
64  return _type_handle;
65  }
66  static void init_type() {
67  TypedReferenceCount::init_type();
68  register_type(_type_handle, "PhysxObject",
69  TypedReferenceCount::get_class_type());
70  }
71  virtual TypeHandle get_type() const {
72  return get_class_type();
73  }
74  virtual TypeHandle force_init_type() {
75  init_type();
76  return get_class_type();
77  }
78 
79 private:
80  static TypeHandle _type_handle;
81 };
82 
83 #include "physxObject.I"
84 
85 #endif // PHYSXOBJECT_H
pandabase.h
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
register_type
void register_type(TypeHandle &type_handle, const std::string &name)
This inline function is just a convenient way to call TypeRegistry::register_type(),...
Definition: register_type.I:22
PhysxObject
Definition: physxObject.h:28
TypedReferenceCount
A base class for things which need to inherit from both TypedObject and from ReferenceCount.
Definition: typedReferenceCount.h:31
TypeHandle
TypeHandle is the identifier used to differentiate C++ class types.
Definition: typeHandle.h:81
physxObject.I
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
typedReferenceCount.h
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.