source: subversion/applications/utils/import/srtm2wayinfo/settings.h

Last change on this file was 16915, checked in by herm, 8 years ago

Support for different memory managment systems.

File size: 1.9 KB
Line 
1/* Copyright (c) 2009 Hermann Kraus
2 * This software is available under a "MIT Style" license
3 * (see COPYING).
4 */
5/** \file
6  * Handles command line parsing and stores the options.
7  */
8#ifndef __SETTINGS_H__
9#define __SETTINGS_H__
10
11/** Defines for different input sizes. */
12typedef enum {
13    size_small,
14    size_medium,
15    size_large,
16} dataset_size;
17
18/** Stores all settings. */
19class Settings
20{
21    public:
22        Settings() {
23            store_uncompressed = false;
24            srtm_server = 0;
25            input = 0;
26            output = 0;
27            size = size_small;
28        };
29       
30        void parseSettings(int argc, char **argv);
31       
32        /** Get input file.
33          *
34          * If none is given read from stdin. */
35        const char *getInput() const {
36            if (input) return input;
37            return "/dev/stdin";
38        }
39
40        /** Get output file.
41          *
42          * If none is given write to stdout. */
43        const char *getOutput() const {
44            if (output) return output;
45            return "/dev/stdout";
46        }
47
48        /** Get URL of SRTM server. */
49        const char *getSrtmServer() const {
50            if (srtm_server) return srtm_server;
51            return "http://dds.cr.usgs.gov/srtm/version2_1/SRTM3/";
52        }
53
54        /** Get cache dir. */
55        const char *getCacheDir() const {
56            if (cache_dir) return cache_dir;
57            return "cache";
58        }
59
60        /** Should the uncompressed data also be stored on disk? */
61        bool getStoreUncompressed() const { return store_uncompressed; }
62       
63        void usage();
64
65        /** For which input data size should the node and way storage be optimized? */
66        dataset_size getDatasetSize() const { return size; }
67    private:
68        bool store_uncompressed;
69        char *srtm_server;
70        char *input;
71        char *output;
72        char *cache_dir;
73        dataset_size size;
74};
75
76extern Settings global_settings;
77
78
79#endif
Note: See TracBrowser for help on using the repository browser.