Add some private copy-constructors and private assignment operators

This commit is contained in:
Daniel Chappuis 2013-07-10 00:21:31 +02:00
parent 9d9142af30
commit 25b6b015b8
5 changed files with 55 additions and 5 deletions

View File

@ -96,6 +96,14 @@ class BallAndSocketJoint : public Constraint {
/// Accumulated impulse
Vector3 mImpulse;
// -------------------- Methods -------------------- //
/// Private copy-constructor
BallAndSocketJoint(const BallAndSocketJoint& constraint);
/// Private assignment operator
BallAndSocketJoint& operator=(const BallAndSocketJoint& constraint);
public :
// -------------------- Methods -------------------- //

View File

@ -108,6 +108,14 @@ class FixedJoint : public Constraint {
/// Inverse of the initial orientation difference between the two bodies
Quaternion mInitOrientationDifferenceInv;
// -------------------- Methods -------------------- //
/// Private copy-constructor
FixedJoint(const FixedJoint& constraint);
/// Private assignment operator
FixedJoint& operator=(const FixedJoint& constraint);
public :
// -------------------- Methods -------------------- //

View File

@ -223,6 +223,12 @@ class HingeJoint : public Constraint {
// -------------------- Methods -------------------- //
/// Private copy-constructor
HingeJoint(const HingeJoint& constraint);
/// Private assignment operator
HingeJoint& operator=(const HingeJoint& constraint);
/// Reset the limits
void resetLimits();

View File

@ -236,6 +236,12 @@ class SliderJoint : public Constraint {
// -------------------- Methods -------------------- //
/// Private copy-constructor
SliderJoint(const SliderJoint& constraint);
/// Private assignment operator
SliderJoint& operator=(const SliderJoint& constraint);
/// Reset the limits
void resetLimits();

View File

@ -37,8 +37,17 @@ namespace reactphysics3d {
*/
struct Impulse {
private:
// -------------------- Methods -------------------- //
/// Private assignment operator
Impulse& operator=(const Impulse& impulse);
public:
// -------------------- Attributes -------------------- //
/// Linear impulse applied to the first body
const Vector3 linearImpulseBody1;
@ -51,12 +60,25 @@ struct Impulse {
/// Angular impulse applied to the second body
const Vector3 angularImpulseBody2;
/// Constructor
Impulse(const Vector3& linearImpulseBody1, const Vector3& angularImpulseBody1,
const Vector3& linearImpulseBody2, const Vector3& angularImpulseBody2)
: linearImpulseBody1(linearImpulseBody1), angularImpulseBody1(angularImpulseBody1),
linearImpulseBody2(linearImpulseBody2), angularImpulseBody2(angularImpulseBody2) {
// -------------------- Methods -------------------- //
/// Constructor
Impulse(const Vector3& initLinearImpulseBody1, const Vector3& initAngularImpulseBody1,
const Vector3& initLinearImpulseBody2, const Vector3& initAngularImpulseBody2)
: linearImpulseBody1(initLinearImpulseBody1),
angularImpulseBody1(initAngularImpulseBody1),
linearImpulseBody2(initLinearImpulseBody2),
angularImpulseBody2(initAngularImpulseBody2) {
}
/// Copy-constructor
Impulse(const Impulse& impulse)
: linearImpulseBody1(impulse.linearImpulseBody1),
angularImpulseBody1(impulse.angularImpulseBody1),
linearImpulseBody2(impulse.linearImpulseBody2),
angularImpulseBody2(impulse.angularImpulseBody2) {
;
}
};