Skip to content

Commit

Permalink
Fix Actor.cc copy operators and restructure tests (gazebosim#301)
Browse files Browse the repository at this point in the history
* Simplify and fix copy constructors, restructure tests and increase coverage
* Add joint and link tests
* Add changelog

Signed-off-by: Luca Della Vedova <[email protected]>

Co-authored-by: Ian Chen <[email protected]>
Co-authored-by: Steve Peters <[email protected]>
  • Loading branch information
3 people committed Aug 25, 2020
1 parent 706f867 commit 021eb8b
Show file tree
Hide file tree
Showing 5 changed files with 387 additions and 225 deletions.
6 changes: 6 additions & 0 deletions Changelog.md
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,9 @@
1. Find python3 in cmake, fix cmake warning.
* [Pull request 328](https://github.com/osrf/sdformat/pull/328)

1. Fix Actor copy operators and increase test coverage.
* [Pull request 301](https://github.com/osrf/sdformat/pull/301)

1. Change bitbucket links to GitHub.
* [Pull request 240](https://github.com/osrf/sdformat/pull/240)

Expand Down Expand Up @@ -259,6 +262,9 @@

### libsdformat 8.X.X (202X-XX-XX)

1. Fix Actor copy operators and increase test coverage.
* [Pull request 301](https://github.com/osrf/sdformat/pull/301)

1. Increase output precision of URDF to SDF conversion, output -0 as 0.
* [BitBucket pull request 675](https://osrf-migration.github.io/sdformat-gh-pages/#!/osrf/sdformat/pull-requests/675)

Expand Down
16 changes: 8 additions & 8 deletions src/Actor.cc
Original file line number Diff line number Diff line change
Expand Up @@ -129,9 +129,8 @@ Animation::~Animation()

//////////////////////////////////////////////////
Animation::Animation(const Animation &_animation)
: dataPtr(new AnimationPrivate)
: dataPtr(new AnimationPrivate(*_animation.dataPtr))
{
this->CopyFrom(_animation);
}

/////////////////////////////////////////////////
Expand All @@ -156,6 +155,7 @@ Animation &Animation::operator=(Animation &&_animation)
/////////////////////////////////////////////////
void Animation::CopyFrom(const Animation &_animation)
{
// TODO(anyone) Deprecate function
this->dataPtr->name = _animation.dataPtr->name;
this->dataPtr->filename = _animation.dataPtr->filename;
this->dataPtr->scale = _animation.dataPtr->scale;
Expand Down Expand Up @@ -269,9 +269,8 @@ Waypoint::~Waypoint()

//////////////////////////////////////////////////
Waypoint::Waypoint(const Waypoint &_waypoint)
: dataPtr(new WaypointPrivate)
: dataPtr(new WaypointPrivate(*_waypoint.dataPtr))
{
this->CopyFrom(_waypoint);
}

/////////////////////////////////////////////////
Expand All @@ -296,6 +295,7 @@ Waypoint &Waypoint::operator=(Waypoint &&_waypoint)
/////////////////////////////////////////////////
void Waypoint::CopyFrom(const Waypoint &_waypoint)
{
// TODO(anyone) deprecate function
this->dataPtr->time = _waypoint.dataPtr->time;
this->dataPtr->pose = _waypoint.dataPtr->pose;
}
Expand Down Expand Up @@ -364,9 +364,8 @@ Trajectory::~Trajectory()

//////////////////////////////////////////////////
Trajectory::Trajectory(const Trajectory &_trajectory)
: dataPtr(new TrajectoryPrivate)
: dataPtr(new TrajectoryPrivate(*_trajectory.dataPtr))
{
this->CopyFrom(_trajectory);
}

/////////////////////////////////////////////////
Expand All @@ -391,6 +390,7 @@ Trajectory &Trajectory::operator=(Trajectory &&_trajectory)
/////////////////////////////////////////////////
void Trajectory::CopyFrom(const Trajectory &_trajectory)
{
// TODO(anyone) deprecate function
this->dataPtr->id = _trajectory.dataPtr->id;
this->dataPtr->type = _trajectory.dataPtr->type;
this->dataPtr->tension = _trajectory.dataPtr->tension;
Expand Down Expand Up @@ -501,9 +501,8 @@ Actor::~Actor()

//////////////////////////////////////////////////
Actor::Actor(const Actor &_actor)
: dataPtr(new ActorPrivate)
: dataPtr(new ActorPrivate(*_actor.dataPtr))
{
this->CopyFrom(_actor);
}

/////////////////////////////////////////////////
Expand All @@ -528,6 +527,7 @@ Actor &Actor::operator=(Actor &&_actor)
//////////////////////////////////////////////////
void Actor::CopyFrom(const Actor &_actor)
{
// TODO(anyone) deprecate function
this->dataPtr->name = _actor.dataPtr->name;
this->dataPtr->pose = _actor.dataPtr->pose;
this->dataPtr->poseRelativeTo = _actor.dataPtr->poseRelativeTo;
Expand Down
Loading

0 comments on commit 021eb8b

Please sign in to comment.