Applying syntactic sugar
This commit is contained in:
parent
504817058b
commit
83f0a2c094
@ -16,33 +16,31 @@ You should have received a copy of the GNU Affero General Public License
|
|||||||
along with this program; if not, write to the Free Software
|
along with this program; if not, write to the Free Software
|
||||||
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||||
or see http://www.gnu.org/licenses/agpl.txt.
|
or see http://www.gnu.org/licenses/agpl.txt.
|
||||||
|
|
||||||
Created on: 26.11.2010
|
|
||||||
Author: dennis
|
|
||||||
|
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#ifndef SERVERFACTORY_H_
|
#ifndef SERVERFACTORY_H_
|
||||||
#define SERVERFACTORY_H_
|
#define SERVERFACTORY_H_
|
||||||
|
|
||||||
#include <zlib.h>
|
|
||||||
#include "Server.h"
|
#include "Server.h"
|
||||||
|
|
||||||
#include "../Util/IniFile.h"
|
#include "../Util/IniFile.h"
|
||||||
#include "../Util/OpenMPWrapper.h"
|
|
||||||
#include "../Util/OSRMException.h"
|
|
||||||
#include "../Util/SimpleLogger.h"
|
#include "../Util/SimpleLogger.h"
|
||||||
#include "../Util/StringUtil.h"
|
#include "../Util/StringUtil.h"
|
||||||
|
|
||||||
struct ServerFactory {
|
#include <zlib.h>
|
||||||
|
|
||||||
|
#include <boost/noncopyable.hpp>
|
||||||
|
|
||||||
|
struct ServerFactory : boost::noncopyable {
|
||||||
static Server * CreateServer( IniFile & serverConfig ) {
|
static Server * CreateServer( IniFile & serverConfig ) {
|
||||||
int threads = omp_get_num_procs();
|
int threads = omp_get_num_procs();
|
||||||
if( serverConfig.GetParameter("IP").empty() ) {
|
if( serverConfig.GetParameter("IP").empty() ) {
|
||||||
serverConfig.SetParameter("IP", "0.0.0.0");
|
serverConfig.SetParameter("IP", "0.0.0.0");
|
||||||
}
|
}
|
||||||
|
|
||||||
if( serverConfig.GetParameter("Port").empty() ) {
|
if( serverConfig.GetParameter("Port").empty() ) {
|
||||||
serverConfig.SetParameter("Port", "5000");
|
serverConfig.SetParameter("Port", "5000");
|
||||||
}
|
}
|
||||||
|
|
||||||
if(
|
if(
|
||||||
stringToInt(serverConfig.GetParameter("Threads")) >= 1 &&
|
stringToInt(serverConfig.GetParameter("Threads")) >= 1 &&
|
||||||
stringToInt(serverConfig.GetParameter("Threads")) <= threads
|
stringToInt(serverConfig.GetParameter("Threads")) <= threads
|
||||||
@ -52,6 +50,7 @@ struct ServerFactory {
|
|||||||
|
|
||||||
SimpleLogger().Write() <<
|
SimpleLogger().Write() <<
|
||||||
"http 1.1 compression handled by zlib version " << zlibVersion();
|
"http 1.1 compression handled by zlib version " << zlibVersion();
|
||||||
|
|
||||||
Server * server = new Server(
|
Server * server = new Server(
|
||||||
serverConfig.GetParameter("IP"),
|
serverConfig.GetParameter("IP"),
|
||||||
serverConfig.GetParameter("Port"),
|
serverConfig.GetParameter("Port"),
|
||||||
|
Loading…
Reference in New Issue
Block a user