Rename some interface classes
authorSangyoon Jang <jeremy.jang@samsung.com>
Tue, 8 Apr 2025 05:31:45 +0000 (14:31 +0900)
committer장상윤/Tizen Platform Lab(SR)/삼성전자 <jeremy.jang@samsung.com>
Thu, 10 Apr 2025 01:00:24 +0000 (10:00 +0900)
Rename to clarify its purpose.

Signed-off-by: Sangyoon Jang <jeremy.jang@samsung.com>
src/action/action_request_handler.cc
src/action/action_request_handler.hh
src/action/plugin_executor.hh
src/action/request_handler.hh
src/action/request_reply_handler.hh
src/action/service.hh
src/common/action_executor.hh
src/common/action_result_handler.hh [new file with mode: 0644]
src/common/result_handler.hh [deleted file]

index e0635bb6ae5fdd16fca322ef85ca8fba50fc8682..394108b979f33981adb4da99a1204cc3dcbcc3c2 100644 (file)
@@ -123,12 +123,13 @@ void ActionRequestHandler::OnExecute(const std::string& instance,
   executors_.emplace_back(std::move(executor));
 }
 
-void ActionRequestHandler::RegisterRequestReplyHandler(const std::string& requester,
-    RequestReplyHandler* handler) {
+void ActionRequestHandler::RegisterRequestReplyHandler(
+    const std::string& requester, IRequestReplyHandler* handler) {
   reply_handlers_.emplace(requester, handler);
 }
 
-void ActionRequestHandler::UnregisterRequestReplyHandler(const std::string& requester) {
+void ActionRequestHandler::UnregisterRequestReplyHandler(
+    const std::string& requester) {
   auto it = std::find_if(reply_handlers_.begin(), reply_handlers_.end(),
       [requester](const auto& iterator) {
         return iterator.first == requester;
index 67f4ca64fca7d4604a97f37c33c3e2a4d7912f78..859d1d656fb3d987269b36cebcaf269e6d963bb8 100644 (file)
 #include "action/tizen_action_service_stub.h"
 #include "common/action_executor.hh"
 #include "common/action_model.h"
-#include "common/result_handler.hh"
+#include "common/action_result_handler.hh"
 
 namespace action {
 
-class ActionRequestHandler : public IRequestHandler, common::IResultHandler {
+class ActionRequestHandler : public IRequestHandler, common::IActionResultHandler {
  public:
   ActionRequestHandler();
   ~ActionRequestHandler();
@@ -42,7 +42,7 @@ class ActionRequestHandler : public IRequestHandler, common::IResultHandler {
   void OnExecute(const std::string& instance,
                  rpc::Action& model) override;
   void RegisterRequestReplyHandler(const std::string& requester,
-                                   RequestReplyHandler* handler) override;
+                                   IRequestReplyHandler* handler) override;
   void UnregisterRequestReplyHandler(const std::string& requester) override;
 
   void OnResult(const std::string& requester,
@@ -51,7 +51,7 @@ class ActionRequestHandler : public IRequestHandler, common::IResultHandler {
  private:
   rpc_port::tizen_action_service_stub::stub::ActionService service_;
   std::vector<std::unique_ptr<common::AbstractActionExecutor>> executors_;
-  std::map<std::string, RequestReplyHandler*> reply_handlers_;
+  std::map<std::string, IRequestReplyHandler*> reply_handlers_;
 };
 
 }  // namespace action
index aa4c3d4a764ef97bf42d7788e65bcf96f255dc7a..6a4b1ae14aa9eca9c6e4b051f16f0ff568af4e66 100644 (file)
@@ -43,7 +43,7 @@ class PluginExecutor : public common::AbstractActionExecutor,
 
  private:
   rpc_port::plugin_manager_proxy::proxy::PluginManager plugin_manager_;
-  common::IResultHandler* result_handler_ = nullptr;
+  common::IActionResultHandler* result_handler_ = nullptr;
   bool connected_ = false;
 };
 
index b26bf200cabc86baea99d64bd8c91392f574e2f5..dff18b291237131087453c1e4755847121d118c9 100644 (file)
@@ -37,7 +37,7 @@ class IRequestHandler {
       float search_threshold) = 0;
   virtual void OnExecute(const std::string& requester, rpc::Action& model) = 0;
   virtual void RegisterRequestReplyHandler(const std::string& requester,
-      RequestReplyHandler* handler) = 0;
+      IRequestReplyHandler* handler) = 0;
   virtual void UnregisterRequestReplyHandler(const std::string& requester) = 0;
 };
 
index 8dfa3fe882aee822639f719ecee3f5f84fed8be1..307a3853dd3b70ab3cdb1ae84b379f51079503d6 100644 (file)
@@ -21,9 +21,9 @@
 
 namespace action {
 
-class RequestReplyHandler {
+class IRequestReplyHandler {
  public:
-  virtual ~RequestReplyHandler() = default;
+  virtual ~IRequestReplyHandler() = default;
   virtual void SendRequestReply(const std::string& reply) = 0;
 };
 
index 85efc65628a65bbec204a3e354cb827d8c4758cf..deafb02128ea728f3676261ef06835aae8267074 100644 (file)
@@ -33,7 +33,7 @@ namespace action {
 namespace rpc = rpc_port::tizen_action_service_stub;
 
 class Service : public rpc::stub::ActionService::ServiceBase,
-                public RequestReplyHandler {
+                public IRequestReplyHandler {
  public:
   class Factory : public rpc::stub::ActionService::ServiceBase::Factory {
    public:
index b1e4eea19fadc7c66d7608f72ae7dc70d715f97b..4a92f2ece13b6432a5790292dfdaf47a90e0f965 100644 (file)
@@ -21,7 +21,7 @@
 #include <utility>
 
 #include "common/action_model.h"
-#include "common/result_handler.hh"
+#include "common/action_result_handler.hh"
 
 namespace common {
 
@@ -31,14 +31,14 @@ class AbstractActionExecutor {
   virtual ~AbstractActionExecutor() = default;
   virtual int Execute(const ActionModel& model) = 0;
   std::string GetId() { return id_; }
-  void SetResultHandler(IResultHandler* handler) { handler_ = handler; }
+  void SetResultHandler(IActionResultHandler* handler) { handler_ = handler; }
   void NotifyResult(const std::string& result) {
     handler_->OnResult(id_, result);
   }
 
  private:
   std::string id_;
-  IResultHandler* handler_;
+  IActionResultHandler* handler_;
 };
 
 }  // namespace common
diff --git a/src/common/action_result_handler.hh b/src/common/action_result_handler.hh
new file mode 100644 (file)
index 0000000..d5a939f
--- /dev/null
@@ -0,0 +1,33 @@
+/*
+ * Copyright (c) 2025 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.
+ */
+
+#ifndef COMMON_ACTION_RESULT_HANDLER_HH_
+#define COMMON_ACTION_RESULT_HANDLER_HH_
+
+#include <string>
+
+namespace common {
+
+class IActionResultHandler {
+ public:
+  virtual ~IActionResultHandler() = default;
+  virtual void OnResult(const std::string& executor_id,
+      const std::string& result) = 0;
+};
+
+}  // namespace common
+
+#endif  // COMMON_ACTION_RESULT_HANDLER_HH_
diff --git a/src/common/result_handler.hh b/src/common/result_handler.hh
deleted file mode 100644 (file)
index 4fecce7..0000000
+++ /dev/null
@@ -1,33 +0,0 @@
-/*
- * Copyright (c) 2025 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.
- */
-
-#ifndef COMMON_RESULT_HANDLER_HH_
-#define COMMON_RESULT_HANDLER_HH_
-
-#include <string>
-
-namespace common {
-
-class IResultHandler {
- public:
-  virtual ~IResultHandler() = default;
-  virtual void OnResult(const std::string& executor_id,
-      const std::string& result) = 0;
-};
-
-}  // namespace common
-
-#endif  // COMMON_RESULT_HANDLER_HH_