SUMO - Simulation of Urban MObility
Main Page
Related Pages
Modules
Data Structures
Files
File List
Globals
tracitestclient_main.cpp
Go to the documentation of this file.
1
/****************************************************************************/
11
/****************************************************************************/
12
// SUMO, Simulation of Urban MObility; see http://sumo.dlr.de/
13
// Copyright (C) 2001-2015 DLR (http://www.dlr.de/) and contributors
14
/****************************************************************************/
15
//
16
// This file is part of SUMO.
17
// SUMO is free software: you can redistribute it and/or modify
18
// it under the terms of the GNU General Public License as published by
19
// the Free Software Foundation, either version 3 of the License, or
20
// (at your option) any later version.
21
//
22
/****************************************************************************/
23
24
25
// ===========================================================================
26
// included modules
27
// ===========================================================================
28
#ifdef _MSC_VER
29
#include <
windows_config.h
>
30
#else
31
#include <
config.h
>
32
#endif
33
34
#include <iostream>
35
#include <string>
36
#include <cstdlib>
37
#include "
TraCITestClient.h
"
38
39
40
// ===========================================================================
41
// method definitions
42
// ===========================================================================
43
int
main
(
int
argc,
char
* argv[]) {
44
std::string defFile =
""
;
45
std::string outFileName =
"testclient_out.txt"
;
46
int
port = -1;
47
std::string host =
"localhost"
;
48
49
if
((argc == 1) || (argc % 2 == 0)) {
50
std::cout <<
"Usage: TraCITestClient -def <definition_file> -p <remote port>"
51
<<
"[-h <remote host>] [-o <outputfile name>]"
<< std::endl;
52
return
0;
53
}
54
55
for
(
int
i = 1; i < argc; i++) {
56
std::string arg = argv[i];
57
if
(arg.compare(
"-def"
) == 0) {
58
defFile = argv[i + 1];
59
i++;
60
}
else
if
(arg.compare(
"-o"
) == 0) {
61
outFileName = argv[i + 1];
62
i++;
63
}
else
if
(arg.compare(
"-p"
) == 0) {
64
port = atoi(argv[i + 1]);
65
i++;
66
}
else
if
(arg.compare(
"-h"
) == 0) {
67
host = argv[i + 1];
68
i++;
69
}
else
{
70
std::cout <<
"unknown parameter: "
<< argv[i] << std::endl;
71
return
1;
72
}
73
}
74
75
if
(port == -1) {
76
std::cout <<
"Missing port"
<< std::endl;
77
return
1;
78
}
79
if
(defFile.compare(
""
) == 0) {
80
std::cout <<
"Missing definition file"
<< std::endl;
81
return
1;
82
}
83
84
TraCITestClient
client(outFileName);
85
return
!client.
run
(defFile, port, host);
86
}
TraCITestClient
A test execution class.
Definition:
TraCITestClient.h:47
windows_config.h
config.h
TraCITestClient::run
bool run(std::string fileName, int port, std::string host="localhost")
Runs a test.
Definition:
TraCITestClient.cpp:72
main
int main(int argc, char *argv[])
Definition:
tracitestclient_main.cpp:43
TraCITestClient.h
build
sumo-3Ncg_a
sumo-0.23.0+dfsg1
src
traci_testclient
tracitestclient_main.cpp
Generated by
1.8.9.1