Merge branch 'feature/e-endstop' into merge-abc-with-homing
[clinton/Smoothieware.git] / src / libs / Config.h
1 /*
2 This file is part of Smoothie (http://smoothieware.org/). The motion control part is heavily based on Grbl (https://github.com/simen/grbl).
3 Smoothie is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
4 Smoothie is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.
5 You should have received a copy of the GNU General Public License along with Smoothie. If not, see <http://www.gnu.org/licenses/>.
6 */
7
8 #ifndef CONFIG_H
9 #define CONFIG_H
10
11
12 using namespace std;
13 #include <vector>
14 #include <string>
15
16 class ConfigValue;
17 class ConfigSource;
18 class ConfigCache;
19
20 class Config {
21 public:
22 Config();
23 Config(ConfigSource*);
24 ~Config();
25
26 void config_cache_load(bool parse= true);
27 void config_cache_clear();
28 void set_string( string setting , string value);
29
30 ConfigValue* value(uint16_t check_sum_a, uint16_t check_sum_b= 0, uint16_t check_sum_c= 0 );
31 ConfigValue* value(uint16_t check_sums[3] );
32
33 void get_module_list(vector<uint16_t>* list, uint16_t family);
34 bool is_config_cache_loaded() { return config_cache != NULL; }; // Whether or not the cache is currently popluated
35
36 friend class Configurator;
37
38 private:
39 bool has_characters(uint16_t check_sum, string str );
40
41 ConfigCache* config_cache; // A cache in which ConfigValues are kept
42 vector<ConfigSource*> config_sources; // A list of all possible coniguration sources
43 };
44
45 #endif