Mir
scene.h
Go to the documentation of this file.
1 /*
2  * Copyright © 2012 Canonical Ltd.
3  *
4  * This program is free software: you can redistribute it and/or modify it
5  * under the terms of the GNU General Public License version 3,
6  * as 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: Robert Carr <robert.carr@canonical.com>
17  */
18 
19 #ifndef MIR_COMPOSITOR_SCENE_H_
20 #define MIR_COMPOSITOR_SCENE_H_
21 
22 #include "compositor_id.h"
23 
24 #include <memory>
25 #include <vector>
26 
27 namespace mir
28 {
29 namespace scene
30 {
31 class Observer;
32 }
33 
34 namespace compositor
35 {
36 
37 class SceneElement;
38 using SceneElementSequence = std::vector<std::shared_ptr<SceneElement>>;
39 
40 class Scene
41 {
42 public:
43  virtual ~Scene() {}
44 
57 
66  virtual int frames_pending(CompositorID id) const = 0;
67 
68  virtual void register_compositor(CompositorID id) = 0;
69  virtual void unregister_compositor(CompositorID id) = 0;
70 
71  virtual void add_observer(std::shared_ptr<scene::Observer> const& observer) = 0;
72  virtual void remove_observer(std::weak_ptr<scene::Observer> const& observer) = 0;
73 
74 protected:
75  Scene() = default;
76 
77 private:
78  Scene(Scene const&) = delete;
79  Scene& operator=(Scene const&) = delete;
80 };
81 
82 }
83 }
84 
85 #endif /* MIR_COMPOSITOR_SCENE_H_ */
All things Mir.
Definition: atomic_callback.h:25
virtual int frames_pending(CompositorID id) const =0
Return the number of additional frames that you need to render to get fully up to date with the lates...
virtual SceneElementSequence scene_elements_for(CompositorID id)=0
Generate a valid sequence of scene elements based on the current state of the Scene.
virtual void remove_observer(std::weak_ptr< scene::Observer > const &observer)=0
virtual void register_compositor(CompositorID id)=0
virtual void unregister_compositor(CompositorID id)=0
std::vector< std::shared_ptr< SceneElement >> SceneElementSequence
Definition: scene.h:38
Definition: scene.h:40
virtual ~Scene()
Definition: scene.h:43
void const * CompositorID
Definition: compositor_id.h:27
virtual void add_observer(std::shared_ptr< scene::Observer > const &observer)=0

Copyright © 2012-2015 Canonical Ltd.
Generated on Thu Oct 8 16:20:16 UTC 2015