Skip to content

Commit

Permalink
Remove explicitly-defined copy constructor/operator (#328)
Browse files Browse the repository at this point in the history
Backport from main.

Signed-off-by: Michael Carroll <michael@openrobotics.org>
  • Loading branch information
mjcarroll authored and scpeters committed Mar 10, 2022
1 parent 422a313 commit 116e9ac
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 107 deletions.
70 changes: 0 additions & 70 deletions tpe/lib/src/Shape.cc
Original file line number Diff line number Diff line change
Expand Up @@ -56,27 +56,6 @@ BoxShape::BoxShape() : Shape()
this->type = ShapeType::BOX;
}

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

//////////////////////////////////////////////////
BoxShape::~BoxShape()
{
}

//////////////////////////////////////////////////
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 @@ -103,22 +82,6 @@ CylinderShape::CylinderShape() : Shape()
this->type = ShapeType::CYLINDER;
}

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

//////////////////////////////////////////////////
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 @@ -158,21 +121,6 @@ SphereShape::SphereShape() : Shape()
this->type = ShapeType::SPHERE;
}

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

//////////////////////////////////////////////////
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 @@ -199,22 +147,6 @@ MeshShape::MeshShape() : Shape()
this->type = ShapeType::MESH;
}

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

//////////////////////////////////////////////////
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 Expand Up @@ -245,5 +177,3 @@ void MeshShape::UpdateBoundingBox()
this->bbox = math::AxisAlignedBox(
this->scale * this->meshAABB.Min(), this->scale * this->meshAABB.Max());
}


42 changes: 5 additions & 37 deletions tpe/lib/src/Shape.hh
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ class IGNITION_PHYSICS_TPELIB_VISIBLE Shape
public: Shape();

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

/// \brief Get bounding box of shape
/// \return Shape's bounding box
Expand Down Expand Up @@ -92,16 +92,8 @@ class IGNITION_PHYSICS_TPELIB_VISIBLE BoxShape : public Shape
/// \brief Constructor
public: BoxShape();

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

/// \brief Destructor
public: ~BoxShape();

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

/// \brief Set size of box
/// \param[in] _size Size of box
Expand All @@ -126,16 +118,8 @@ class IGNITION_PHYSICS_TPELIB_VISIBLE CylinderShape : public Shape
/// \brief Constructor
public: CylinderShape();

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

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

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

/// \brief Get cylinder radius
/// \return cylinder radius
Expand Down Expand Up @@ -169,16 +153,8 @@ class IGNITION_PHYSICS_TPELIB_VISIBLE SphereShape : public Shape
/// \brief Constructor
public: SphereShape();

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

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

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

/// \brief Get sphere radius
/// \return Sphere radius
Expand All @@ -201,16 +177,8 @@ class IGNITION_PHYSICS_TPELIB_VISIBLE MeshShape : public Shape
/// \brief Constructor
public: MeshShape();

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

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

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

/// \brief Set mesh
/// \param[in] _mesh Mesh object
Expand Down

0 comments on commit 116e9ac

Please sign in to comment.