Ice 3.7 C++11 API Reference
Public Member Functions | List of all members
Ice::Connection Class Referenceabstract

The user-level interface to a connection. More...

#include <Ice/Ice.h>

Public Member Functions

virtual void close (ConnectionClose mode) noexcept=0
 Manually close the connection using the specified closure mode. More...
 
virtual ::std::shared_ptr<::Ice::ObjectPrxcreateProxy (const Identity &id) const =0
 Create a special proxy that always uses this connection. More...
 
virtual void flushBatchRequests (CompressBatch compress)
 Flush any pending batch requests for this connection. More...
 
template<template< typename > class P = ::std::promise>
auto flushBatchRequestsAsync (CompressBatch compress) -> decltype(::std::declval< P< void >>().get_future())
 Flush any pending batch requests for this connection. More...
 
virtual ::std::function< void()> flushBatchRequestsAsync (CompressBatch compress, ::std::function< void(::std::exception_ptr)> exception, ::std::function< void(bool)> sent=nullptr)=0
 Flush any pending batch requests for this connection. More...
 
virtual ::Ice::ACM getACM () noexcept=0
 Get the ACM parameters. More...
 
virtual ::std::shared_ptr<::Ice::ObjectAdaptergetAdapter () const noexcept=0
 Get the object adapter that dispatches requests for this connection. More...
 
virtual ::std::shared_ptr<::Ice::EndpointgetEndpoint () const noexcept=0
 Get the endpoint from which the connection was created. More...
 
virtual ::std::shared_ptr<::Ice::ConnectionInfogetInfo () const =0
 Returns the connection information. More...
 
virtual void heartbeat ()
 Send a heartbeat message. More...
 
template<template< typename > class P = ::std::promise>
auto heartbeatAsync () -> decltype(::std::declval< P< void >>().get_future())
 Send a heartbeat message. More...
 
virtual ::std::function< void()> heartbeatAsync (::std::function< void(::std::exception_ptr)> exception, ::std::function< void(bool)> sent=nullptr)=0
 Send a heartbeat message. More...
 
virtual void setACM (const Ice::optional< int > &timeout, const Ice::optional< ACMClose > &close, const Ice::optional< ACMHeartbeat > &heartbeat)=0
 Set the active connection management parameters. More...
 
virtual void setAdapter (const ::std::shared_ptr< ObjectAdapter > &adapter)=0
 Explicitly set an object adapter that dispatches requests that are received over this connection. More...
 
virtual void setBufferSize (int rcvSize, int sndSize)=0
 Set the connection buffer receive/send size. More...
 
virtual void setCloseCallback (CloseCallback callback)=0
 Set a close callback on the connection. More...
 
virtual void setHeartbeatCallback (HeartbeatCallback callback)=0
 Set a heartbeat callback on the connection. More...
 
virtual void throwException () const =0
 Throw an exception indicating the reason for connection closure. More...
 
virtual int timeout () const noexcept=0
 Get the timeout for the connection. More...
 
virtual ::std::string toString () const noexcept=0
 Return a description of the connection as human readable text, suitable for logging or error messages. More...
 
virtual ::std::string type () const noexcept=0
 Return the connection type. More...
 
virtual ~Connection ()
 

Detailed Description

The user-level interface to a connection.

Constructor & Destructor Documentation

◆ ~Connection()

virtual Ice::Connection::~Connection ( )
virtual

Member Function Documentation

◆ close()

virtual void Ice::Connection::close ( ConnectionClose  mode)
pure virtualnoexcept

Manually close the connection using the specified closure mode.

Parameters
modeDetermines how the connection will be closed.
See also
ConnectionClose

◆ createProxy()

virtual ::std::shared_ptr<::Ice::ObjectPrx> Ice::Connection::createProxy ( const Identity id) const
pure virtual

Create a special proxy that always uses this connection.

This can be used for callbacks from a server to a client if the server cannot directly establish a connection to the client, for example because of firewalls. In this case, the server would create a proxy using an already established connection from the client.

Parameters
idThe identity for which a proxy is to be created.
Returns
A proxy that matches the given identity and uses this connection.
See also
setAdapter

◆ flushBatchRequests()

virtual void Ice::Connection::flushBatchRequests ( CompressBatch  compress)
inlinevirtual

Flush any pending batch requests for this connection.

This means all batch requests invoked on fixed proxies associated with the connection.

Parameters
compressSpecifies whether or not the queued batch requests should be compressed before being sent over the wire.

◆ flushBatchRequestsAsync() [1/2]

template<template< typename > class P = ::std::promise>
auto Ice::Connection::flushBatchRequestsAsync ( CompressBatch  compress) -> decltype(::std::declval<P<void>>().get_future())
inline

Flush any pending batch requests for this connection.

This means all batch requests invoked on fixed proxies associated with the connection.

Parameters
compressSpecifies whether or not the queued batch requests should be compressed before being sent over the wire.
Returns
The future object for the invocation.

◆ flushBatchRequestsAsync() [2/2]

virtual ::std::function<void()> Ice::Connection::flushBatchRequestsAsync ( CompressBatch  compress,
::std::function< void(::std::exception_ptr)>  exception,
::std::function< void(bool)>  sent = nullptr 
)
pure virtual

