X-Git-Url: https://gerrit.automotivelinux.org/gerrit/gitweb?a=blobdiff_plain;ds=sidebyside;f=src%2Fapplist.hpp;h=a794b532c8072cab37f1aedcafd93fa6b9987b5d;hb=5562332f0f7e916d4da13eab5e2b01ccdfb184ac;hp=e0d67fcca539d720b3e2dcd247df941842ef407b;hpb=45ff324610e21ffd0292bdd1e39726c808a41725;p=apps%2Fagl-service-windowmanager.git diff --git a/src/applist.hpp b/src/applist.hpp index e0d67fc..a794b53 100644 --- a/src/applist.hpp +++ b/src/applist.hpp @@ -20,54 +20,62 @@ #include #include #include -//#include -#include "windowmanager-client.hpp" +#include +#include "wm_client.hpp" #include "request.hpp" +#include "wm_error.hpp" -namespace wm { +namespace wm +{ /* using std::experimental::nullopt; using std::experimental::optional; */ -class AppList { -public: +class AppList +{ + public: AppList(); virtual ~AppList(); AppList(const AppList &obj) = delete; // Client Database Interface - void addClient(const std::string &appid, const std::string &role); + /* TODO: consider, which is better WMClient as parameter or not + If the WMClient should be more flexible, I think this param should be WMClient class + */ + void addClient(const std::string &appid, unsigned layer, + unsigned surface,const std::string &role); void removeClient(const std::string &appid); - bool contains(const std::string &appid); - int countClient(); + bool contains(const std::string &appid) const; + int countClient() const; std::shared_ptr lookUpClient(const std::string &appid); + void removeSurface(unsigned surface); + std::string getAppID(unsigned surface, const std::string &role, bool *found) const; // Request Interface - unsigned currentSequenceNumber(); - unsigned getSequenceNumber(const std::string &appid); - unsigned addAllocateRequest(WMRequest req); - /* TODO: consider, which is better WMClient or std::string appid? - if appid is key to manage resources, it is better to select std::string - otherwise WMClient is better, IMO */ - bool requestFinished(); - bool setAction(unsigned request_seq, const std::string &appid, const std::string &role, const std::string &area); - bool setEndDrawFinished(unsigned request_seq, const std::string &appid, const std::string &role); - bool endDrawFullfilled(unsigned request_seq); - void removeRequest(unsigned request_seq); - void next(); - bool haveRequest(); + unsigned currentRequestNumber() const; + unsigned getRequestNumber(const std::string &appid) const; + unsigned addRequest(WMRequest req); + WMError setAction(unsigned req_num, const struct WMAction &action); + WMError setAction(unsigned req_num, const std::string &appid, + const std::string &role, const std::string &area, TaskVisible visible); + bool setEndDrawFinished(unsigned req_num, const std::string &appid, const std::string &role); + bool endDrawFullfilled(unsigned req_num); + void removeRequest(unsigned req_num); + void next(); + bool haveRequest() const; - struct WMTrigger getRequest(unsigned request_seq); - const std::vector& getActions(unsigned request_seq); + struct WMTrigger getRequest(unsigned req_num, bool* found); + const std::vector &getActions(unsigned req_num, bool* found); - void client_dump(); - void req_dump(); + void clientDump(); + void reqDump(); -private: - std::vector req_list; - std::unordered_map> client_list; - unsigned current_seq; + private: + std::vector req_list; + std::unordered_map> app2client; + unsigned current_req; + std::mutex mtx; }; -} +} // namespace wm #endif // ALLOCATE_LIST_HPP \ No newline at end of file