#include <config.h>
#include <iostream>
#include <string>
#include <cstdlib>
#include "TraCITestClient.h"
Go to the source code of this file.
Functions | |
| int | main (int argc, char *argv[]) |
| int main | ( | int | argc, | |
| char * | argv[] | |||
| ) |
Definition at line 45 of file tracitestclient_main.cpp.
References testclient::TraCITestClient::run().
00045 { 00046 std::string defFile = ""; 00047 std::string outFileName = "testclient_out.txt"; 00048 int port = -1; 00049 std::string host = "localhost"; 00050 TraCITestClient* client; 00051 00052 if ((argc == 1) || (argc % 2 == 0)) { 00053 std::cout << "Usage: TraciTestClient -def <definition_file> -p <remote port>" 00054 << "[-h <remote host>] [-o <outputfile name>]" << std::endl; 00055 return 0; 00056 } 00057 00058 for (int i=1; i < argc; i++) { 00059 std::string arg = argv[i]; 00060 if (arg.compare("-def") == 0) { 00061 defFile = argv[i+1]; 00062 i++; 00063 } else if (arg.compare("-o") == 0) { 00064 outFileName = argv[i+1]; 00065 i++; 00066 } else if (arg.compare("-p") == 0) { 00067 port = atoi(argv[i+1]); 00068 i++; 00069 } else if (arg.compare("-h") == 0) { 00070 host = argv[i+1]; 00071 i++; 00072 } else { 00073 std::cout << "unknown parameter: " << argv[i] << std::endl; 00074 return 1; 00075 } 00076 } 00077 00078 if (port == -1) { 00079 std::cout << "Missing port" << std::endl; 00080 return 1; 00081 } 00082 if (defFile.compare("") == 0) { 00083 std::cout << "Missing definition file" << std::endl; 00084 return 1; 00085 } 00086 00087 client = new TraCITestClient(outFileName); 00088 bool success = client->run(defFile, port, host); 00089 delete client; 00090 00091 return !success; 00092 }
1.5.6