From 25b6b015b8c6e388ab31d134d64262dfcd5880e6 Mon Sep 17 00:00:00 2001 From: Daniel Chappuis Date: Wed, 10 Jul 2013 00:21:31 +0200 Subject: [PATCH] Add some private copy-constructors and private assignment operators --- src/constraint/BallAndSocketJoint.h | 8 ++++++++ src/constraint/FixedJoint.h | 8 ++++++++ src/constraint/HingeJoint.h | 6 ++++++ src/constraint/SliderJoint.h | 6 ++++++ src/engine/Impulse.h | 32 ++++++++++++++++++++++++----- 5 files changed, 55 insertions(+), 5 deletions(-) diff --git a/src/constraint/BallAndSocketJoint.h b/src/constraint/BallAndSocketJoint.h index 6cd47fa6..3d155afd 100644 --- a/src/constraint/BallAndSocketJoint.h +++ b/src/constraint/BallAndSocketJoint.h @@ -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 -------------------- // diff --git a/src/constraint/FixedJoint.h b/src/constraint/FixedJoint.h index 7f4f987f..7ce30912 100644 --- a/src/constraint/FixedJoint.h +++ b/src/constraint/FixedJoint.h @@ -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 -------------------- // diff --git a/src/constraint/HingeJoint.h b/src/constraint/HingeJoint.h index 33962f0c..782cf834 100644 --- a/src/constraint/HingeJoint.h +++ b/src/constraint/HingeJoint.h @@ -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(); diff --git a/src/constraint/SliderJoint.h b/src/constraint/SliderJoint.h index 6515ffff..454f3385 100644 --- a/src/constraint/SliderJoint.h +++ b/src/constraint/SliderJoint.h @@ -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(); diff --git a/src/engine/Impulse.h b/src/engine/Impulse.h index 5ed9e228..849d90ed 100644 --- a/src/engine/Impulse.h +++ b/src/engine/Impulse.h @@ -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) { +; } };