Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Remove explicitly-defined copy constructor/operator #328

Merged
merged 2 commits into from
Mar 10, 2022
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
67 changes: 1 addition & 66 deletions tpe/lib/src/Shape.cc
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
*
* limitations under the License.
*
*/
Expand Down Expand Up @@ -56,15 +57,6 @@ BoxShape::BoxShape() : Shape()
this->type = ShapeType::BOX;
}

//////////////////////////////////////////////////
Shape &BoxShape::operator=(const Shape &_other)
{
auto other = static_cast<const BoxShape *>(&_other);
this->size = other->size;
this->type = ShapeType::BOX;
return *this;
}

//////////////////////////////////////////////////
void BoxShape::SetSize(const math::Vector3d &_size)
{
Expand All @@ -91,22 +83,6 @@ CapsuleShape::CapsuleShape() : Shape()
this->type = ShapeType::CAPSULE;
}

//////////////////////////////////////////////////
CapsuleShape::CapsuleShape(const CapsuleShape &_other)
: Shape()
{
*this = _other;
}

//////////////////////////////////////////////////
Shape &CapsuleShape::operator=(const Shape &_other)
{
auto other = static_cast<const CapsuleShape *>(&_other);
this->radius = other->radius;
this->length = other->length;
return *this;
}

//////////////////////////////////////////////////
double CapsuleShape::GetRadius() const
{
Expand Down Expand Up @@ -146,15 +122,6 @@ CylinderShape::CylinderShape() : Shape()
this->type = ShapeType::CYLINDER;
}

//////////////////////////////////////////////////
Shape &CylinderShape::operator=(const Shape &_other)
{
auto other = static_cast<const CylinderShape *>(&_other);
this->radius = other->radius;
this->length = other->length;
return *this;
}

//////////////////////////////////////////////////
double CylinderShape::GetRadius() const
{
Expand Down Expand Up @@ -194,21 +161,6 @@ EllipsoidShape::EllipsoidShape() : Shape()
this->type = ShapeType::ELLIPSOID;
}

//////////////////////////////////////////////////
EllipsoidShape::EllipsoidShape(const EllipsoidShape &_other)
: Shape()
{
*this = _other;
}

//////////////////////////////////////////////////
Shape &EllipsoidShape::operator=(const Shape &_other)
{
auto other = static_cast<const EllipsoidShape *>(&_other);
this->radii = other->radii;
return *this;
}

//////////////////////////////////////////////////
math::Vector3d EllipsoidShape::GetRadii() const
{
Expand All @@ -235,14 +187,6 @@ SphereShape::SphereShape() : Shape()
this->type = ShapeType::SPHERE;
}

//////////////////////////////////////////////////
Shape &SphereShape::operator=(const Shape &_other)
{
auto other = static_cast<const SphereShape *>(&_other);
this->radius = other->radius;
return *this;
}

//////////////////////////////////////////////////
double SphereShape::GetRadius() const
{
Expand All @@ -269,15 +213,6 @@ MeshShape::MeshShape() : Shape()
this->type = ShapeType::MESH;
}

//////////////////////////////////////////////////
Shape &MeshShape::operator=(const Shape &_other)
{
auto other = static_cast<const MeshShape *>(&_other);
this->scale = other->scale;
this->meshAABB = other->meshAABB;
return *this;
}

//////////////////////////////////////////////////
math::Vector3d MeshShape::GetScale() const
{
Expand Down
32 changes: 0 additions & 32 deletions tpe/lib/src/Shape.hh
Original file line number Diff line number Diff line change
Expand Up @@ -101,10 +101,6 @@ class IGNITION_PHYSICS_TPELIB_VISIBLE BoxShape : public Shape
/// \brief Destructor
public: virtual ~BoxShape() = default;

/// \brief Assignment operator
/// \param[in] _other shape to copy from
public: Shape &operator=(const Shape &_other);

/// \brief Set size of box
/// \param[in] _size Size of box
public: void SetSize(const math::Vector3d &_size);
Expand All @@ -128,17 +124,9 @@ class IGNITION_PHYSICS_TPELIB_VISIBLE CapsuleShape : public Shape
/// \brief Constructor
public: CapsuleShape();

/// \brief Copy Constructor
/// \param[in] _other shape to copy from
public: CapsuleShape(const CapsuleShape &_other);

/// \brief Destructor
public: ~CapsuleShape() = default;

/// \brief Assignment operator
/// \param[in] _other shape to copy from
public: Shape &operator=(const Shape &_other);

/// \brief Get capsule radius
/// \return capsule radius
public: double GetRadius() const;
Expand Down Expand Up @@ -174,10 +162,6 @@ class IGNITION_PHYSICS_TPELIB_VISIBLE CylinderShape : public Shape
/// \brief Destructor
public: virtual ~CylinderShape() = default;

/// \brief Assignment operator
/// \param[in] _other shape to copy from
public: Shape &operator=(const Shape &_other);

/// \brief Get cylinder radius
/// \return cylinder radius
public: double GetRadius() const;
Expand Down Expand Up @@ -210,17 +194,9 @@ class IGNITION_PHYSICS_TPELIB_VISIBLE EllipsoidShape : public Shape
/// \brief Constructor
public: EllipsoidShape();

/// \brief Copy Constructor
/// \param[in] _other shape to copy from
public: EllipsoidShape(const EllipsoidShape &_other);

/// \brief Destructor
public: ~EllipsoidShape() = default;

/// \brief Assignment operator
/// \param[in] _other shape to copy from
public: Shape &operator=(const Shape &_other);

/// \brief Get ellipsoid radius
/// \return ellipsoid radius
public: math::Vector3d GetRadii() const;
Expand All @@ -247,10 +223,6 @@ class IGNITION_PHYSICS_TPELIB_VISIBLE SphereShape : public Shape
/// \brief Destructor
public: virtual ~SphereShape() = default;

/// \brief Assignment operator
/// \param[in] _other shape to copy from
public: Shape &operator=(const Shape &_other);

/// \brief Get sphere radius
/// \return Sphere radius
public: double GetRadius() const;
Expand All @@ -275,10 +247,6 @@ class IGNITION_PHYSICS_TPELIB_VISIBLE MeshShape : public Shape
/// \brief Destructor
public: virtual ~MeshShape() = default;

/// \brief Assignment operator
/// \param[in] _other shape to copy from
public: Shape &operator=(const Shape &_other);

/// \brief Set mesh
/// \param[in] _mesh Mesh object
public: void SetMesh(const ignition::common::Mesh &_mesh);
Expand Down