00001 // 00002 // server.hpp 00003 // ~~~~~~~~~~ 00004 // 00005 // Copyright (c) 2003-2011 Christopher M. Kohlhoff (chris at kohlhoff dot com) 00006 // 00007 // Distributed under the Boost Software License, Version 1.0. (See accompanying 00008 // file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) 00009 // 00010 00011 #ifndef HTTP_SERVER3_SERVER_H 00012 #define HTTP_SERVER3_SERVER_H 00013 00014 #include <boost/asio.hpp> 00015 #include <string> 00016 #include <vector> 00017 #include <boost/noncopyable.hpp> 00018 #include <boost/shared_ptr.hpp> 00019 #include "connection.h" 00020 00021 #include "encoder_manager.h" 00022 00023 #include "server_configuration.h" 00024 00025 namespace ros_http_video_streamer 00026 { 00027 00029 class server 00030 : private boost::noncopyable 00031 { 00032 public: 00035 explicit server(const ServerConfiguration& server_conf, std::size_t thread_pool_size); 00036 00038 void run(); 00039 00041 void stop(); 00042 00043 private: 00045 void handle_accept(const boost::system::error_code& e); 00046 00047 const ServerConfiguration& server_conf_; 00048 00050 std::size_t thread_pool_size_; 00051 00053 boost::asio::io_service io_service_; 00054 00056 boost::asio::ip::tcp::acceptor acceptor_; 00057 00058 // Encoder manager to handle encoding instances 00059 EncoderManager encoder_manager_; 00060 00062 connection_ptr new_connection_; 00063 00064 00065 //std::vector<boost::shared_ptr<boost::thread> > connection_threads_; 00066 }; 00067 00068 } // ros_http_video_streamer 00069 00070 #endif // HTTP_SERVER3_SERVER_HPP