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
22 #include "windowmanager-client.hpp"
32 explicit WMRequest(std::string appid, std::string role,
33 std::string area, ResourceTask task);
35 WMRequest(const WMRequest &obj);
42 bool end_draw_finished;
46 class AllocateRequestList {
48 AllocateRequestList();
49 virtual ~AllocateRequestList();
50 AllocateRequestList(const AllocateRequestList &obj) = delete;
52 // Client Database Interface
53 bool addClient(WMClient *client);
54 void removeClient(const std::string &appid);
55 WMClient* lookUpClient(const std::string &appid);
58 unsigned currentSequenceNumber();
59 unsigned getSequenceNumber(const std::string &appid, const std::string &role, const std::string &area);
60 unsigned addAllocateRequest(WMRequest req);
61 /* TODO: consider, which is better WMClient or std::string appid?
62 if appid is key to manage resources, it is better to select std::string
63 otherwise WMClient is better, IMO */
64 bool requestFinished();
65 unsigned lookUpAllocatingApp(const char *appid);
66 void setEndDrawFinished(unsigned request_seq, const std::string &role);
67 bool endDrawFullfilled(unsigned request_seq);
68 void removeRequest(unsigned request_seq);
69 void setCurrentSequence(unsigned request_seq);
71 /* void revertRequestingState();
72 void removeAllRequesting(); */
74 //void revertRequestingState();//???
76 /* bool queue(int request_num);
77 bool pushTop(int request_num);
79 void deleteAllElement();
80 void removeElement(int request_num);
81 bool hasElement(int request_num); */
84 std::vector<WMRequest> req_list;
85 std::map<std::string, WMClient> client_list;
90 #endif // ALLOCATE_LIST_HPP