SUMO - Simulation of Urban MObility
Main Page
Related Pages
Modules
Data Structures
Files
File List
Globals
All
Data Structures
Namespaces
Files
Functions
Variables
Typedefs
Enumerations
Enumerator
Friends
Macros
Groups
Pages
tracitestclient_main.cpp
Go to the documentation of this file.
1
/****************************************************************************/
11
/****************************************************************************/
12
// SUMO, Simulation of Urban MObility; see http://sumo-sim.org/
13
// Copyright (C) 2001-2013 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
// used namespaces
42
// ===========================================================================
43
using namespace
testclient;
44
45
46
// ===========================================================================
47
// method definitions
48
// ===========================================================================
49
int
main
(
int
argc,
char
* argv[]) {
50
std::string defFile =
""
;
51
std::string outFileName =
"testclient_out.txt"
;
52
int
port = -1;
53
std::string host =
"localhost"
;
54
55
if
((argc == 1) || (argc % 2 == 0)) {
56
std::cout <<
"Usage: TraCITestClient -def <definition_file> -p <remote port>"
57
<<
"[-h <remote host>] [-o <outputfile name>]"
<< std::endl;
58
return
0;
59
}
60
61
for
(
int
i = 1; i < argc; i++) {
62
std::string arg = argv[i];
63
if
(arg.compare(
"-def"
) == 0) {
64
defFile = argv[i + 1];
65
i++;
66
}
else
if
(arg.compare(
"-o"
) == 0) {
67
outFileName = argv[i + 1];
68
i++;
69
}
else
if
(arg.compare(
"-p"
) == 0) {
70
port = atoi(argv[i + 1]);
71
i++;
72
}
else
if
(arg.compare(
"-h"
) == 0) {
73
host = argv[i + 1];
74
i++;
75
}
else
{
76
std::cout <<
"unknown parameter: "
<< argv[i] << std::endl;
77
return
1;
78
}
79
}
80
81
if
(port == -1) {
82
std::cout <<
"Missing port"
<< std::endl;
83
return
1;
84
}
85
if
(defFile.compare(
""
) == 0) {
86
std::cout <<
"Missing definition file"
<< std::endl;
87
return
1;
88
}
89
90
TraCITestClient
client(outFileName);
91
return
!client.
run
(defFile, port, host);
92
}
windows_config.h
testclient::TraCITestClient::run
bool run(std::string fileName, int port, std::string host="localhost")
Runs a test.
Definition:
TraCITestClient.cpp:77
testclient::TraCITestClient
A test execution class.
Definition:
TraCITestClient.h:49
config.h
TraCITestClient.h
main
int main(int argc, char *argv[])
Definition:
activitygen_main.cpp:95
build
buildd
sumo-0.18.0+repack+dfsg
src
traci_testclient
tracitestclient_main.cpp
Generated on Mon Nov 18 2013 23:19:24 for SUMO - Simulation of Urban MObility by
1.8.5