libiqxmlrpc  0.12.4
 All Classes Namespaces Files Functions Typedefs Enumerations
conn_factory.h
1 // Libiqxmlrpc - an object-oriented XML-RPC solution.
2 // Copyright (C) 2011 Anton Dedov
3 
4 #ifndef _libiqnet_connection_factory_
5 #define _libiqnet_connection_factory_
6 
7 #include "inet_addr.h"
8 
9 namespace iqnet
10 {
11 
13 class LIBIQXMLRPC_API Accepted_conn_factory {
14 public:
15  virtual ~Accepted_conn_factory() {}
16  virtual void create_accepted( const Socket& ) = 0;
17 };
18 
19 
21 template <class Conn_type>
23 public:
24  void create_accepted( const Socket& sock )
25  {
26  Conn_type* c = new Conn_type( sock );
27  post_create( c );
28  c->post_accept();
29  }
30 
31  virtual void post_create( Conn_type* ) {}
32 };
33 
34 } // namespace iqnet
35 
36 #endif