Mir
platform.h
Go to the documentation of this file.
1 /*
2  * Copyright © 2014-2015 Canonical Ltd.
3  *
4  * This program is free software: you can redistribute it and/or modify it
5  * under the terms of the GNU Lesser 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 Lesser General Public License for more details.
12  *
13  * You should have received a copy of the GNU Lesser General Public License
14  * along with this program. If not, see <http://www.gnu.org/licenses/>.
15  *
16  * Authored by:
17  * Andreas Pokorny <andreas.pokorny@canonical.com>
18  */
19 
20 #ifndef MIR_INPUT_PLATFORM_H_
21 #define MIR_INPUT_PLATFORM_H_
22 
23 #include "mir/module_properties.h"
24 
25 #include <mir/options/option.h>
26 #include <mir/module_deleter.h>
27 
28 #include <boost/program_options/options_description.hpp>
29 
30 #include <memory>
31 
32 namespace mir
33 {
34 class EmergencyCleanupRegistry;
35 
36 namespace dispatch
37 {
38 class Dispatchable;
39 }
40 
41 namespace input
42 {
43 class InputDevice;
44 class InputReport;
45 class InputDeviceRegistry;
46 class InputPlatformPolicy;
47 
48 enum class PlatformPriority : uint32_t
49 {
50  unsupported = 0,
51  dummy = 1,
52  supported = 128,
53  best = 256,
54 };
55 
65 class Platform
66 {
67 public:
68  Platform() = default;
69  virtual ~Platform() = default;
70 
74  virtual std::shared_ptr<mir::dispatch::Dispatchable> dispatchable() = 0;
75 
82  virtual void start() = 0;
86  virtual void stop() = 0;
87 
88 private:
89  Platform(Platform const&) = delete;
90  Platform& operator=(Platform const&) = delete;
91 };
92 
93 typedef mir::UniqueModulePtr<Platform>(*CreatePlatform)(
94  std::shared_ptr<options::Option> const& options,
95  std::shared_ptr<EmergencyCleanupRegistry> const& emergency_cleanup_registry,
96  std::shared_ptr<InputDeviceRegistry> const& input_device_registry,
97  std::shared_ptr<InputReport> const& report);
98 
99 typedef void(*AddPlatformOptions)(
100  boost::program_options::options_description& config);
101 
103  options::Option const& options);
104 
105 typedef ModuleProperties const*(*DescribeModule)();
106 
107 }
108 }
109 
110 extern "C"
111 {
126  std::shared_ptr<mir::options::Option> const& options,
127  std::shared_ptr<mir::EmergencyCleanupRegistry> const& emergency_cleanup_registry,
128  std::shared_ptr<mir::input::InputDeviceRegistry> const& input_device_registry,
129  std::shared_ptr<mir::input::InputReport> const& report);
130 
140 void add_input_platform_options(boost::program_options::options_description& config);
141 
153 
162 }
163 #endif // MIR_INPUT_PLATFORM_H_
mir::ModuleProperties const * describe_input_module()
describe_input_module should return a description of the input platform.
Definition: platform_factory.cpp:100
All things Mir.
Definition: atomic_callback.h:25
virtual ~Platform()=default
mir::UniqueModulePtr< mir::input::Platform > create_input_platform(std::shared_ptr< mir::options::Option > const &options, std::shared_ptr< mir::EmergencyCleanupRegistry > const &emergency_cleanup_registry, std::shared_ptr< mir::input::InputDeviceRegistry > const &input_device_registry, std::shared_ptr< mir::input::InputReport > const &report)
Function used to initialize an input platform.
PlatformPriority(* ProbePlatform)(options::Option const &options)
Definition: platform.h:102
PlatformPriority
Definition: platform.h:48
virtual void start()=0
Input Platform is used to discover and access available input devices.
Definition: platform.h:65
std::unique_ptr< T, ModuleDeleter< T >> UniqueModulePtr
Use UniqueModulePtr to ensure that your loadable libray outlives instances created within it...
Definition: module_deleter.h:83
mir::input::PlatformPriority probe_input_platform(mir::options::Option const &options)
probe_platform should indicate whether the platform is able to work within the current environment...
Definition: platform_factory.cpp:86
virtual std::shared_ptr< mir::dispatch::Dispatchable > dispatchable()=0
void(* AddPlatformOptions)(boost::program_options::options_description &config)
Definition: platform.h:99
Describes a platform module.
Definition: module_properties.h:28
void add_input_platform_options(boost::program_options::options_description &config)
Function used to add additional configuration options.
Definition: platform_factory.cpp:80
Definition: option.h:33
virtual void stop()=0

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