Skip to content

Commit

Permalink
Fix base class should be explicitly initialized in copy constructor
Browse files Browse the repository at this point in the history
  • Loading branch information
Heiko Thiel committed May 8, 2019
1 parent abda376 commit a0a94de
Show file tree
Hide file tree
Showing 20 changed files with 53 additions and 256 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,6 @@ namespace pcl

public:
ProjectModel (QObject *parent = nullptr);
ProjectModel (const ProjectModel& to_copy);
~ProjectModel ();

ProjectModel (QString project_name, QObject *parent = nullptr);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -69,8 +69,6 @@ namespace pcl

public:
ToolBoxModel (QTreeView* tool_view = nullptr, QTreeView* parameter_view = nullptr, QObject *parent = nullptr);
ToolBoxModel (const ToolBoxModel& to_copy);
~ToolBoxModel ();

void
addTool (ToolFactory* tool_factory);
Expand Down
3 changes: 2 additions & 1 deletion apps/cloud_composer/src/cloud_view.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,8 @@ pcl::cloud_composer::CloudView::CloudView (ProjectModel* model, QWidget* parent)
}

pcl::cloud_composer::CloudView::CloudView (const CloudView& to_copy)
: vis_ (to_copy.vis_)
: QWidget (to_copy)
, vis_ (to_copy.vis_)
, model_ (to_copy.model_)
, qvtk_ (to_copy.qvtk_)
{
Expand Down
4 changes: 0 additions & 4 deletions apps/cloud_composer/src/project_model.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -52,10 +52,6 @@ pcl::cloud_composer::ProjectModel::ProjectModel (QObject* parent)
selected_style_map_.insert (interactor_styles::SELECTED_TRACKBALL, false);
}

pcl::cloud_composer::ProjectModel::ProjectModel (const ProjectModel&)
{
}

pcl::cloud_composer::ProjectModel::~ProjectModel ()
{
work_thread_->quit ();
Expand Down
8 changes: 0 additions & 8 deletions apps/cloud_composer/src/toolbox_model.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -16,14 +16,6 @@ pcl::cloud_composer::ToolBoxModel::ToolBoxModel (QTreeView* tool_view, QTreeView

}

pcl::cloud_composer::ToolBoxModel::ToolBoxModel (const ToolBoxModel&)
{
}

pcl::cloud_composer::ToolBoxModel::~ToolBoxModel ()
{
}

void
pcl::cloud_composer::ToolBoxModel::addTool (ToolFactory* tool_factory)
{
Expand Down
3 changes: 1 addition & 2 deletions apps/modeler/include/pcl/apps/modeler/main_window.h
Original file line number Diff line number Diff line change
Expand Up @@ -128,8 +128,7 @@ namespace pcl
friend class AbstractItem;

MainWindow();
MainWindow(const MainWindow &) {} // copy ctor hidden
MainWindow& operator=(const MainWindow &) { return (*this); } // assign op. hidden
MainWindow(const MainWindow &) = delete;
~MainWindow();

Ui::MainWindow *ui_; // Designer form
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -90,9 +90,6 @@ class Cloud : public Statistics
/// variables of this object are initialized but not set.
Cloud (const Cloud3D& cloud, bool register_stats=false);

/// @brief Destructor
~Cloud ();

/// @brief Equal Operator
/// @details Deep copies all the state of the passed cloud to this cloud.
/// @param cloud The cloud object whose status to be copied to this object
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -60,11 +60,13 @@ class CopyCommand : public Command
has_undo_ = false;
}

/// @brief Destructor
~CopyCommand ()
{
}

/// @brief Copy constructor - commands are non-copyable
CopyCommand (const CopyCommand&) = delete;

/// @brief Equal operator - commands are non-copyable
CopyCommand&
operator= (const CopyCommand&) = delete;

protected:
/// @brief Copy the selected points into the copy buffer.
/// @pre Assumes the constructor was given appropriate pointers to the
Expand All @@ -85,25 +87,6 @@ class CopyCommand : public Command
}

