From: Kazumasa Mitsunari Date: Sun, 10 Jun 2018 14:46:49 +0000 (+0900) Subject: Change API in applist X-Git-Url: https://gerrit.automotivelinux.org/gerrit/gitweb?a=commitdiff_plain;h=1476fb12566dd8d7de9c598bb0ac78e454f52d11;p=apps%2Fagl-service-windowmanager.git Change API in applist * getActions * getRequest This is because these functions doesn't check the elements is in or not. So if there is no element, second parameter bool should be used to check. Change-Id: I0aab79d3317a15d82ca21a40a65f29a2aed07fb3 Signed-off-by: Kazumasa Mitsunari --- diff --git a/src/applist.cpp b/src/applist.cpp index 9b06c84..d0082dd 100644 --- a/src/applist.cpp +++ b/src/applist.cpp @@ -122,23 +122,28 @@ unsigned AppList::addAllocateRequest(WMRequest req) return req.req_num; // return 1; if you test time_expire } -struct WMTrigger AppList::getRequest(unsigned req_num) +struct WMTrigger AppList::getRequest(unsigned req_num, bool *found) { + *found = false; for (const auto &x : this->req_list) { if (req_num == x.req_num) { + *found = true; return x.trigger; } } + return WMTrigger{"", "", "", Task::TASK_INVALID}; } -const vector &AppList::getActions(unsigned req_num) +const vector &AppList::getActions(unsigned req_num, bool* found) { + *found = false; for (auto &x : this->req_list) { if (req_num == x.req_num) { + *found = true; return x.sync_draw_req; } } diff --git a/src/applist.hpp b/src/applist.hpp index 159d5ab..10c2947 100644 --- a/src/applist.hpp +++ b/src/applist.hpp @@ -61,8 +61,8 @@ class AppList void next(); bool haveRequest() const; - struct WMTrigger getRequest(unsigned req_num); - const std::vector &getActions(unsigned req_num); + struct WMTrigger getRequest(unsigned req_num, bool* found); + const std::vector &getActions(unsigned req_num, bool* found); void clientDump(); void reqDump(); diff --git a/src/request.hpp b/src/request.hpp index ab1ef95..ded2c02 100644 --- a/src/request.hpp +++ b/src/request.hpp @@ -26,7 +26,8 @@ namespace wm enum Task { TASK_ALLOCATE, - TASK_RELEASE + TASK_RELEASE, + TASK_INVALID }; struct WMTrigger