tools:config
                Differences
This shows you the differences between two versions of the page.
| Both sides previous revisionPrevious revisionNext revision | Previous revision | ||
| tools:config [2018/01/12 09:27] – graf | tools:config [2020/12/03 12:01] (current) – ursgraf | ||
|---|---|---|---|
| Line 4: | Line 4: | ||
| TestConfig : public eeros:: | TestConfig : public eeros:: | ||
| public: | public: | ||
| - | TestConfig(const char *name) : | + | TestConfig(const char *name) : FileConfig(name), | 
| - |  | + | |
| - | // set default values | + | |
| - | a(1), | + | |
| - |  | + | |
| - | c{0.1, 0.2, 0.3}, | + | |
| - |  | + | |
| add(" | add(" | ||
| add(" | add(" | ||
| Line 23: | Line 17: | ||
| </ | </ | ||
| - | When such a configuration class object is created, | + | The above example shows such a configuration class. When an object | 
| <code cpp> | <code cpp> | ||
| TestConfig configFile(" | TestConfig configFile(" | ||
| </ | </ | ||
| - | However, if a configuration file exists at the given location, you can load the values from there and overwrite | + | |
| + | If a configuration file exists at the given location, you can load the values from there and overwrite | ||
| <code cpp> | <code cpp> | ||
| TestConfig configFile(" | TestConfig configFile(" | ||
| configFile.load(); | configFile.load(); | ||
| </ | </ | ||
| - | WARNING Valid name for the identifiers of the values include | + | |
| + | WARNING Valid name for the identifiers of the values | ||
| You can manually create a suitable configuration file at the given location, e.g. | You can manually create a suitable configuration file at the given location, e.g. | ||
| < | < | ||
| Line 39: | Line 36: | ||
| initValues = 0.1, 0.4, 0.3 | initValues = 0.1, 0.4, 0.3 | ||
| ip = 127.0.0.0 | ip = 127.0.0.0 | ||
| - | |||
| </ | </ | ||
| or you could save the values of your configuration class object into the file (and possible change an existing content). | or you could save the values of your configuration class object into the file (and possible change an existing content). | ||
| Line 49: | Line 45: | ||
| configFile.save(" | configFile.save(" | ||
| configFile.load(" | configFile.load(" | ||
| + | </ | ||
| + | |||
| + | There is a complete example in the example directory of EEROS. Open a shell in the build directory of your EEROS library and run | ||
| + | < | ||
| + | $ ./ | ||
| </ | </ | ||
tools/config.1515745641.txt.gz · Last modified: 2018/01/12 09:27 (external edit)
                
                