private:
/// @brief Default constructor - object is not default constructable
CopyCommand ()
{
assert(false);
}

/// @brief Copy constructor - commands are non-copyable
CopyCommand (const CopyCommand&)
{
assert(false);
}

/// @brief Equal operator - commands are non-copyable
CopyCommand&
operator= (const CopyCommand&)
{
assert(false); return (*this);
}

/// a pointer to the copy buffer.
CopyBufferPtr copy_buffer_ptr_;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,13 @@ class CutCommand : public Command
SelectionPtr selection_ptr,
CloudPtr cloud_ptr);

/// @brief Copy constructor - commands are non-copyable
CutCommand (const CutCommand&) = delete;

/// @brief Equal operator - commands are non-copyable
CutCommand&
operator= (const CutCommand&) = delete;

/// @brief Destructor
~CutCommand ();

Expand All @@ -73,25 +80,6 @@ class CutCommand : public Command
undo () override;

private:
/// @brief Default constructor - object is not default constructable
CutCommand () : cut_selection_(CloudPtr())
{
assert(false);
}

/// @brief Copy constructor - commands are non-copyable
CutCommand (const CutCommand&) : cut_selection_(CloudPtr())
{
assert(false);
}

/// @brief Equal operator - commands are non-copyable
CutCommand&
operator= (const CutCommand&)
{
assert(false); return (*this);
}

/// A shared pointer pointing to the selection object.
SelectionPtr selection_ptr_;

Expand All @@ -107,5 +95,4 @@ class CutCommand : public Command

/// The copy buffer which backs up the points removed from the cloud.
CopyBuffer cut_cloud_buffer_;

};
Original file line number Diff line number Diff line change
Expand Up @@ -52,12 +52,14 @@ class DeleteCommand : public Command
/// @param selection_ptr A shared pointer pointing to the selection object.
/// @param cloud_ptr A shared pointer pointing to the cloud object.
DeleteCommand (SelectionPtr selection_ptr, CloudPtr cloud_ptr);

/// @brief Destructor
~DeleteCommand ()
{
}


/// @brief Copy constructor - commands are non-copyable
DeleteCommand (const DeleteCommand& c) = delete;

/// @brief Equal operator - commands are non-copyable
DeleteCommand&
operator= (const DeleteCommand&) = delete;

protected:
/// @brief Removes the selected points and maintains a backup for undo.
void
Expand All @@ -68,26 +70,6 @@ class DeleteCommand : public Command
undo () override;

private:
/// @brief Default constructor - object is not default constructable
DeleteCommand (): deleted_selection_(CloudPtr())
{
assert(false);
}

/// @brief Copy constructor - commands are non-copyable
DeleteCommand (const DeleteCommand& c)
: deleted_selection_(c.deleted_selection_)
{
assert(false);
}

/// @brief Equal operator - commands are non-copyable
DeleteCommand&
operator= (const DeleteCommand&)
{
assert(false); return (*this);
}

/// a pointer pointing to the cloud
CloudPtr cloud_ptr_;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -62,10 +62,12 @@ class DenoiseCommand : public Command
{
}

/// @brief Destructor
~DenoiseCommand ()
{
}
/// @brief Copy constructor - commands are non-copyable
DenoiseCommand (const DenoiseCommand&) = delete;

/// @brief Equal operator - commands are non-copyable
DenoiseCommand&
operator= (const DenoiseCommand&) = delete;

protected:
/// @brief Runs the denois algorithm to remove all the outliers.
Expand All @@ -77,25 +79,6 @@ class DenoiseCommand : public Command
undo () override;

private:
/// @brief Default Constructor
DenoiseCommand () : removed_indices_(CloudPtr())
{
}

/// @brief Copy constructor - commands are non-copyable
DenoiseCommand (const DenoiseCommand&)
: removed_indices_(CloudPtr())
{
assert(false);
}

/// @brief Equal operator - commands are non-copyable
DenoiseCommand&
operator= (const DenoiseCommand&)
{
assert(false); return (*this);
}

