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 24, 2019
1 parent 0a5baca commit c38e548
Show file tree
Hide file tree
Showing 17 changed files with 46 additions and 133 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -62,9 +62,7 @@ namespace pcl

public:
CloudView (QWidget* parent = nullptr);
CloudView (const CloudView& to_copy);
CloudView (ProjectModel* model, QWidget* parent = nullptr);
~CloudView ();

void
setModel (ProjectModel* new_model);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,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
12 changes: 0 additions & 12 deletions apps/cloud_composer/src/cloud_view.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -41,18 +41,6 @@ pcl::cloud_composer::CloudView::CloudView (ProjectModel* model, QWidget* parent)
mainLayout-> addWidget (qvtk_,0,0);
}

pcl::cloud_composer::CloudView::CloudView (const CloudView& to_copy)
: vis_ (to_copy.vis_)
, model_ (to_copy.model_)
, qvtk_ (to_copy.qvtk_)
{
}


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

void
pcl::cloud_composer::CloudView::setModel (ProjectModel* new_model)
{
Expand Down
4 changes: 0 additions & 4 deletions apps/cloud_composer/src/toolbox_model.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -21,10 +21,6 @@ pcl::cloud_composer::ToolBoxModel::ToolBoxModel (const ToolBoxModel&)
{
}

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

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

MainWindow();
MainWindow(const MainWindow &) = delete;
MainWindow& operator=(const MainWindow &) = delete;
~MainWindow();

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,6 +60,13 @@ class CopyCommand : public Command
has_undo_ = false;
}

/// @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 @@ -80,16 +87,6 @@ class CopyCommand : public Command
}

private:
/// @brief Default constructor - object is not default constructable
CopyCommand () = delete;

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

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

/// 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,16 +80,6 @@ class CutCommand : public Command
undo () override;

private:
/// @brief Default constructor - object is not default constructable
CutCommand () = delete;

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

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

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

Expand All @@ -98,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,9 +52,13 @@ 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 () = default;

/// @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.
Expand All @@ -66,16 +70,6 @@ class DeleteCommand : public Command
undo () override;

private:
/// @brief Default constructor - object is not default constructable
DeleteCommand () = delete;

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

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

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

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

/// @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.
void
Expand All @@ -72,18 +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&) = delete;

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

/// 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,6 +54,13 @@ class PasteCommand : public Command
SelectionPtr selection_ptr, CloudPtr cloud_ptr);
// comment that the selection is updated (also resets the matrix in cloud)

/// @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.
/// @details After appending the points to the cloud, this function also
Expand All @@ -67,16 +74,6 @@ class PasteCommand : public Command
undo () override;

private:
/// @brief Default constructor - object is not default constructable
PasteCommand () = delete;

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

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

/// 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 @@ -177,11 +177,6 @@ class Selection : public Statistics
getStat () const override;

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

/// a pointer to the cloud
ConstCloudPtr cloud_ptr_;

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

/// @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
// matrix.
Expand All @@ -67,13 +74,6 @@ class TransformCommand : public Command
undo () override;

private:
/// @brief Copy constructor - object is not copy-constructable
TransformCommand (const TransformCommand&) = delete;

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

/// @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
2 changes: 0 additions & 2 deletions apps/point_cloud_editor/src/cloud.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -117,8 +117,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
3 changes: 1 addition & 2 deletions octree/include/pcl/octree/octree_container.h
Original file line number Diff line number Diff line change
Expand Up @@ -175,8 +175,7 @@ namespace pcl
{
public:
/** \brief Empty constructor. */
OctreeContainerPointIndex () :
data_ ()
OctreeContainerPointIndex ()
{
reset ();
}
Expand Down
4 changes: 0 additions & 4 deletions visualization/include/pcl/visualization/window.h
Original file line number Diff line number Diff line change
Expand Up @@ -180,8 +180,6 @@ namespace pcl
}

ExitMainLoopTimerCallback ();
ExitMainLoopTimerCallback (const ExitMainLoopTimerCallback& src);
ExitMainLoopTimerCallback& operator = (const ExitMainLoopTimerCallback& src);

void
Execute (vtkObject*, unsigned long event_id, void* call_data) override;
Expand All @@ -198,8 +196,6 @@ namespace pcl
}

ExitCallback ();
ExitCallback (const ExitCallback &src);
ExitCallback& operator = (const ExitCallback &src);

void
Execute (vtkObject*, unsigned long event_id, void*) override;
Expand Down
37 changes: 2 additions & 35 deletions visualization/src/window.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -323,27 +323,10 @@ pcl::visualization::Window::KeyboardCallback (vtkObject*, unsigned long eid, voi

/////////////////////////////////////////////////////////////////////////////////////////////
pcl::visualization::Window::ExitMainLoopTimerCallback::ExitMainLoopTimerCallback ()
: right_timer_id (), window ()
: right_timer_id (-1), window (nullptr)
{
}

/////////////////////////////////////////////////////////////////////////////////////////////
pcl::visualization::Window::ExitMainLoopTimerCallback::ExitMainLoopTimerCallback (
const pcl::visualization::Window::ExitMainLoopTimerCallback& src)
: right_timer_id (src.right_timer_id), window (src.window)
{
}

/////////////////////////////////////////////////////////////////////////////////////////////
pcl::visualization::Window::ExitMainLoopTimerCallback&
pcl::visualization::Window::ExitMainLoopTimerCallback::operator = (
const pcl::visualization::Window::ExitMainLoopTimerCallback& src)
{
right_timer_id = src.right_timer_id;
window = src.window;
return (*this);
}

/////////////////////////////////////////////////////////////////////////////////////////////
void
pcl::visualization::Window::ExitMainLoopTimerCallback::Execute (
Expand All @@ -360,24 +343,8 @@ pcl::visualization::Window::ExitMainLoopTimerCallback::Execute (

/////////////////////////////////////////////////////////////////////////////////////////////
pcl::visualization::Window::ExitCallback::ExitCallback ()
: window ()
{
}

/////////////////////////////////////////////////////////////////////////////////////////////
pcl::visualization::Window::ExitCallback::ExitCallback (
const pcl::visualization::Window::ExitCallback &src)
: window (src.window)
{
}

/////////////////////////////////////////////////////////////////////////////////////////////
pcl::visualization::Window::ExitCallback&
pcl::visualization::Window::ExitCallback::operator = (
const pcl::visualization::Window::ExitCallback &src)
: window (nullptr)
{
window = src.window;
return (*this);
}

/////////////////////////////////////////////////////////////////////////////////////////////
Expand Down

0 comments on commit c38e548

Please sign in to comment.