Mir
persistent_surface_store.h
Go to the documentation of this file.
1 /*
2  * Copyright © 2015 Canonical Ltd.
3  *
4  * This program is free software: you can redistribute it and/or modify
5  * it under the terms of the GNU General Public License version 3 as
6  * published by the Free Software Foundation.
7  *
8  * This program is distributed in the hope that it will be useful,
9  * but WITHOUT ANY WARRANTY; without even the implied warranty of
10  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11  * GNU General Public License for more details.
12  *
13  * You should have received a copy of the GNU General Public License
14  * along with this program. If not, see <http://www.gnu.org/licenses/>.
15  *
16  * Authored by: Christopher James Halse Rogers <christopher.halse.rogers@canonical.com>
17  */
18 
19 #ifndef MIR_SHELL_PERSISTENT_SURFACE_STORE_H_
20 #define MIR_SHELL_PERSISTENT_SURFACE_STORE_H_
21 
22 #include <memory>
23 #include <vector>
24 #include <array>
25 #include <uuid/uuid.h>
26 
27 
28 namespace mir
29 {
30 namespace scene
31 {
32 class Surface;
33 }
34 
35 namespace shell
36 {
47 {
48 public:
49  class Id;
50 
51  virtual ~PersistentSurfaceStore() = default;
52 
60  virtual Id id_for_surface(std::shared_ptr<scene::Surface> const& surface) = 0;
61 
69  virtual std::shared_ptr<scene::Surface> surface_for_id(Id const& id) const = 0;
70 };
71 }
72 }
73 
74 namespace std
75 {
76 template<>
77 struct hash<mir::shell::PersistentSurfaceStore::Id>;
78 }
79 
80 namespace mir
81 {
82 namespace shell
83 {
84 
86 {
87 public:
91  Id();
92 
98  Id(std::string const& serialized_form);
99 
100  Id(Id const& rhs);
101  Id& operator=(Id const& rhs);
102 
103  bool operator==(Id const& rhs) const;
104 
109  std::string serialize_to_string() const;
110 private:
111  friend struct std::hash<Id>;
112 
113  uuid_t uuid;
114 };
115 
116 }
117 }
118 
119 namespace std
120 {
121 template<>
123 {
125  typedef std::size_t result_type;
126 
127  result_type operator()(argument_type const& uuid) const;
128 };
129 }
130 
131 #endif // MIR_SHELL_PERSISTENT_SURFACE_STORE_H_
All things Mir.
Definition: atomic_callback.h:25
mir::shell::PersistentSurfaceStore::Id Id
Definition: persistent_surface_store.cpp:24
bool operator==(const SurfaceCreationParameters &lhs, const SurfaceCreationParameters &rhs)
Definition: surface_creation_parameters.cpp:137
STL namespace.
A store for Surface information divorced from the lifetime of any given Session.
Definition: persistent_surface_store.h:46
mir::shell::PersistentSurfaceStore::Id argument_type
Definition: persistent_surface_store.h:124
Definition: persistent_surface_store.h:85
std::size_t result_type
Definition: persistent_surface_store.h:125

Copyright © 2012-2015 Canonical Ltd.
Generated on Thu Sep 8 14:50:19 UTC 2016