COMPMID-1995: Minor code fixes.
-Remove FIXMEs and link to tickets.
-Pass large object by const reference.
-Implement copy assignment operator for Window.
Change-Id: I975223ac42ec424f153569a8c963f29e6b86ad29
Signed-off-by: Georgios Pinitas <georgios.pinitas@arm.com>
Reviewed-on: https://review.mlplatform.org/c/899
Comments-Addressed: Arm Jenkins <bsgcomp@arm.com>
Tested-by: Arm Jenkins <bsgcomp@arm.com>
Reviewed-by: Michele Di Giorgio <michele.digiorgio@arm.com>
diff --git a/arm_compute/core/Window.h b/arm_compute/core/Window.h
index 73c8d43..a562279 100644
--- a/arm_compute/core/Window.h
+++ b/arm_compute/core/Window.h
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2016-2018 ARM Limited.
+ * Copyright (c) 2016-2019 ARM Limited.
*
* SPDX-License-Identifier: MIT
*
@@ -56,6 +56,13 @@
* @param[in] src Copy the values from src to a new object
*/
Window(const Window &src);
+ /** Copy assignment operator
+ *
+ * @param[in] rhs Copy the values from rhs to the current object
+ *
+ * @return Reference to the updated object
+ */
+ Window &operator=(const Window &rhs);
/** Describe one of the image's dimensions with a start, end and step.
*
@@ -384,6 +391,12 @@
{
return broadcast_if_dimension_le_one(info.tensor_shape());
}
+ /** Friend function that swaps the contents of two windows
+ *
+ * @param[in] lhs First window to swap.
+ * @param[in] rhs Second window to swap.
+ */
+ friend void swap(Window &lhs, Window &rhs);
private:
/** First slice of the window
@@ -407,6 +420,6 @@
private:
std::array<Dimension, Coordinates::num_max_dimensions> _dims;
};
-}
+} // namespace arm_compute
#include "Window.inl"
#endif /*__ARM_COMPUTE_WINDOW_H__ */
diff --git a/arm_compute/core/Window.inl b/arm_compute/core/Window.inl
index c6fc884..eeef3df 100644
--- a/arm_compute/core/Window.inl
+++ b/arm_compute/core/Window.inl
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2016-2018 ARM Limited.
+ * Copyright (c) 2016-2019 ARM Limited.
*
* SPDX-License-Identifier: MIT
*
@@ -32,6 +32,13 @@
}
}
+inline Window &Window::operator=(const arm_compute::Window &rhs)
+{
+ Window tmp(rhs);
+ swap(*this, tmp);
+ return *this;
+}
+
inline constexpr const Window::Dimension &Window::operator[](size_t dimension) const
{
// Precondition: dimension < Coordinates::num_max_dimensions
@@ -267,4 +274,9 @@
}
return total;
}
+
+inline void swap(Window &lhs, Window &rhs)
+{
+ lhs._dims.swap(rhs._dims);
}
+} // namespace arm_compute
diff --git a/arm_compute/graph/GraphBuilder.h b/arm_compute/graph/GraphBuilder.h
index bcf80f9..f1d387b 100644
--- a/arm_compute/graph/GraphBuilder.h
+++ b/arm_compute/graph/GraphBuilder.h
@@ -217,7 +217,7 @@
*
* @return Node ID of the created node, EmptyNodeID in case of error
*/
- static NodeID add_detection_output_node(Graph &g, NodeParams params, NodeIdxPair input_loc, NodeIdxPair input_conf, NodeIdxPair input_priorbox, DetectionOutputLayerInfo detect_info);
+ static NodeID add_detection_output_node(Graph &g, NodeParams params, NodeIdxPair input_loc, NodeIdxPair input_conf, NodeIdxPair input_priorbox, const DetectionOutputLayerInfo &detect_info);
/** Adds a Dummy node to the graph
*
* @note this node if for debugging purposes. Just alters the shape of the graph pipeline as requested.
@@ -353,7 +353,7 @@
*
* @return Node ID of the created node, EmptyNodeID in case of error
*/
- static NodeID add_priorbox_node(Graph &g, NodeParams params, NodeIdxPair input0, NodeIdxPair input1, PriorBoxLayerInfo prior_info);
+ static NodeID add_priorbox_node(Graph &g, NodeParams params, NodeIdxPair input0, NodeIdxPair input1, const PriorBoxLayerInfo &prior_info);
/** Adds a reorg layer node to the graph
*
* @param[in] g Graph to add the node to
diff --git a/arm_compute/graph/frontend/Layers.h b/arm_compute/graph/frontend/Layers.h
index 4e6f0ee..a4c03a6 100644
--- a/arm_compute/graph/frontend/Layers.h
+++ b/arm_compute/graph/frontend/Layers.h
@@ -478,7 +478,7 @@
* @param[in] sub_stream_prior PriorBox graph sub-stream.
* @param[in] detect_info DetectionOutput parameters.
*/
- DetectionOutputLayer(SubStream &&sub_stream_conf, SubStream &&sub_stream_prior, DetectionOutputLayerInfo detect_info)
+ DetectionOutputLayer(SubStream &&sub_stream_conf, SubStream &&sub_stream_prior, const DetectionOutputLayerInfo &detect_info)
: _ss_conf(std::move(sub_stream_conf)), _ss_prior(std::move(sub_stream_prior)), _detect_info(detect_info)
{
}
@@ -838,7 +838,7 @@
* @param[in] sub_stream First graph sub-stream
* @param[in] prior_info PriorBox parameters.
*/
- PriorBoxLayer(SubStream &&sub_stream, PriorBoxLayerInfo prior_info)
+ PriorBoxLayer(SubStream &&sub_stream, const PriorBoxLayerInfo &prior_info)
: _ss(std::move(sub_stream)), _prior_info(prior_info)
{
}