Updates iostream transport to new component style

This commit is contained in:
Peter Thorson
2013-01-07 12:20:41 -06:00
parent f9c62ee778
commit 7aa7f3af80
2 changed files with 18 additions and 5 deletions

View File

@@ -44,9 +44,12 @@ namespace iostream {
template <typename concurrency>
class connection {
public:
/// Type of this connection transport component
typedef connection<concurrency> type;
/// Type of a shared pointer to this connection transport component
typedef lib::shared_ptr<type> ptr;
// TODO: clean up the rest of these types
class handler_interface {};
typedef lib::shared_ptr<handler_interface> handler_ptr;

View File

@@ -28,6 +28,8 @@
#ifndef WEBSOCKETPP_TRANSPORT_IOSTREAM_HPP
#define WEBSOCKETPP_TRANSPORT_IOSTREAM_HPP
#include <websocketpp/common/memory.hpp>
#include <websocketpp/transport/iostream/connection.hpp>
#include <iostream>
@@ -39,9 +41,18 @@ namespace iostream {
template <typename concurrency>
class endpoint {
public:
typedef iostream::connection<concurrency> con_policy;
typedef typename con_policy::ptr trans_connection_ptr;
/// Type of this endpoint transport component
typedef endpoint type;
/// Type of a pointer to this endpoint transport component
typedef lib::shared_ptr<type> ptr;
/// Type of this endpoint transport component's associated connection
/// transport component.
typedef iostream::connection<concurrency> transport_con_type;
/// Type of a shared pointer to this endpoint transport component's
/// associated connection transport component
typedef typename transport_con_type::ptr transport_con_ptr;
// generate and manage our own io_service
explicit endpoint()
{
@@ -52,9 +63,8 @@ public:
output_stream = o;
}
protected:
template <typename connection_ptr>
void init(connection_ptr con) {
con->register_ostream(output_stream);
void init(transport_con_ptr tcon) {
tcon->register_ostream(output_stream);
}
private:
std::ostream* output_stream;