Skip to content

Commit

Permalink
Remove explicitly-defined copy constructor/operator (gazebosim#328)
Browse files Browse the repository at this point in the history
Signed-off-by: Michael Carroll <[email protected]>
  • Loading branch information
mjcarroll authored and azeey committed Mar 28, 2022
1 parent 2ba126c commit 78c6e1f
Show file tree
Hide file tree
Showing 2 changed files with 1 addition and 103 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());
}


34 changes: 1 addition & 33 deletions tpe/lib/src/Shape.hh
Original file line number Diff line number Diff line change
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: ~BoxShape() = default;

/// \brief Set size of box
/// \param[in] _size Size of box
Expand All @@ -126,17 +118,9 @@ 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);

/// \brief Get cylinder radius
/// \return cylinder radius
public: double GetRadius() const;
Expand Down Expand Up @@ -169,17 +153,9 @@ 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);

/// \brief Get sphere radius
/// \return Sphere radius
public: double GetRadius() const;
Expand All @@ -201,17 +177,9 @@ 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);

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

0 comments on commit 78c6e1f

Please sign in to comment.