~cyphermox/+junk/test-cross-compile

« back to all changes in this revision

Viewing changes to include/server/mir/default_configuration_options.h

  • Committer: Tarmac
  • Author(s): Alan Griffiths
  • Date: 2013-10-23 12:08:21 UTC
  • mfrom: (1151.2.8 mir)
  • Revision ID: tarmac-20131023120821-8eblbuswa301uul4
config: separate out the configuration options from the configuration builder.

Approved by PS Jenkins bot, Alexandros Frantzis, Kevin DuBois.

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
/*
 
2
 * Copyright © 2013 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: Alan Griffiths <alan@octopull.co.uk>
 
17
 */
 
18
 
 
19
#ifndef MIR_DEFAULT_CONFIGURATION_OPTIONS_H_
 
20
#define MIR_DEFAULT_CONFIGURATION_OPTIONS_H_
 
21
 
 
22
#include "mir/options/program_option.h"
 
23
 
 
24
#include <memory>
 
25
 
 
26
namespace mir
 
27
{
 
28
class ConfigurationOptions
 
29
{
 
30
public:
 
31
    static char const* const server_socket_opt;
 
32
    static char const* const no_server_socket_opt;
 
33
    static char const* const session_mediator_report_opt;
 
34
    static char const* const msg_processor_report_opt;
 
35
    static char const* const display_report_opt;
 
36
    static char const* const legacy_input_report_opt;
 
37
    static char const* const connector_report_opt;
 
38
    static char const* const input_report_opt;
 
39
    static char const* const host_socket_opt;
 
40
    static char const* const standalone_opt;
 
41
    static char const* const frontend_threads;
 
42
 
 
43
    static char const* const glog;
 
44
    static char const* const glog_stderrthreshold;
 
45
    static char const* const glog_minloglevel;
 
46
    static char const* const glog_log_dir;
 
47
    static char const* const glog_log_dir_default;
 
48
    static int const glog_stderrthreshold_default;
 
49
    static int const glog_minloglevel_default;
 
50
 
 
51
    static bool const enable_input_default;
 
52
 
 
53
    static char const* const off_opt_value;
 
54
    static char const* const log_opt_value;
 
55
    static char const* const lttng_opt_value;
 
56
 
 
57
    static char const* const platform_graphics_lib;
 
58
    static char const* const default_platform_graphics_lib;
 
59
 
 
60
    virtual std::shared_ptr<options::Option> the_options() const = 0;
 
61
 
 
62
protected:
 
63
 
 
64
    int default_ipc_threads = 10;
 
65
 
 
66
    ConfigurationOptions() = default;
 
67
    virtual ~ConfigurationOptions() = default;
 
68
    ConfigurationOptions(ConfigurationOptions const&) = delete;
 
69
    ConfigurationOptions& operator=(ConfigurationOptions const&) = delete;
 
70
};
 
71
 
 
72
class DefaultConfigurationOptions : public ConfigurationOptions
 
73
{
 
74
public:
 
75
    DefaultConfigurationOptions(int argc, char const* argv[]);
 
76
    virtual ~DefaultConfigurationOptions() = default;
 
77
 
 
78
protected:
 
79
    // add_options() allows configuration specializations to add their
 
80
    // own options. This MUST be called before the first invocation of
 
81
    // the_options() - typically during construction.
 
82
    boost::program_options::options_description_easy_init add_options();
 
83
    virtual void parse_options(boost::program_options::options_description& options_description, options::ProgramOption& options) const;
 
84
    virtual std::shared_ptr<options::Option> the_options() const;
 
85
 
 
86
private:
 
87
    int const argc;
 
88
    char const** const argv;
 
89
    std::shared_ptr<boost::program_options::options_description> const program_options;
 
90
    std::shared_ptr<options::Option> mutable options;
 
91
};
 
92
}
 
93
 
 
94
 
 
95
#endif /* MIR_DEFAULT_CONFIGURATION_OPTIONS_H_ */