Rename windowmanager-client
[apps/agl-service-windowmanager.git] / src / applist.hpp
index 55355ef..241f153 100644 (file)
 #include <map>
 #include <memory>
 //#include <experimental/optional>
-#include "windowmanager-client.hpp"
+#include "wm-client.hpp"
+#include "request.hpp"
 
-namespace wm {
+namespace wm
+{
 
 /* using std::experimental::nullopt;
 using std::experimental::optional; */
 
-typedef enum Task{
-    TASK_ALLOCATE,
-    TASK_RELEASE
-}ResourceTask;
-
-struct WMRequest{
-    explicit WMRequest(std::string appid, std::string role,
-        std::string area, ResourceTask task);
-    virtual ~WMRequest();
-    WMRequest(const WMRequest &obj);
-
-    std::string appid;
-    std::string role;
-    std::string area;
-    Task task;
-    unsigned seq_num;
-    bool allocating;
-    bool end_draw_finished;
-};
-
-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);
+    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();
     std::shared_ptr<WMClient> lookUpClient(const std::string &appid);
+    void removeSurface(unsigned surface);
 
     // Request Interface
     unsigned currentSequenceNumber();
@@ -68,29 +54,25 @@ public:
     if appid is key to manage resources, it is better to select std::string
     otherwise WMClient is better, IMO */
     bool requestFinished();
-    unsigned lookUpAllocatingApp(const std::string &appid);
-    void setEndDrawFinished(unsigned request_seq, const std::string &role);
-    bool endDrawFullfilled(unsigned request_seq);
-    void removeRequest(unsigned request_seq);
-    void setCurrentSequence(unsigned request_seq);
+    bool setAction(unsigned req_num, const struct WMAction &action);
+    bool setAction(unsigned req_num, const std::string &appid, const std::string &role, const std::string &area, bool visible = true);
+    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();
-    /* void revertRequestingState();
-    void removeAllRequesting(); */
 
-    //void revertRequestingState();//???
+    struct WMTrigger getRequest(unsigned req_num);
+    const std::vector<struct WMAction> &getActions(unsigned req_num);
 
-    /* bool queue(int request_num);
-    bool pushTop(int request_num);
-    bool dequeue();
-    void deleteAllElement();
-    void removeElement(int request_num);
-    bool hasElement(int request_num); */
+    void client_dump();
+    void req_dump();
 
-private:
+  private:
     std::vector<WMRequest> req_list;
     std::unordered_map<std::string, std::shared_ptr<WMClient>> client_list;
     unsigned current_seq;
 };
 
-}
+} // namespace wm
 #endif // ALLOCATE_LIST_HPP
\ No newline at end of file