MRPT  1.9.9
test.cpp
Go to the documentation of this file.
1 /* +------------------------------------------------------------------------+
2  | Mobile Robot Programming Toolkit (MRPT) |
3  | http://www.mrpt.org/ |
4  | |
5  | Copyright (c) 2005-2018, Individual contributors, see AUTHORS file |
6  | See: http://www.mrpt.org/Authors - All rights reserved. |
7  | Released under BSD License. See details in http://www.mrpt.org/License |
8  +------------------------------------------------------------------------+ */
9 
11 #include <iostream>
12 
13 using namespace std;
14 using namespace mrpt::system;
15 
17 {
18  cout << "'threshold' is " << params["threshold"] << endl;
19  cout << "Is 'altitude' set? " << params.has("altitude") << endl;
20  cout << "Is 'level' set? " << params.has("level") << endl;
21  cout << "Level is : " << params.getWithDefaultVal("level", 666.0) << endl;
22  cout << "Dump of all params:\n" << params.getAsString() << endl;
23  cout << endl;
24 }
25 
26 // ------------------------------------------------------
27 // TestParameters
28 // ------------------------------------------------------
29 void TestParameters()
30 {
31  {
32  // Call #1
33  cout << "CALL #1 ================================\n";
35  p["threshold"] = 3.05;
36  p["altitude"] = 100;
37 
39  }
40 
41  {
42  // Call #2
43  cout << "CALL #2 ================================\n";
45  "threshold", 3.05, "altitude",
46  100.0, // *VERY IMPORTANT* If you put "100" here it will be an
47  // "int" and it will crash!!! Make sure all params are
48  // doubles!!
49  "level", -1.0, nullptr);
50 
52  }
53 }
54 
55 // ------------------------------------------------------
56 // MAIN
57 // ------------------------------------------------------
58 int main()
59 {
60  try
61  {
63 
64  return 0;
65  }
66  catch (std::exception& e)
67  {
68  std::cout << "MRPT exception caught: " << e.what() << std::endl;
69  return -1;
70  }
71  catch (...)
72  {
73  printf("Untyped exception!!");
74  return -1;
75  }
76 }
void MyCoolFunction(const TParametersDouble &params)
void TestParameters()
STL namespace.
GLfloat GLfloat p
Definition: glext.h:6305
GLenum const GLfloat * params
Definition: glext.h:3534



Page generated by Doxygen 1.8.14 for MRPT 1.9.9 Git: 7d5e6d718 Fri Aug 24 01:51:28 2018 +0200 at lun nov 2 08:35:50 CET 2020