Move non-template functions to timeout.cpp file 49/34049/8
authorLukasz Wojciechowski <l.wojciechow@partner.samsung.com>
Tue, 20 Jan 2015 14:15:36 +0000 (15:15 +0100)
committerLukasz Wojciechowski <l.wojciechow@partner.samsung.com>
Tue, 17 Mar 2015 14:49:53 +0000 (15:49 +0100)
Leaving them in timeout.h causes double definition of functions.

Change-Id: Ic425855ffd958b2adbb16672d486fcdcedaa8897

src/common/CMakeLists.txt
src/common/timeout.cpp [new file with mode: 0644]
src/common/timeout.h

index fc42023..abd3aa6 100644 (file)
@@ -24,6 +24,7 @@ SET(COMMON_TARGET_TEST_SOURCES
     ${PROJECT_SOURCE_DIR}/src/common/passwd_access.cpp
     ${PROJECT_SOURCE_DIR}/src/common/uds.cpp
     ${PROJECT_SOURCE_DIR}/src/common/synchronization_pipe.cpp
+    ${PROJECT_SOURCE_DIR}/src/common/timeout.cpp
     )
 
 #system and local includes
diff --git a/src/common/timeout.cpp b/src/common/timeout.cpp
new file mode 100644 (file)
index 0000000..c9e1347
--- /dev/null
@@ -0,0 +1,43 @@
+/*
+ * Copyright (c) 2015 Samsung Electronics Co., Ltd All Rights Reserved
+ *
+ *    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.
+ */
+/**
+ * @file        timeout.cpp
+ * @author      Lukasz Wojciechowski <l.wojciechow@partner.samsung.com>
+ * @brief       Definition of future_status serialization operator
+ */
+
+#include <timeout.h>
+
+namespace Timeout {
+
+std::ostream& operator<<(std::ostream& os, const std::future_status &status)
+{
+    switch (status) {
+        case std::future_status::ready:
+            os << "<READY>";
+            break;
+        case std::future_status::timeout:
+            os << "<TIMEOUT>";
+            break;
+        case std::future_status::deferred:
+            os << "<DEFERRED>";
+            break;
+    }
+    os << " [" << static_cast<int>(status) << "]";
+    return os;
+}
+
+} // namespace Timeout
index 98662e1..01ef862 100644 (file)
@@ -28,7 +28,7 @@
 #include <type_traits>
 #include <utility>
 
-#include <tests_common.h>
+#include <dpl/test/test_runner.h>
 
 namespace Timeout {
 
@@ -43,22 +43,7 @@ enum ExpectMode {
     IGNORE,
 };
 
-std::ostream& operator<<(std::ostream& os, const std::future_status &status)
-{
-    switch (status) {
-        case std::future_status::ready:
-            os << "<READY>";
-            break;
-        case std::future_status::timeout:
-            os << "<TIMEOUT>";
-            break;
-        case std::future_status::deferred:
-            os << "<DEFERRED>";
-            break;
-    }
-    os << " [" << static_cast<int>(status) << "]";
-    return os;
-}
+std::ostream& operator<<(std::ostream& os, const std::future_status &status);
 
 template <class Rep, class Period, class F, class... Args>
     typename std::result_of<F(Args...)>::type