/// A shared pointer pointing to the selection object of the widget
SelectionPtr selection_ptr_;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -54,10 +54,12 @@ class PasteCommand : public Command
SelectionPtr selection_ptr, CloudPtr cloud_ptr);
// comment that the selection is updated (also resets the matrix in cloud)

/// @brief Destructor
~PasteCommand ()
{
}
/// @brief Copy constructor - commands are non-copyable
PasteCommand (const PasteCommand&) = delete;

/// @brief Equal operator - commands are non-copyable
PasteCommand&
operator= (const PasteCommand&) = delete;

protected:
/// @brief Appends the points in the copy buffer into the cloud.
Expand All @@ -71,25 +73,7 @@ class PasteCommand : public Command
void
undo () override;

private:
/// @brief Default constructor - object is not default constructable
PasteCommand ()
{
}

/// @brief Copy constructor - commands are non-copyable
PasteCommand (const PasteCommand&)
{
assert(false);
}

/// @brief Equal operator - commands are non-copyable
PasteCommand&
operator= (const PasteCommand&)
{
assert(false); return (*this);
}

private:
/// a pointer pointing to the copy buffer.
ConstCopyBufferPtr copy_buffer_ptr_;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -63,12 +63,7 @@ class Selection : public Statistics
/// @brief Copy constructor
/// @param copy The selection object to be copied
Selection (const Selection& copy)
: cloud_ptr_(copy.cloud_ptr_), selected_indices_(copy.selected_indices_)
{
}

/// @brief Destructor.
~Selection ()
: Statistics (copy), cloud_ptr_(copy.cloud_ptr_), selected_indices_(copy.selected_indices_)
{
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -56,10 +56,12 @@ class TransformCommand : public Command
const float* matrix, float translate_x,
float translate_y, float translate_z);

/// @brief Destructor
~TransformCommand ()
{
}
/// @brief Copy constructor - object is not copy-constructable
TransformCommand (const TransformCommand&) = delete;

/// @brief Equal operator - object is non-copyable
TransformCommand&
operator= (const TransformCommand&) = delete;

protected:
// Transforms the coorindates of the selected points according to the transform
Expand All @@ -72,18 +74,6 @@ class TransformCommand : public Command
undo () override;

private:
/// @brief Copy constructor - object is not copy-constructable
TransformCommand (const TransformCommand&)
{
}

/// @brief Equal operator - object is non-copyable
TransformCommand&
operator= (const TransformCommand&)
{
assert(false); return (*this);
}

/// @brief Applies the transformation to the point values
/// @param sel_ptr A pointer to the selection object whose points are to be
/// transformed.
Expand Down
5 changes: 2 additions & 3 deletions apps/point_cloud_editor/src/cloud.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -98,7 +98,8 @@ Cloud::Cloud (const Cloud3D &cloud, bool register_stats)
}

Cloud::Cloud (const Cloud &copy)
: cloud_(copy.cloud_), selection_wk_ptr_(copy.selection_wk_ptr_),
: Statistics(copy)
cloud_(copy.cloud_), selection_wk_ptr_(copy.selection_wk_ptr_),
use_color_ramp_(copy.use_color_ramp_),
color_ramp_axis_(copy.color_ramp_axis_),
display_scale_(copy.display_scale_),
Expand All @@ -117,8 +118,6 @@ Cloud::Cloud (const Cloud &copy)
std::copy(copy.highlight_color_, copy.highlight_color_+RGB, highlight_color_);
}

Cloud::~Cloud () {}

Cloud&
Cloud::operator= (const Cloud &cloud)
{
Expand Down
1 change: 1 addition & 0 deletions apps/point_cloud_editor/src/copyBuffer.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,7 @@
#include <pcl/apps/point_cloud_editor/common.h>

CopyBuffer::CopyBuffer (const CopyBuffer& copy_buffer) :
Statistics(copy_buffer),
buffer_(copy_buffer.buffer_)
{
}
Expand Down
Loading

0 comments on commit a0a94de

Please sign in to comment.