Version 4.0.3: Rename ServerBase.* to MainLoop.* by following the Tizen naming rules 44/143044/2
authorMu-Woong Lee <muwoong.lee@samsung.com>
Tue, 8 Aug 2017 08:17:58 +0000 (17:17 +0900)
committerMu-Woong Lee <muwoong.lee@samsung.com>
Tue, 8 Aug 2017 08:36:07 +0000 (17:36 +0900)
Change-Id: Ib0ff13737207bd4c93536392d73c0a62e947122c
Signed-off-by: Mu-Woong Lee <muwoong.lee@samsung.com>
packaging/context-service.spec
src/agent/AgentMain.cpp
src/server/ServerMain.cpp
src/shared/MainLoop.cpp [new file with mode: 0644]
src/shared/MainLoop.h [new file with mode: 0644]
src/shared/ServerBase.cpp [deleted file]
src/shared/ServerBase.h [deleted file]

index 176a5d523a399edbc751c1b3824dcb6bb33ebf9e..8b54afadd88033953f071016e49a139416302709 100644 (file)
@@ -1,6 +1,6 @@
 Name:       context-service
 Summary:    Tizen Contextual Service Framework
-Version:    4.0.2
+Version:    4.0.3
 Release:    1
 Group:      Service/Context
 License:    Apache-2.0
index fd271be01573e1e098858f1e0065f97fb19cf5e9..eba84484b4874dd1ae887fd303a4f7d6341355db 100644 (file)
@@ -18,7 +18,7 @@
 #include <cstdlib>
 #include <systemd/sd-daemon.h>
 
-#include <ServerBase.h>
+#include <MainLoop.h>
 #include "AgentDBus.h"
 #include "AgentUtil.h"
 #include "PluginLoader.h"
index ae62b7c82794fac77a1b834d6744c9e25816a804..9274f8b680e62a165f5539b9363f85bae2cd82d8 100644 (file)
@@ -20,7 +20,7 @@
 
 #include <ContextTypes.h>
 #include <ServerUtil.h>
-#include <ServerBase.h>
+#include <MainLoop.h>
 #include "DBusConnector.h"
 #include "ServiceLoader.h"
 #include "ActiveUserMonitor.h"
diff --git a/src/shared/MainLoop.cpp b/src/shared/MainLoop.cpp
new file mode 100644 (file)
index 0000000..faef344
--- /dev/null
@@ -0,0 +1,76 @@
+/*
+ * Copyright (c) 2017 Samsung Electronics Co., Ltd.
+ *
+ * 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.
+ */
+
+#include <new>
+#include <exception>
+#include <stdexcept>
+#include "MainLoop.h"
+
+#define NEW_FAIL_LIMIT 3
+
+using namespace ctx;
+
+static void __on_terminate()
+{
+       try {
+               auto unknown = std::current_exception();
+               if (unknown) {
+                       std::rethrow_exception(unknown);
+               }
+       } catch (const std::exception& e) {
+               _E(RED("Unexpected exception: %s"), e.what());
+       } catch (...) {
+               _E(RED("Unknown exception"));
+       }
+}
+
+static void __on_new_failed()
+{
+       static unsigned failCount = 0;
+       _E_ALLOC;
+       failCount += 1;
+       if (failCount >= NEW_FAIL_LIMIT)
+               throw std::bad_alloc();
+}
+
+MainLoop::MainLoop() :
+       __mainLoop(NULL)
+{
+       std::set_terminate(__on_terminate);
+       std::set_new_handler(__on_new_failed);
+}
+
+bool MainLoop::start()
+{
+       __mainLoop = g_main_loop_new(NULL, FALSE);
+       IF_FAIL_RETURN_TAG(__mainLoop, false, _E, E_STR_ALLOC);
+
+       _I(CYAN("Starting..."));
+       g_main_loop_run(__mainLoop);
+
+       g_main_loop_unref(__mainLoop);
+       __mainLoop = NULL;
+
+       return true;
+}
+
+void MainLoop::stop()
+{
+       if (__mainLoop && g_main_loop_is_running(__mainLoop)) {
+               _I(PURPLE("Terminating..."));
+               g_main_loop_quit(__mainLoop);
+       }
+}
diff --git a/src/shared/MainLoop.h b/src/shared/MainLoop.h
new file mode 100644 (file)
index 0000000..c6e8c78
--- /dev/null
@@ -0,0 +1,33 @@
+/*
+ * Copyright (c) 2017 Samsung Electronics Co., Ltd.
+ *
+ * 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.
+ */
+
+#ifndef __CONEXT_SERVICE_MAIN_LOOP_H__
+#define __CONEXT_SERVICE_MAIN_LOOP_H__
+
+#include <ContextTypes.h>
+
+namespace ctx {
+       class MainLoop {
+       public:
+               MainLoop();
+               bool start();
+               void stop();
+       private:
+               GMainLoop* __mainLoop;
+       };
+}
+
+#endif
diff --git a/src/shared/ServerBase.cpp b/src/shared/ServerBase.cpp
deleted file mode 100644 (file)
index 2f60ced..0000000
+++ /dev/null
@@ -1,76 +0,0 @@
-/*
- * Copyright (c) 2017 Samsung Electronics Co., Ltd.
- *
- * 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.
- */
-
-#include <new>
-#include <exception>
-#include <stdexcept>
-#include "ServerBase.h"
-
-#define NEW_FAIL_LIMIT 3
-
-using namespace ctx;
-
-static void __on_terminate()
-{
-       try {
-               auto unknown = std::current_exception();
-               if (unknown) {
-                       std::rethrow_exception(unknown);
-               }
-       } catch (const std::exception& e) {
-               _E(RED("Unexpected exception: %s"), e.what());
-       } catch (...) {
-               _E(RED("Unknown exception"));
-       }
-}
-
-static void __on_new_failed()
-{
-       static unsigned failCount = 0;
-       _E_ALLOC;
-       failCount += 1;
-       if (failCount >= NEW_FAIL_LIMIT)
-               throw std::bad_alloc();
-}
-
-MainLoop::MainLoop() :
-       __mainLoop(NULL)
-{
-       std::set_terminate(__on_terminate);
-       std::set_new_handler(__on_new_failed);
-}
-
-bool MainLoop::start()
-{
-       __mainLoop = g_main_loop_new(NULL, FALSE);
-       IF_FAIL_RETURN_TAG(__mainLoop, false, _E, E_STR_ALLOC);
-
-       _I(CYAN("Starting..."));
-       g_main_loop_run(__mainLoop);
-
-       g_main_loop_unref(__mainLoop);
-       __mainLoop = NULL;
-
-       return true;
-}
-
-void MainLoop::stop()
-{
-       if (__mainLoop && g_main_loop_is_running(__mainLoop)) {
-               _I(PURPLE("Terminating..."));
-               g_main_loop_quit(__mainLoop);
-       }
-}
diff --git a/src/shared/ServerBase.h b/src/shared/ServerBase.h
deleted file mode 100644 (file)
index e3bf1e4..0000000
+++ /dev/null
@@ -1,33 +0,0 @@
-/*
- * Copyright (c) 2017 Samsung Electronics Co., Ltd.
- *
- * 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.
- */
-
-#ifndef __CONEXT_SERVER_BASE_H__
-#define __CONEXT_SERVER_BASE_H__
-
-#include <ContextTypes.h>
-
-namespace ctx {
-       class MainLoop {
-       public:
-               MainLoop();
-               bool start();
-               void stop();
-       private:
-               GMainLoop* __mainLoop;
-       };
-}
-
-#endif