Add move ctors/operators to MessageBuffer and BinaryQueue
authorKrzysztof Jackiewicz <k.jackiewicz@samsung.com>
Wed, 27 Aug 2014 09:37:25 +0000 (11:37 +0200)
committerBartlomiej Grzelewski <b.grzelewski@samsung.com>
Fri, 12 Sep 2014 12:59:28 +0000 (14:59 +0200)
Default implementations of move constructors and operators were added to make
objects of these classess movable.

Change-Id: I03322ead292adc29bed8a859fb7bc640b16fd251

src/manager/common/message-buffer.h
src/manager/dpl/core/include/dpl/binary_queue.h

index 6fc459c..9ce9d8e 100644 (file)
@@ -49,6 +49,9 @@ public:
       : m_bytesLeft(0)
     {}
 
+    MessageBuffer(MessageBuffer&&) = default;
+    MessageBuffer& operator=(MessageBuffer&&) = default;
+
     void Push(const RawBuffer &data);
 
     RawBuffer Pop();
index c1ad21f..79b3d65 100644 (file)
@@ -127,6 +127,13 @@ class BinaryQueue
     BinaryQueue(const BinaryQueue &other);
 
     /**
+     * Construct binary queue by moving data from other binary queue
+     *
+     * @param[in] other Other binary queue to move from
+     */
+    BinaryQueue(BinaryQueue&&) = default;
+
+    /**
      * Destructor
      */
     virtual ~BinaryQueue();
@@ -140,6 +147,13 @@ class BinaryQueue
     const BinaryQueue &operator=(const BinaryQueue &other);
 
     /**
+     * Assign data from other binary queue using move semantics
+     *
+     * @param[in] other Other binary queue to move from
+     */
+    BinaryQueue &operator=(BinaryQueue&&) = default;
+
+    /**
      * Append copy of @a bufferSize bytes from memory pointed by @a buffer
      * to the end of binary queue. Uses default deleter based on free.
      *