Panda3D
odeJoint.I
1 // Filename: odeJoint.I
2 // Created by: joswilso (27Dec06)
3 //
4 ////////////////////////////////////////////////////////////////////
5 //
6 // PANDA 3D SOFTWARE
7 // Copyright (c) Carnegie Mellon University. All rights reserved.
8 //
9 // All use of this software is subject to the terms of the revised BSD
10 // license. You should have received a copy of this license along
11 // with this source code in a file named "LICENSE."
12 //
13 ////////////////////////////////////////////////////////////////////
14 
15 ////////////////////////////////////////////////////////////////////
16 // Function: OdeJoint::is_empty
17 // Access: Published
18 // Description: Returns true if the ID is 0, meaning the OdeJoint
19 // does not point to a valid joint. It is an error to
20 // call a method on an empty joint.
21 // Note that an empty OdeJoint also evaluates to False.
22 ////////////////////////////////////////////////////////////////////
23 INLINE bool OdeJoint::
24 is_empty() const {
25  return (_id == 0);
26 }
27 
28 ////////////////////////////////////////////////////////////////////
29 // Function: OdeJoint::get_id
30 // Access: Published
31 // Description: Returns the underlying dJointID.
32 ////////////////////////////////////////////////////////////////////
33 INLINE dJointID OdeJoint::
34 get_id() const {
35  return _id;
36 }
37 
38 /*
39 INLINE void OdeJoint::
40 set_data(void *data) {
41  dJointSetData(_id, data);
42 }
43 
44 INLINE void *OdeJoint::
45 get_data() {
46  return dJointGetData(_id);
47 }
48 */
49 
50 INLINE int OdeJoint::
51 get_joint_type() const {
52  return dJointGetType(_id);
53 }
54 
55 INLINE void OdeJoint::
56 set_feedback(bool flag) {
57  if (flag) {
58  if (dJointGetFeedback(_id) != NULL) {
59  return;
60  }
61  OdeJointFeedback* feedback = new OdeJointFeedback;
62  dJointSetFeedback(_id, (dJointFeedback*) feedback);
63  } else if (dJointFeedback* feedback = dJointGetFeedback(_id)) {
64  dJointSetFeedback(_id, NULL);
65  delete feedback;
66  }
67 }
68 
69 INLINE void OdeJoint::
70 set_feedback(OdeJointFeedback *feedback) {
71  dJointSetFeedback(_id, feedback);
72 }
73 
74 INLINE OdeJointFeedback *OdeJoint::
75 get_feedback() {
76  return (OdeJointFeedback*) dJointGetFeedback(_id);
77 }
78 
79 INLINE int OdeJoint::
80 compare_to(const OdeJoint &other) const {
81  if (_id != other._id) {
82  return _id < other._id ? -1 : 1;
83  }
84  return 0;
85 }
86 
87 INLINE bool OdeJoint::
88 operator == (const OdeJoint &other) const {
89  return _id == other._id;
90 }
dJointID get_id() const
Returns the underlying dJointID.
Definition: odeJoint.I:34
bool is_empty() const
Returns true if the ID is 0, meaning the OdeJoint does not point to a valid joint.
Definition: odeJoint.I:24