Panda3D
odeJoint.I
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 odeJoint.I
10  * @author joswilso
11  * @date 2006-12-27
12  */
13 
14 /**
15  * Returns true if the ID is 0, meaning the OdeJoint does not point to a valid
16  * joint. It is an error to call a method on an empty joint. Note that an
17  * empty OdeJoint also evaluates to False.
18  */
19 INLINE bool OdeJoint::
20 is_empty() const {
21  return (_id == 0);
22 }
23 
24 /**
25  * Returns the underlying dJointID.
26  */
27 INLINE dJointID OdeJoint::
28 get_id() const {
29  return _id;
30 }
31 
32 /*
33 INLINE void OdeJoint::
34 set_data(void *data) {
35  dJointSetData(_id, data);
36 }
37 
38 INLINE void *OdeJoint::
39 get_data() {
40  return dJointGetData(_id);
41 }
42 */
43 
44 INLINE int OdeJoint::
45 get_joint_type() const {
46  return dJointGetType(_id);
47 }
48 
49 INLINE void OdeJoint::
50 set_feedback(bool flag) {
51  if (flag) {
52  if (dJointGetFeedback(_id) != nullptr) {
53  return;
54  }
55  OdeJointFeedback* feedback = new OdeJointFeedback;
56  dJointSetFeedback(_id, (dJointFeedback*) feedback);
57  } else if (dJointFeedback* feedback = dJointGetFeedback(_id)) {
58  dJointSetFeedback(_id, nullptr);
59  delete feedback;
60  }
61 }
62 
63 INLINE void OdeJoint::
64 set_feedback(OdeJointFeedback *feedback) {
65  dJointSetFeedback(_id, feedback);
66 }
67 
68 INLINE OdeJointFeedback *OdeJoint::
69 get_feedback() {
70  return (OdeJointFeedback*) dJointGetFeedback(_id);
71 }
72 
73 INLINE int OdeJoint::
74 compare_to(const OdeJoint &other) const {
75  if (_id != other._id) {
76  return _id < other._id ? -1 : 1;
77  }
78  return 0;
79 }
80 
81 INLINE bool OdeJoint::
82 operator == (const OdeJoint &other) const {
83  return _id == other._id;
84 }
dJointID get_id() const
Returns the underlying dJointID.
Definition: odeJoint.I:28
bool is_empty() const
Returns true if the ID is 0, meaning the OdeJoint does not point to a valid joint.
Definition: odeJoint.I:20