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
23 //#include <experimental/optional>
24 #include "windowmanager-client.hpp"
28 /* using std::experimental::nullopt;
29 using std::experimental::optional; */
48 bool end_draw_finished;
54 explicit WMRequest(std::string appid, std::string role,
55 std::string area, ResourceTask task);
57 WMRequest(const WMRequest &obj);
60 struct WMTriger trigger;
61 std::vector<struct WMAction> sync_draw_req;
68 AppList(const AppList &obj) = delete;
70 // Client Database Interface
71 void addClient(const std::string &appid, const std::string &role);
72 void removeClient(const std::string &appid);
73 bool contains(const std::string &appid);
75 std::shared_ptr<WMClient> lookUpClient(const std::string &appid);
78 unsigned currentSequenceNumber();
79 unsigned getSequenceNumber(const std::string &appid);
80 unsigned addAllocateRequest(WMRequest req);
81 /* TODO: consider, which is better WMClient or std::string appid?
82 if appid is key to manage resources, it is better to select std::string
83 otherwise WMClient is better, IMO */
84 bool requestFinished();
85 bool setAction(unsigned request_seq, const std::string &appid, const std::string &role, const std::string &area);
86 bool setEndDrawFinished(unsigned request_seq, const std::string &appid, const std::string &role);
87 bool endDrawFullfilled(unsigned request_seq);
88 void removeRequest(unsigned request_seq);
96 std::vector<WMRequest> req_list;
97 std::unordered_map<std::string, std::shared_ptr<WMClient>> client_list;
102 #endif // ALLOCATE_LIST_HPP