Added some more doxygen documentation.
This commit is contained in:
parent
2e59c80a1e
commit
ff9afbba29
@ -121,7 +121,8 @@ public:
|
||||
* which the run member function is being invoked.
|
||||
*
|
||||
* @param handler The completion handler to be called. The demuxer will make
|
||||
* a copy of the handler object as required.
|
||||
* a copy of the handler object as required. The equivalent function
|
||||
* signature of the handler must be <tt>void handler()</tt>.
|
||||
*/
|
||||
template <typename Handler>
|
||||
void operation_completed(Handler handler)
|
||||
@ -141,7 +142,8 @@ public:
|
||||
* which the run member function is being invoked.
|
||||
*
|
||||
* @param handler The completion handler to be called. The demuxer will make
|
||||
* a copy of the handler object as required.
|
||||
* a copy of the handler object as required. The equivalent function
|
||||
* signature of the handler must be <tt>void handler()</tt>.
|
||||
*
|
||||
* @param context The completion context which controls the number of
|
||||
* concurrent invocations of handlers that may be made. Ownership of the
|
||||
@ -165,7 +167,8 @@ public:
|
||||
* which the run member function is being invoked.
|
||||
*
|
||||
* @param handler The completion handler to be called. The demuxer will make
|
||||
* a copy of the handler object as required.
|
||||
* a copy of the handler object as required. The equivalent function
|
||||
* signature of the handler must be <tt>void handler()</tt>.
|
||||
*
|
||||
* @param context The completion context which controls the number of
|
||||
* concurrent invocations of handlers that may be made. Ownership of the
|
||||
@ -197,7 +200,8 @@ public:
|
||||
* which the run member function is being invoked.
|
||||
*
|
||||
* @param handler The completion handler to be called. The demuxer will make
|
||||
* a copy of the handler object as required.
|
||||
* a copy of the handler object as required. The equivalent function
|
||||
* signature of the handler must be <tt>void handler()</tt>.
|
||||
*/
|
||||
template <typename Handler>
|
||||
void operation_immediate(Handler handler)
|
||||
@ -217,7 +221,8 @@ public:
|
||||
* which the run member function is being invoked.
|
||||
*
|
||||
* @param handler The completion handler to be called. The demuxer will make
|
||||
* a copy of the handler object as required.
|
||||
* a copy of the handler object as required. The equivalent function
|
||||
* signature of the handler must be <tt>void handler()</tt>.
|
||||
*
|
||||
* @param context The completion context which controls the number of
|
||||
* concurrent invocations of handlers that may be made. Ownership of the
|
||||
@ -241,12 +246,13 @@ public:
|
||||
* which the run member function is being invoked.
|
||||
*
|
||||
* @param handler The completion handler to be called. The demuxer will make
|
||||
* a copy of the handler object as required.
|
||||
* a copy of the handler object as required. The equivalent function
|
||||
* signature of the handler must be <tt>void handler()</tt>.
|
||||
*
|
||||
* @param context The completion context which controls the number of
|
||||
* concurrent invocations of handlers that may be made. Ownership of the
|
||||
* completion_context object is retained by the caller, which must guarantee
|
||||
* that it is valid until after the handler has been called.
|
||||
* object is retained by the caller, which must guarantee that it is valid
|
||||
* until after the handler has been called.
|
||||
*
|
||||
* @param allow_nested_delivery If true, this allows the demuxer to run the
|
||||
* completion handler before operation_immediate returns, as an optimisation.
|
||||
|
@ -86,7 +86,7 @@ public:
|
||||
}
|
||||
|
||||
/// Get the underlying implementation in the native type.
|
||||
impl_type impl() const
|
||||
impl_type impl()
|
||||
{
|
||||
return impl_;
|
||||
}
|
||||
|
@ -103,7 +103,7 @@ public:
|
||||
}
|
||||
|
||||
/// Get the underlying implementation in the native type.
|
||||
impl_type impl() const
|
||||
impl_type impl()
|
||||
{
|
||||
return impl_;
|
||||
}
|
||||
|
@ -43,7 +43,13 @@ public:
|
||||
/// The demuxer type for this asynchronous type.
|
||||
typedef typename service_type::demuxer_type demuxer_type;
|
||||
|
||||
/// Constructor a connector. The connector is automatically opened.
|
||||
/// Constructor.
|
||||
/**
|
||||
* This constructor automatically opens the connector.
|
||||
*
|
||||
* @param d The demuxer object that the connector will use to deliver
|
||||
* completions for any asynchronous operations performed on the connector.
|
||||
*/
|
||||
explicit basic_socket_connector(demuxer_type& d)
|
||||
: service_(d.get_service(service_factory<Service>())),
|
||||
impl_(service_type::null())
|
||||
@ -58,39 +64,92 @@ public:
|
||||
}
|
||||
|
||||
/// Get the demuxer associated with the asynchronous object.
|
||||
/**
|
||||
* This function may be used to obtain the demuxer object that the connector
|
||||
* uses to deliver completions for asynchronous operations.
|
||||
*
|
||||
* @return A reference to the demuxer object that the connector will use to
|
||||
* deliver completion notifications. Ownership is not transferred to the
|
||||
* caller.
|
||||
*/
|
||||
demuxer_type& demuxer()
|
||||
{
|
||||
return service_.demuxer();
|
||||
}
|
||||
|
||||
/// Open the connector.
|
||||
/**
|
||||
* This function is used to open the connector so that it may be used to
|
||||
* perform socket connect operations.
|
||||
*
|
||||
* Since the constructor opens the connector by default, you should only need
|
||||
* to call this function if there has been a prior call to close().
|
||||
*/
|
||||
void open()
|
||||
{
|
||||
service_.create(impl_);
|
||||
}
|
||||
|
||||
/// Close the connector.
|
||||
/**
|
||||
* This function is used to close the connector. Any asynchronous connect
|
||||
* operations will be immediately cancelled.
|
||||
*
|
||||
* A subsequent call to open() is required before the connector can again be
|
||||
* used to again perform socket connect operations.
|
||||
*/
|
||||
void close()
|
||||
{
|
||||
service_.destroy(impl_);
|
||||
}
|
||||
|
||||
/// Get the underlying implementation in the native type.
|
||||
impl_type impl() const
|
||||
/**
|
||||
* This function may be used to obtain the underlying implementation of the
|
||||
* socket connector. This is intended to allow access to native socket
|
||||
* functionality that is not otherwise provided.
|
||||
*/
|
||||
impl_type impl()
|
||||
{
|
||||
return impl_;
|
||||
}
|
||||
|
||||
/// Connect the given socket to the peer at the specified address. Throws a
|
||||
/// socket_error exception on failure.
|
||||
/// Connect a stream socket to the peer at the specified address.
|
||||
/**
|
||||
* This function is used to connect a stream socket to the specified remote
|
||||
* address. The function call will block until the connection is successfully
|
||||
* made or an error occurs.
|
||||
*
|
||||
* @param peer_socket The stream socket to be connected.
|
||||
*
|
||||
* @param peer_address The remote address of the peer to which the socket
|
||||
* will be connected.
|
||||
*
|
||||
* @throws socket_error exception on failure.
|
||||
*/
|
||||
template <typename Stream, typename Address>
|
||||
void connect(Stream& peer_socket, const Address& peer_address)
|
||||
{
|
||||
service_.connect(impl_, peer_socket.lowest_layer(), peer_address);
|
||||
}
|
||||
|
||||
/// Start an asynchronous connect. The peer_socket object must be valid until
|
||||
/// the connect's completion handler is invoked.
|
||||
/// Start an asynchronous connect.
|
||||
/**
|
||||
* This function is used to asynchronously connect a stream socket to the
|
||||
* specified remote address. The function call always returns immediately.
|
||||
*
|
||||
* @param peer_socket The stream socket to be connected. Ownership of the
|
||||
* peer_socket object is retained by the caller, which must guarantee that it
|
||||
* is valid until the handler is called.
|
||||
*
|
||||
* @param peer_address The remote address of the peer to which the socket
|
||||
* will be connected. Copies will be made of the address as required.
|
||||
*
|
||||
* @param handler The completion handler to be called when the connection
|
||||
* operation completes. Copies will be made of the handler as required. The
|
||||
* equivalent function signature of the handler must be <tt>void
|
||||
* handler(const socket_error& error)</tt>.
|
||||
*/
|
||||
template <typename Stream, typename Address, typename Handler>
|
||||
void async_connect(Stream& peer_socket, const Address& peer_address,
|
||||
Handler handler)
|
||||
@ -99,8 +158,28 @@ public:
|
||||
handler, null_completion_context::instance());
|
||||
}
|
||||
|
||||
/// Start an asynchronous connect. The peer_socket object must be valid until
|
||||
/// the connect's completion handler is invoked.
|
||||
/// Start an asynchronous connect.
|
||||
/**
|
||||
* This function is used to asynchronously connect a stream socket to the
|
||||
* specified remote address. The function call always returns immediately.
|
||||
*
|
||||
* @param peer_socket The stream socket to be connected. Ownership of the
|
||||
* peer_socket object is retained by the caller, which must guarantee that it
|
||||
* is valid until the handler is called.
|
||||
*
|
||||
* @param peer_address The remote address of the peer to which the socket
|
||||
* will be connected. Copies will be made of the address as required.
|
||||
*
|
||||
* @param handler The completion handler to be called when the connection
|
||||
* operation completes. Copies will be made of the handler as required. The
|
||||
* equivalent function signature of the handler must be <tt>void
|
||||
* handler(const socket_error& error)</tt>.
|
||||
*
|
||||
* @param context The completion context which controls the number of
|
||||
* concurrent invocations of handlers that may be made. Ownership of the
|
||||
* object is retained by the caller, which must guarantee that it is valid
|
||||
* until after the handler has been called.
|
||||
*/
|
||||
template <typename Stream, typename Address, typename Handler,
|
||||
typename Completion_Context>
|
||||
void async_connect(Stream& peer_socket, const Address& peer_address,
|
||||
|
@ -79,7 +79,7 @@ public:
|
||||
}
|
||||
|
||||
/// Get the underlying implementation in the native type.
|
||||
impl_type impl() const
|
||||
impl_type impl()
|
||||
{
|
||||
return impl_;
|
||||
}
|
||||
|
@ -45,6 +45,13 @@ public:
|
||||
typedef typename service_type::demuxer_type demuxer_type;
|
||||
|
||||
/// Constructor.
|
||||
/**
|
||||
* This constructor creates a timer without setting an expiry time. The set()
|
||||
* function must be called before the timer can be waited on.
|
||||
*
|
||||
* @param d The demuxer object that the timer will use to deliver completions
|
||||
* for any asynchronous operations performed on the timer.
|
||||
*/
|
||||
explicit basic_timer(demuxer_type& d)
|
||||
: service_(d.get_service(service_factory<Service>())),
|
||||
impl_(service_.null())
|
||||
@ -52,7 +59,23 @@ public:
|
||||
service_.create(impl_);
|
||||
}
|
||||
|
||||
/// Construct and set to a particular time.
|
||||
/// Constructor to set a particular expiry time.
|
||||
/**
|
||||
* This constructor creates a timer and sets the expiry time.
|
||||
*
|
||||
* @param d The demuxer object that the timer will use to deliver completions
|
||||
* for any asynchronous operations performed on the timer.
|
||||
*
|
||||
* @param from_when The origin time against which the seconds and
|
||||
* microseconds values are measured.
|
||||
*
|
||||
* @param seconds The number of seconds after the from_when origin that the
|
||||
* time should expire.
|
||||
*
|
||||
* @param microseconds The number of microseconds which, in addition to the
|
||||
* seconds value, is used to calculate the expiry time relative to the
|
||||
* from_when origin value.
|
||||
*/
|
||||
basic_timer(demuxer_type& d, from_type from_when, long seconds,
|
||||
long microseconds = 0)
|
||||
: service_(d.get_service(service_factory<Service>())),
|
||||
@ -69,30 +92,80 @@ public:
|
||||
}
|
||||
|
||||
/// Get the demuxer associated with the asynchronous object.
|
||||
/**
|
||||
* This function may be used to obtain the demuxer object that the timer uses
|
||||
* to deliver completions for asynchronous operations.
|
||||
*
|
||||
* @return A reference to the demuxer object that the timer will use to
|
||||
* deliver completion notifications. Ownership is not transferred to the
|
||||
* caller.
|
||||
*/
|
||||
demuxer_type& demuxer()
|
||||
{
|
||||
return service_.demuxer();
|
||||
}
|
||||
|
||||
/// Get the underlying implementation in the native type.
|
||||
/**
|
||||
* This function may be used to obtain the underlying implementation of the
|
||||
* timer. This is intended to allow access to native timer functionality that
|
||||
* is not otherwise provided.
|
||||
*/
|
||||
impl_type impl()
|
||||
{
|
||||
return impl_;
|
||||
}
|
||||
|
||||
/// Set the timer.
|
||||
/**
|
||||
* This function sets the expiry time.
|
||||
*
|
||||
* @param from_when The origin time against which the seconds and
|
||||
* microseconds values are measured.
|
||||
*
|
||||
* @param seconds The number of seconds after the from_when origin that the
|
||||
* time should expire.
|
||||
*
|
||||
* @param microseconds The number of microseconds which, in addition to the
|
||||
* seconds value, is used to calculate the expiry time relative to the
|
||||
* from_when origin value.
|
||||
*/
|
||||
void set(from_type from_when, long seconds, long microseconds = 0)
|
||||
{
|
||||
service_.set(impl_, from_when, seconds, microseconds);
|
||||
}
|
||||
|
||||
/// Expire the timer immediately.
|
||||
/**
|
||||
* This function causes the timer to expire immediately. If there is a
|
||||
* pending asynchronous wait operation against the timer it will be forced to
|
||||
* complete.
|
||||
*/
|
||||
void expire()
|
||||
{
|
||||
service_.expire(impl_);
|
||||
}
|
||||
|
||||
/// Perform a blocking wait on the timer.
|
||||
/**
|
||||
* This function is used to wait for the timer to expire. This function
|
||||
* blocks and does not return until the timer has expired.
|
||||
*/
|
||||
void wait()
|
||||
{
|
||||
service_.wait(impl_);
|
||||
}
|
||||
|
||||
/// Start an asynchronous wait on the timer.
|
||||
/**
|
||||
* This function may be used to initiate an asynchronous wait against the
|
||||
* timer. It always returns immediately, but the specified handler will be
|
||||
* notified when the timer expires.
|
||||
*
|
||||
* @param handler The completion handler to be called when the timer expires.
|
||||
* Copies will be made of the handler as required. The equivalent function
|
||||
* signature of the handler must be <tt>void handler()</tt>.
|
||||
*/
|
||||
template <typename Handler>
|
||||
void async_wait(Handler handler)
|
||||
{
|
||||
@ -100,6 +173,20 @@ public:
|
||||
}
|
||||
|
||||
/// Start an asynchronous wait on the timer.
|
||||
/**
|
||||
* This function may be used to initiate an asynchronous wait against the
|
||||
* timer. It always returns immediately, but the specified handler will be
|
||||
* notified when the timer expires.
|
||||
*
|
||||
* @param handler The completion handler to be called when the timer expires.
|
||||
* Copies will be made of the handler as required. The equivalent function
|
||||
* signature of the handler must be <tt>void handler()</tt>.
|
||||
*
|
||||
* @param context The completion context which controls the number of
|
||||
* concurrent invocations of handlers that may be made. Ownership of the
|
||||
* object is retained by the caller, which must guarantee that it is valid
|
||||
* until after the handler has been called.
|
||||
*/
|
||||
template <typename Handler, typename Completion_Context>
|
||||
void async_wait(Handler handler, Completion_Context& context)
|
||||
{
|
||||
|
Loading…
Reference in New Issue
Block a user