2 * Copyright (c) 2017 TOYOTA MOTOR CORPORATION
4 * Licensed under the Apache License, Version 2.0 (the "License");
5 * you may not use this file except in compliance with the License.
6 * You may obtain a copy of the License at
8 * http://www.apache.org/licenses/LICENSE-2.0
10 * Unless required by applicable law or agreed to in writing, software
11 * distributed under the License is distributed on an "AS IS" BASIS,
12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 * See the License for the specific language governing permissions and
14 * limitations under the License.
17 #ifndef ALLOCATE_LIST_HPP
18 #define ALLOCATE_LIST_HPP
24 #include "wm_client.hpp"
25 #include "request.hpp"
26 #include "wm_error.hpp"
31 /* using std::experimental::nullopt;
32 using std::experimental::optional; */
34 struct FloatingSurface
46 AppList(const AppList &obj) = delete;
48 // Client Database Interface
49 /* TODO: consider, which is better WMClient as parameter or not
50 If the WMClient should be more flexible, I think this param should be WMClient class
52 void addClient(const std::string &appid, unsigned layer,
53 unsigned surface, const std::string &role);
54 void addClient(const std::string &appid, unsigned layer, const std::string &role);
55 void removeClient(const std::string &appid);
56 bool contains(const std::string &appid) const;
57 int countClient() const;
58 std::shared_ptr<WMClient> lookUpClient(const std::string &appid);
59 void removeSurface(unsigned surface);
60 //std::string getAppID(unsigned surface, const std::string &role, bool *found) const;
61 std::string getAppID(unsigned surface, bool* found) const;
62 WMError appendRole(const std::string &appid, const std::string &role);
66 void addFloatingClient(const std::string &appid, unsigned layer, const std::string &role);
67 void addFloatingSurface(const std::string &appid, unsigned surface, unsigned pid);
68 WMError popFloatingSurface(unsigned pid, unsigned *surface);
69 WMError popFloatingSurface(const std::string &appid, unsigned *surface);
70 void removeFloatingSurface(unsigned surface);
73 unsigned currentRequestNumber() const;
74 unsigned getRequestNumber(const std::string &appid) const;
75 unsigned addRequest(WMRequest req);
76 WMError setAction(unsigned req_num, const struct WMAction &action);
77 WMError setAction(unsigned req_num, std::shared_ptr<WMClient> client,
78 const std::string &role, const std::string &area, TaskVisible visible);
79 bool setEndDrawFinished(unsigned req_num, const std::string &appid, const std::string &role);
80 bool endDrawFullfilled(unsigned req_num);
81 void removeRequest(unsigned req_num);
83 bool haveRequest() const;
85 struct WMTrigger getRequest(unsigned req_num, bool* found);
86 const std::vector<struct WMAction> &getActions(unsigned req_num, bool* found);
90 void dumpFloatingSurfaces();
93 std::vector<WMRequest> req_list;
94 std::unordered_map<std::string, std::shared_ptr<WMClient>> app2client;
97 std::vector<struct FloatingSurface> floating_surfaces;
101 #endif // ALLOCATE_LIST_HPP