configfile_test.cpp
Go to the documentation of this file.
1 /*****************************************************************
2  *
3  * This file is part of the GMAPPING project
4  *
5  * GMAPPING Copyright (c) 2004 Giorgio Grisetti,
6  * Cyrill Stachniss, and Wolfram Burgard
7  *
8  * This software is licensed under the 3-Clause BSD License
9  * and is copyrighted by Giorgio Grisetti, Cyrill Stachniss,
10  * and Wolfram Burgard.
11  *
12  * Further information on this license can be found at:
13  * https://opensource.org/licenses/BSD-3-Clause
14  *
15  * GMAPPING is distributed in the hope that it will be useful,
16  * but WITHOUT ANY WARRANTY; without even the implied
17  * warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
18  * PURPOSE.
19  *
20  *****************************************************************/
21 
22 
23 #include <cstdlib>
24 #include <iostream>
26 
27 using namespace std;
28 using namespace GMapping;
29 
30 int main(int argc, char** argv) {
31 
32  if (argc != 2) {
33  cerr << "Usage: " << argv[0] << " [initifle]" << endl;
34  exit(0);
35  }
36 
37  ConfigFile cfg;
38  cfg.read(argv[argc-1]);
39 
40  cout << "-- values from configfile --" << endl;
41  cfg.dumpValues(cout);
42 
43  cout << "-- adding a value --" << endl;
44  cfg.value("unkown","unkown",std::string("the new value!"));
45 
46 
47 
48 
49 
50  cout << "-- values from configfile & added values --" << endl;
51  cfg.dumpValues(cout);
52 
53  if ( ((std::string) cfg.value("unkown","unkown",std::string("the new value!"))) != std::string("the new value!"))
54  cerr << "strange error, check strings" << endl;
55 
56  return 0;
57 }
GMapping::ConfigFile
Definition: configfile.h:85
GMapping
Definition: configfile.cpp:34
GMapping::ConfigFile::dumpValues
void dumpValues(std::ostream &out)
Definition: configfile.cpp:284
GMapping::ConfigFile::value
const AutoVal & value(const std::string &section, const std::string &entry) const
Definition: configfile.cpp:227
GMapping::ConfigFile::read
bool read(const std::string &configFile)
Definition: configfile.cpp:191
main
int main(int argc, char **argv)
Definition: configfile_test.cpp:30
configfile.h


openslam_gmapping
Author(s): Cyrill Stachniss, Udo Frese, Giorgio Grisetti, Wolfram Burgard
autogenerated on Thu Oct 19 2023 02:25:51