Skip to content

Commit

Permalink
make BB usable
Browse files Browse the repository at this point in the history
Signed-off-by: Louise Poubel <[email protected]>
  • Loading branch information
chapulina committed Sep 22, 2021
1 parent 6de3a53 commit b10fea7
Show file tree
Hide file tree
Showing 3 changed files with 102 additions and 0 deletions.
24 changes: 24 additions & 0 deletions include/ignition/rendering/BoundingBox.hh
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,30 @@ inline namespace IGNITION_RENDERING_VERSION_NAMESPACE {
/// position / orientation / size info of the box and its label
class IGNITION_RENDERING_VISIBLE BoundingBox
{
/// \brief Constructor
public: BoundingBox();

/// \brief Copy constructor
/// \param[in] _box BoundingBox to copy.
public: BoundingBox(const BoundingBox &_box);

/// \brief Move constructor
/// \param[in] _box BoundingBox to move.
public: BoundingBox(BoundingBox &&_box) noexcept;

/// \brief Destructor
public: virtual ~BoundingBox();

/// \brief Move assignment operator.
/// \param[in] _box Heightmap box to move.
/// \return Reference to this.
public: BoundingBox &operator=(BoundingBox &&_box);

/// \brief Copy Assignment operator.
/// \param[in] _box The heightmap box to set values from.
/// \return *this
public: BoundingBox &operator=(const BoundingBox &_box);

/// \internal
/// \brief Private data
IGN_COMMON_WARN_IGNORE__DLL_INTERFACE_MISSING
Expand Down
37 changes: 37 additions & 0 deletions src/BoundingBox.cc
Original file line number Diff line number Diff line change
Expand Up @@ -26,3 +26,40 @@ class ignition::rendering::BoundingBoxPrivate
{
};

//////////////////////////////////////////////////
BoundingBox::BoundingBox() :
dataPtr(std::make_unique<BoundingBoxPrivate>())
{
}

/////////////////////////////////////////////////
BoundingBox::~BoundingBox()
{
}

//////////////////////////////////////////////////
BoundingBox::BoundingBox(const BoundingBox &_texture)
: dataPtr(std::make_unique<BoundingBoxPrivate>(*_texture.dataPtr))
{
}

//////////////////////////////////////////////////
BoundingBox::BoundingBox(BoundingBox &&_texture) noexcept
: dataPtr(std::exchange(_texture.dataPtr, nullptr))
{
}

/////////////////////////////////////////////////
BoundingBox &BoundingBox::operator=(
const BoundingBox &_texture)
{
return *this = BoundingBox(_texture);
}

/////////////////////////////////////////////////
BoundingBox &BoundingBox::operator=(BoundingBox &&_texture)
{
std::swap(this->dataPtr, _texture.dataPtr);
return *this;
}

41 changes: 41 additions & 0 deletions src/BoundingBox_TEST.cc
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
/*
* Copyright (C) 2021 Open Source Robotics Foundation
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* 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.
*
*/

#include <gtest/gtest.h>

#include "test_config.h" // NOLINT(build/include)
#include "ignition/rendering/BoundingBox.hh"

using namespace ignition;
using namespace rendering;

class BoundingBoxTest : public testing::Test
{
};

/////////////////////////////////////////////////
TEST(BoundingBoxTest, BoundingBox)
{
BoundingBox box;
}

/////////////////////////////////////////////////
int main(int argc, char **argv)
{
::testing::InitGoogleTest(&argc, argv);
return RUN_ALL_TESTS();
}

0 comments on commit b10fea7

Please sign in to comment.