VPTissue Reference Manual
parex_server.cpp
Go to the documentation of this file.
1 /*
2  * Copyright 2011-2016 Universiteit Antwerpen
3  *
4  * Licensed under the EUPL, Version 1.1 or as soon they will be approved by
5  * the European Commission - subsequent versions of the EUPL (the "Licence");
6  * You may not use this work except in compliance with the Licence.
7  * You may obtain a copy of the Licence at: http://ec.europa.eu/idabc/eupl5
8  *
9  * Unless required by applicable law or agreed to in writing, software
10  * distributed under the Licence is distributed on an "AS IS" basis,
11  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12  * See the Licence for the specific language governing
13  * permissions and limitations under the Licence.
14  */
20 #include "parex_server_mode.h"
21 
22 #include "parex_server/Server.h"
23 
24 #include <QCoreApplication>
25 #include <tclap/CmdLine.h>
26 #include <tclap/ValueArg.h>
27 
28 namespace Modes {
29 
30 int ParexServerMode::operator()(int argc, char** argv)
31 {
32  QCoreApplication app(argc,argv);
33 
34  TCLAP::CmdLine cmdLine("SimPT Parex Server");
35  TCLAP::ValueArg<int> nodesArg(
36  "n", "nodes", "The minimum number of nodes that a server needs to connect with.",
37  false, 0, "MIN_NODES", cmdLine);
38  TCLAP::ValueArg<int> portArg(
39  "p", "port", "The port used by clients to connect to.", false, 8888, "PORT", cmdLine);
40  cmdLine.parse(argc, argv);
41 
42  const int min_nodes = nodesArg.getValue();
43  const int port_number = portArg.getValue();
44  new SimPT_Parex::Server(min_nodes, port_number, &app);
45 
46  return app.exec();
47 }
48 
49 } // namespace
Namespace for startup modes for simPT tools.
Definition: mode_manager.h:36
Interface/Implementation for the exec modes.
Interface for Server.
Server class accepting TCP connections and setting up the server structures.
Definition: Server.h:32