28 #ifndef Common_Config_h
29 #define Common_Config_h
43 using namespace Property;
59 return properties->has(name);
69 return properties->defaulted(name);
84 return properties->get<T>(name);
134 Desc &
file_desc(const
char *usage = NULL);
154 std::exit(EXIT_FAILURE);
166 static void init_options();
173 template <
class CarT,
class CdrT>
176 CarT::init_options();
177 CdrT::init_options();
184 CarT::on_init_error(e);
185 CdrT::on_init_error(e);
196 template <
class PolicyT>
205 template <
class PolicyListT>
207 typedef typename Meta::fold<PolicyListT,
NullPolicy,
243 bool overwrite =
false);
275 #endif // Common_Config_h
Interface and base of config policy.
PropertiesPtr properties
This singleton map stores all options.
std::string String
A String is simply a typedef to std::string.
Po::positional_options_description PositionalDesc
static void on_init_error(Exception &e)
void init(int argc, char *argv[], const Desc *desc=NULL)
Initialize with default policy.
bool default_value(int var_code)
Returns default value for given variable.
Program options handling.
static void init_options()
void parse_file(const String &fname, const Desc &desc)
Parses a configuration file and stores all configuration options into the option descriptor.
static void init_options()
Desc & cmdline_desc(const char *usage)
A macro which definds global functions like get_bool(), get_str(), get_i16() etc. ...
bool has(const String &name)
Check existence of a configuration value.
Helpers to compose init policies; allow to combine two policies into one.
std::shared_ptr< Properties > PropertiesPtr
Logging routines and macros.
Desc & file_desc(const char *usage)
Get the config file options description.
static void init_options()
void cleanup()
Free all resources used.
Po::options_description PropertiesDesc
bool defaulted(const String &name)
Check if a configuration value is defaulted.
void parse_args(int argc, char *argv[])
Initialization helper; parses the argc/argv parameters into properties, reads the configuration file...
bool allow_unregistered_options(bool choice)
Toggle allow unregistered options.
void sync_aliases()
Sync alias values.
std::recursive_mutex rec_mutex
A global (recursive) configuration mutex.
This is a generic exception class for Hypertable.
void alias(const String &cmdline_opt, const String &file_opt, bool overwrite)
Setup command line option alias for config file option.
Desc & cmdline_hidden_desc()
Get the command line hidden options description (for positional options)
#define HT_PROPERTIES_ABBR_ACCESSORS(_const_)
PositionalDesc & cmdline_positional_desc()
Get the command line positional options description.
static void on_init_error(Exception &e)
static void on_init_error(Exception &e)
Meta::fold< PolicyListT, NullPolicy, Cons< Meta::_1, Meta::_2 > >::type type