00001 // -*- mode: c++; indent-tabs-mode: nil; tab-width: 2 -*- 00002 #pragma once 00003 #include "moses/TypeDef.h" 00004 00005 #ifdef WITH_THREADS 00006 #include <boost/thread.hpp> 00007 #include "moses/ThreadPool.h" 00008 #endif 00009 00010 #include <xmlrpc-c/base.hpp> 00011 #include <xmlrpc-c/registry.hpp> 00012 #include <xmlrpc-c/server_abyss.hpp> 00013 #include "Translator.h" 00014 #include "Optimizer.h" 00015 #include "Updater.h" 00016 #include "CloseSession.h" 00017 #include "Session.h" 00018 #include "moses/parameters/ServerOptions.h" 00019 #include <string> 00020 00021 namespace MosesServer 00022 { 00023 class Server 00024 { 00025 Moses::ServerOptions m_server_options; 00026 SessionCache m_session_cache; 00027 xmlrpc_c::registry m_registry; 00028 xmlrpc_c::methodPtr const m_updater; 00029 xmlrpc_c::methodPtr const m_optimizer; 00030 xmlrpc_c::methodPtr const m_translator; 00031 xmlrpc_c::methodPtr const m_close_session; 00032 std::string m_pidfile; 00033 public: 00034 Server(Moses::Parameter& params); 00035 ~Server(); 00036 int run(); 00037 void delete_session(uint64_t const session_id); 00038 00039 Moses::ServerOptions const& 00040 options() const; 00041 00042 Session const& 00043 get_session(uint64_t session_id); 00044 00045 }; 00046 }