Flush any pending batch requests for this connection.

This means all batch requests invoked on fixed proxies associated with the connection.

Parameters
compressSpecifies whether or not the queued batch requests should be compressed before being sent over the wire.
exceptionThe exception callback.
sentThe sent callback.
Returns
A function that can be called to cancel the invocation locally.

◆ getACM()

virtual ::Ice::ACM Ice::Connection::getACM ( )
pure virtualnoexcept

Get the ACM parameters.

Returns
The ACM parameters.

◆ getAdapter()

virtual ::std::shared_ptr<::Ice::ObjectAdapter> Ice::Connection::getAdapter ( ) const
pure virtualnoexcept

Get the object adapter that dispatches requests for this connection.

Returns
The object adapter that dispatches requests for the connection, or null if no adapter is set.
See also
setAdapter

◆ getEndpoint()

virtual ::std::shared_ptr<::Ice::Endpoint> Ice::Connection::getEndpoint ( ) const
pure virtualnoexcept

Get the endpoint from which the connection was created.

Returns
The endpoint from which the connection was created.

◆ getInfo()

virtual ::std::shared_ptr<::Ice::ConnectionInfo> Ice::Connection::getInfo ( ) const
pure virtual

Returns the connection information.

Returns
The connection information.

◆ heartbeat()

virtual void Ice::Connection::heartbeat ( )
inlinevirtual

Send a heartbeat message.

◆ heartbeatAsync() [1/2]

template<template< typename > class P = ::std::promise>
auto Ice::Connection::heartbeatAsync ( ) -> decltype(::std::declval<P<void>>().get_future())
inline

Send a heartbeat message.

Returns
The future object for the invocation.

◆ heartbeatAsync() [2/2]

virtual ::std::function<void()> Ice::Connection::heartbeatAsync ( ::std::function< void(::std::exception_ptr)>  exception,
::std::function< void(bool)>  sent = nullptr 
)
pure virtual

Send a heartbeat message.

Parameters
exceptionThe exception callback.
sentThe sent callback.
Returns
A function that can be called to cancel the invocation locally.

◆ setACM()

virtual void Ice::Connection::setACM ( const Ice::optional< int > &  timeout,
const Ice::optional< ACMClose > &  close,
const Ice::optional< ACMHeartbeat > &  heartbeat 
)
pure virtual

Set the active connection management parameters.

Parameters
timeoutThe timeout value in seconds, must be >= 0.
closeThe close condition
heartbeatThe hertbeat condition

◆ setAdapter()

virtual void Ice::Connection::setAdapter ( const ::std::shared_ptr< ObjectAdapter > &  adapter)
pure virtual

Explicitly set an object adapter that dispatches requests that are received over this connection.

A client can invoke an operation on a server using a proxy, and then set an object adapter for the outgoing connection that is used by the proxy in order to receive callbacks. This is useful if the server cannot establish a connection back to the client, for example because of firewalls.

Parameters
adapterThe object adapter that should be used by this connection to dispatch requests. The object adapter must be activated. When the object adapter is deactivated, it is automatically removed from the connection. Attempts to use a deactivated object adapter raise ObjectAdapterDeactivatedException
See also
createProxy
getAdapter

◆ setBufferSize()

virtual void Ice::Connection::setBufferSize ( int  rcvSize,
int  sndSize 
)
pure virtual

Set the connection buffer receive/send size.

Parameters
rcvSizeThe connection receive buffer size.
sndSizeThe connection send buffer size.

◆ setCloseCallback()

virtual void Ice::Connection::setCloseCallback ( CloseCallback  callback)
pure virtual

Set a close callback on the connection.

The callback is called by the connection when it's closed. The callback is called from the Ice thread pool associated with the connection. If the callback needs more information about the closure, it can call Connection#throwException.

Parameters
callbackThe close callback object.

◆ setHeartbeatCallback()

virtual void Ice::Connection::setHeartbeatCallback ( HeartbeatCallback  callback)
pure virtual

Set a heartbeat callback on the connection.

The callback is called by the connection when a heartbeat is received. The callback is called from the Ice thread pool associated with the connection.

Parameters
callbackThe heartbeat callback object.

◆ throwException()

virtual void Ice::Connection::throwException ( ) const
pure virtual

Throw an exception indicating the reason for connection closure.

For example, CloseConnectionException is raised if the connection was closed gracefully, whereas ConnectionManuallyClosedException is raised if the connection was manually closed by the application. This operation does nothing if the connection is not yet closed.

◆ timeout()

virtual int Ice::Connection::timeout ( ) const
pure virtualnoexcept

Get the timeout for the connection.

Returns
The connection's timeout.

◆ toString()

virtual ::std::string Ice::Connection::toString ( ) const
pure virtualnoexcept

Return a description of the connection as human readable text, suitable for logging or error messages.

Returns
The description of the connection as human readable text.

◆ type()

virtual ::std::string Ice::Connection::type ( ) const
pure virtualnoexcept

Return the connection type.

This corresponds to the endpoint type, i.e., "tcp", "udp", etc.

Returns
The type of the connection.

The documentation for this class was generated from the following file: