Rename to clarify its purpose.
Signed-off-by: Sangyoon Jang <jeremy.jang@samsung.com>
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;
#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();
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,
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
private:
rpc_port::plugin_manager_proxy::proxy::PluginManager plugin_manager_;
- common::IResultHandler* result_handler_ = nullptr;
+ common::IActionResultHandler* result_handler_ = nullptr;
bool connected_ = false;
};
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;
};
namespace action {
-class RequestReplyHandler {
+class IRequestReplyHandler {
public:
- virtual ~RequestReplyHandler() = default;
+ virtual ~IRequestReplyHandler() = default;
virtual void SendRequestReply(const std::string& reply) = 0;
};
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:
#include <utility>
#include "common/action_model.h"
-#include "common/result_handler.hh"
+#include "common/action_result_handler.hh"
namespace common {
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
--- /dev/null
+/*
+ * 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_
+++ /dev/null
-/*
- * 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_