0.9.8.10
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Modules Pages
Config.cc
Go to the documentation of this file.
1 
22 #include "Common/Compat.h"
23 #include "Common/InetAddr.h"
24 #include "Config.h"
25 
26 namespace Hypertable { namespace Config {
27 
29  cmdline_desc().add_options()
30  ("master", str(),
31  "master server to connect in <host:port> format")
32  ;
33  // hidden aliases
34  alias("master-host", "Hypertable.Master.Host");
35  alias("master-port", "Hypertable.Master.Port");
36 }
37 
39  if (properties->has("master")) {
40  Endpoint e = InetAddr::parse_endpoint(get_str("master"));
41  bool defaulted = properties->defaulted("master");
42  properties->set("master-host", e.host, defaulted);
43  properties->set("master-port", e.port, !e.port || defaulted);
44  }
45  else
46  properties->set("master-host", String("localhost"));
47 }
48 
50  cmdline_desc().add_options()
51  ("range-server", str(),
52  "range server to connect in <host:port> format")
53  ;
54  // hidden aliases
55  alias("rs-port", "Hypertable.RangeServer.Port");
56 }
57 
59  if (properties->has("range-server")) {
60  Endpoint e = InetAddr::parse_endpoint(get_str("range-server"));
61  bool defaulted = properties->defaulted("range-server");
62  properties->set("rs-host", e.host, defaulted);
63  properties->set("rs-port", e.port, !e.port || defaulted);
64  }
65  else
66  properties->set("rs-host", String("localhost"));
67 }
68 
69 }} // namespace Hypertable::Config
PropertiesPtr properties
This singleton map stores all options.
Definition: Config.cc:47
std::string String
A String is simply a typedef to std::string.
Definition: String.h:44
static Endpoint parse_endpoint(const char *endpoint, int defport=0)
Parse an endpoint string in (host:port) format.
Definition: InetAddr.cc:181
void init_master_client_options()
Definition: Config.cc:28
Po::typed_value< String > * str(String *v=0)
Definition: Properties.h:166
void init_range_server_client_options()
Definition: Config.cc:49
Desc & cmdline_desc(const char *usage)
A macro which definds global functions like get_bool(), get_str(), get_i16() etc. ...
Definition: Config.cc:72
Compatibility Macros for C/C++.
void init_master_client()
Definition: Config.cc:38
bool defaulted(const String &name)
Check if a configuration value is defaulted.
Definition: Config.h:67
Hypertable definitions
void init_range_server_client()
Definition: Config.cc:58
Internet address wrapper classes and utility functions.
void alias(const String &cmdline_opt, const String &file_opt, bool overwrite)
Setup command line option alias for config file option.
Definition: Config.cc:607
High-level entry point to a service; wraps a host:port pair.
Definition: InetAddr.h:44