$treeview $search $mathjax
AirInv Logo  1.00.0
$projectbrief
$projectbrief
$searchbox

AirInvServer.hpp

Go to the documentation of this file.
00001 #ifndef __AIRINV_SVR_AIRINVSERVER_HPP
00002 #define __AIRINV_SVR_AIRINVSERVER_HPP
00003 
00004 // //////////////////////////////////////////////////////////////////////
00005 // Import section
00006 // //////////////////////////////////////////////////////////////////////
00007 // STL
00008 #include <string>
00009 #include <vector>
00010 // Boost
00011 #include <boost/asio.hpp>
00012 #include <boost/noncopyable.hpp>
00013 #include <boost/shared_ptr.hpp>
00014 // StdAir
00015 #include <stdair/stdair_basic_types.hpp>
00016 // AirInv
00017 #include <airinv/server/Connection.hpp>
00018 #include <airinv/server/RequestHandler.hpp>
00019 
00020 namespace AIRINV {
00021 
00023   class AirInvServer : private boost::noncopyable {
00024   public:
00025     // //////////// Constructors and Destructors /////////////////
00029     AirInvServer (const std::string& address, const std::string& port,
00030                   const stdair::AirlineCode_T& iAirlineCode,
00031                   std::size_t thread_pool_size);
00033     ~AirInvServer();
00034 
00035 
00036   public:
00037     // ////////////////// Business Methods ////////////////////
00039     void run();
00040 
00042     void stop();
00043 
00044     
00045   private:
00046     // //////////// Constructors and Destructors /////////////////
00048     AirInvServer();
00049     AirInvServer(const AirInvServer&);
00050 
00051     
00052   private:
00053     // //////////// Attributes /////////////////
00055     void handleAccept (const boost::system::error_code& e);
00056 
00058     std::size_t _threadPoolSize;
00059 
00061     boost::asio::io_service _ioService;
00062 
00064     boost::asio::ip::tcp::acceptor _acceptor;
00065 
00067     ConnectionShrPtr_T _newConnection;
00068 
00070     RequestHandler _requestHandler;
00071   };
00072 
00073 }
00074 #endif // __AIRINV_SVR_AIRINVSERVER_HPP