InterfaceClient¶
-
template<class
ObserverClass
, classSessionClass
>
classkanzi::connect
::
InterfaceClient
: public AbstractInterfaceClient¶ Templated abstract base class for network interfaces.
Enforces type safety in interface and implements support for observers.
Public Types
-
typedef map<AbstractSessionSharedPtr, ObserverClass*>
ObserverContainer
¶ Type definition for observer container.
Public Functions
-
InterfaceClient
(const string &identifier, RPCCallStore &callstore)¶
-
AbstractSessionSharedPtr
acquireSession
(MessageDispatcher *dispatcher)¶ Acquire session in to this interface.
- Return
New session instance for this interface type.
- Parameters
dispatcher
: Message dispatcher that is used to deliver network messages.
Add observer in to this interface for given session.
- Parameters
session
: Session to observe.observer
: Observer to receive notifications.
-
RPCCallStore &
getCallStore
()¶ Retrieve RPC call store that is used to manage pending RPC calls.
- Return
reference to RPC callstore implementation.
-
string
getIdentifier
() const¶ Returns the type id of the interface.
This is used to identify the service in the network.
- Return
Type of the interface, as a string.
Retrieve observer for given session.
- Return
Observer that is connected to session, or null if there is no such observer.
- Parameters
session
: Session being observed.
-
AbstractSessionSharedPtr
onAcquireSession
(int sessionId, MessageDispatcher *dispatcher)¶ Function that allows derived classes to create their type-specific session instance.
- Return
New session instance for this type of interface.
- Parameters
sessionId
: Session Id of the connected client, needs to be unique for this client.dispatcher
: Message dispatcher that is used to deliver network messages.
-
void
receive
(const MessagePackage &message)¶ Pass a message package to this interface, resolves proper session and makes it receive the package.
- Parameters
message
: Message that was sent.
Release session that is connected to this interface.
- Parameters
session
: Session to release.
Remove observer from a given session.
- Parameters
session
: Session to remove observer from.
-
typedef map<AbstractSessionSharedPtr, ObserverClass*>