Eclipse SUMO - Simulation of Urban MObility
testlibsumo_main.cpp
Go to the documentation of this file.
1 /****************************************************************************/
2 // Eclipse SUMO, Simulation of Urban MObility; see https://eclipse.org/sumo
3 // Copyright (C) 2001-2020 German Aerospace Center (DLR) and others.
4 // This program and the accompanying materials are made available under the
5 // terms of the Eclipse Public License 2.0 which is available at
6 // https://www.eclipse.org/legal/epl-2.0/
7 // This Source Code may also be made available under the following Secondary
8 // Licenses when the conditions for such availability set forth in the Eclipse
9 // Public License 2.0 are satisfied: GNU General Public License, version 2
10 // or later which is available at
11 // https://www.gnu.org/licenses/old-licenses/gpl-2.0-standalone.html
12 // SPDX-License-Identifier: EPL-2.0 OR GPL-2.0-or-later
13 /****************************************************************************/
18 // Testing libsumo for C++
19 /****************************************************************************/
20 #include <iostream>
21 #include <libsumo/Simulation.h>
22 #include <utils/common/ToString.h>
23 
24 
25 
26 // ===========================================================================
27 // main function
28 // ===========================================================================
29 int
30 main(int argc, char** argv) {
31  std::vector<std::string> options;
32  for (int i = 1; i < argc; i++) {
33  options.push_back(argv[i]);
34  }
35  libsumo::Simulation::load(options);
36  std::cout << "Simulation loaded\n";
37  /*
38  std::vector<libsumo::TraCIStage> result = libsumo::Simulation::findIntermodalRoute("64455492", "-22913705", "public", 21600, 3, -1, -1, 0, 0,0,"ped");
39  double cost = 0;
40  double time = 0;
41  for (const auto& stage : result)
42  {
43  std::cout << " type=" << stage.type << " line=" << stage.line << " travelTime=" << stage.travelTime << " cost=" << stage.cost << " destination: "<< stage.destStop<<"\n";
44  std::cout << "Descr:\n" << stage.description<< std::endl<<std::endl;
45  cost += stage.cost;
46  time += stage.travelTime;
47  }
48  std::cout<<"end cost: "<<cost<<std::endl;
49  std::cout<<"end time: "<<time<<std::endl;
50  */
51 }
52 
53 
54 /****************************************************************************/
int main(int argc, char **argv)