00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00024 #ifndef SCALESTACK_KERNEL_OPTION_H
00025 #define SCALESTACK_KERNEL_OPTION_H
00026
00027 #include <string>
00028 #include <utility>
00029 #include <vector>
00030
00031 #include <scalestack/kernel/macros.h>
00032
00033 namespace scalestack
00034 {
00035 namespace kernel
00036 {
00037
00038 class module;
00039
00044 class SCALESTACK_API option
00045 {
00046 public:
00047
00048 ~option();
00049
00053 module& get_module(void) const;
00054
00058 const std::string& get_name(void) const;
00059
00063 const std::string& get_help(void) const;
00064
00068 const std::string& get_value_name(void) const;
00069
00073 const std::string& get_default_value(void) const;
00074
00078 const std::string& get_value(void) const;
00079
00083 int get_int_value(void) const;
00084
00088 size_t get_size_value(void) const;
00089
00093 bool get_bool_value(void) const;
00094
00099 std::vector<std::string> get_list_value(void) const;
00100
00105 bool is_valid(void) const;
00106
00107 private:
00108
00115 SCALESTACK_LOCAL
00116 option(module& module, const std::string& name);
00117
00121 SCALESTACK_LOCAL
00122 option(const option&);
00123
00127 SCALESTACK_LOCAL
00128 option& operator=(const option&);
00129
00133 SCALESTACK_LOCAL
00134 void _set_help(const std::string& help);
00135
00139 SCALESTACK_LOCAL
00140 void _set_value_name(const std::string& value_name);
00141
00145 SCALESTACK_LOCAL
00146 void _set_default_value(const std::string& default_value);
00147
00151 SCALESTACK_LOCAL
00152 void _set_value(const std::string& value, bool overwrite);
00153
00157 SCALESTACK_LOCAL
00158 void _set_valid(bool valid);
00159
00163 SCALESTACK_LOCAL
00164 void _print_help(void);
00165
00169 SCALESTACK_LOCAL
00170 void _print_config(void);
00171
00172 bool _is_valid;
00173 bool _is_set;
00174 module& _module;
00175 const std::string _name;
00176 std::string _help;
00177 std::string _value_name;
00178 std::string _default_value;
00179 std::string _value;
00180
00181 friend class module;
00182 };
00183
00184 }
00185 }
00186
00187 #endif