<commit_before>#ifndef RS_LIBHTTPSERVER_SERVICE_H
#define	RS_LIBHTTPSERVER_SERVICE_H

#include <string>

#include <boost/shared_ptr.hpp>
#include <boost/noncopyable.hpp>
#include <boost/enable_shared_from_this.hpp>
#include <boost/function.hpp>

#include <boost/asio.hpp>

#include "types.h"
#include "socket.h"

namespace rs {
namespace httpwebserver {
    
class Service final : public boost::enable_shared_from_this<Service>, private boost::noncopyable {
public:
    typedef boost::function<void (socket_ptr, const boost::system::error_code &)> listen_callback;
    
    static service_ptr Create(int threads) {
        return service_ptr(new Service(threads));
    }       
   
    void Run() { service_->run(); }        
    
    void Listen(const std::string& host, int port, listen_callback func);
    
private:
    Service(int threads) : service_(new boost::asio::io_service(threads)) {}
    
    operator boost::asio::io_service&() { return *service_; }
    
    static void StartAccept(socket_ptr socket, listen_callback func);
    static void HandleAccept(socket_ptr socket, listen_callback func, const boost::system::error_code& error);
    
    asio_io_service_ptr service_;
};
    
}}
#endif	/* RS_LIBHTTPSERVER_SERVICE_H */
<commit_msg>Expose asio::io_service& as public (yuk!)<commit_after>#ifndef RS_LIBHTTPSERVER_SERVICE_H
#define	RS_LIBHTTPSERVER_SERVICE_H

#include <string>

#include <boost/shared_ptr.hpp>
#include <boost/noncopyable.hpp>
#include <boost/enable_shared_from_this.hpp>
#include <boost/function.hpp>

#include <boost/asio.hpp>

#include "types.h"
#include "socket.h"

namespace rs {
namespace httpwebserver {
    
class Service final : public boost::enable_shared_from_this<Service>, private boost::noncopyable {
public:
    typedef boost::function<void (socket_ptr, const boost::system::error_code &)> listen_callback;
    
    static service_ptr Create(int threads) {
        return service_ptr(new Service(threads));
    }       
   
    void Run() { service_->run(); }        
    
    void Listen(const std::string& host, int port, listen_callback func);
    
    operator boost::asio::io_service&() { return *service_; }
    
private:
    Service(int threads) : service_(new boost::asio::io_service(threads)) {}       
    
    static void StartAccept(socket_ptr socket, listen_callback func);
    static void HandleAccept(socket_ptr socket, listen_callback func, const boost::system::error_code& error);
    
    asio_io_service_ptr service_;
};
    
}}
#endif	/* RS_LIBHTTPSERVER_SERVICE_H */

{'fraction_non_alphanumeric': 0.11351990540007884, 'fraction_numerical': 0.0, 'mean_word_length': 4.423076923076923, 'pattern_counts': {'":': 0, '<': 19, '<?xml version=': 0, '>': 21, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '331498', 'n_tokens_mistral': 790, 'n_tokens_neox': 795, 'n_words': 172}