IOT Dash
Classes | Public Member Functions | Protected Member Functions | Properties | List of all members
IotDash.Domain.Mediator.AbstractMediator< TChannelKey, TMsg > Class Template Referenceabstract
Inheritance diagram for IotDash.Domain.Mediator.AbstractMediator< TChannelKey, TMsg >:
Inheritance graph
[legend]

Public Member Functions

virtual void Subscribe (TChannelKey msgChannel, ITarget< TChannelKey, TMsg > target, out ISubscription subscription)
 
virtual void Subscribe (TChannelKey msgChannel, ITarget< TChannelKey, TMsg > target, SubscriptionGuard guard)
 
abstract int TargetCountOnChannel (TChannelKey key)
 
abstract IEnumerable< ITarget< TChannelKey, TMsg > > GetChannelCopy (TChannelKey key)
 
abstract void Unsubscribe (ISubscription< TChannelKey, TMsg > subscription)
 
abstract Task Send (TChannelKey msgChannel, object sender, TMsg msg)
 

Protected Member Functions

abstract void SubscribeInternal (TChannelKey msgChannel, ITarget< TChannelKey, TMsg > target)
 

Properties

abstract int TargetCount [get]
 
abstract IEnumerable< TChannelKey > Keys [get]
 

Detailed Description

This class implements part the mediator design pattern. Takes responsibility for managing subscriptions of channels. The implementation of the actual message delegation is left to the child class of this.

Template Parameters
TChannelKeyType of the channel identifiers.
TMsgType of the messages which are delegated by this mediator.
Type Constraints
TChannelKey :notnull 
TMsg :notnull 

Member Function Documentation

◆ GetChannelCopy()

abstract IEnumerable< ITarget< TChannelKey, TMsg > > IotDash.Domain.Mediator.AbstractMediator< TChannelKey, TMsg >.GetChannelCopy ( TChannelKey  key)
pure virtual

A list of all subscribers of channel key .

Parameters
keyThe key identifying that channel.

Implemented in IotDash.Domain.Mediator.SimpleMediator< TChannelKey, TMsg >.

◆ Send()

abstract Task IotDash.Domain.Mediator.AbstractMediator< TChannelKey, TMsg >.Send ( TChannelKey  msgChannel,
object  sender,
TMsg  msg 
)
pure virtual

Send a message to a channel.

Parameters
msgChannelThe channel to send over.
senderThe message sender (optional).
msgMessage to send.
Returns

◆ Subscribe() [1/2]

virtual void IotDash.Domain.Mediator.AbstractMediator< TChannelKey, TMsg >.Subscribe ( TChannelKey  msgChannel,
ITarget< TChannelKey, TMsg >  target,
out ISubscription  subscription 
)
inlinevirtual

Register a new message target to receive messages from a particular channel. Creates the ISubscription and calls SubscribeInternal(TChannelKey, ITarget<TChannelKey, TMsg>).

Parameters
msgChannelThe channel identifier.
targetThe message target.
subscriptionSubscription object. Dispose it to cancel the subscription.

◆ Subscribe() [2/2]

virtual void IotDash.Domain.Mediator.AbstractMediator< TChannelKey, TMsg >.Subscribe ( TChannelKey  msgChannel,
ITarget< TChannelKey, TMsg >  target,
SubscriptionGuard  guard 
)
inlinevirtual

Register a new message target to receive messages from a particular channel. Registers the ISubscription under the given guard and calls SubscribeInternal(TChannelKey, ITarget<TChannelKey, TMsg>).

Parameters
msgChannelThe channel identifier.
targetThe message target.
guardSubscription guard to manage the created subscription.

◆ SubscribeInternal()

abstract void IotDash.Domain.Mediator.AbstractMediator< TChannelKey, TMsg >.SubscribeInternal ( TChannelKey  msgChannel,
ITarget< TChannelKey, TMsg >  target 
)
protectedpure virtual

Internal, ISubscription unaware method prepared for inheritor implementation. It is here to prevent the inheritor from forgetting to properly create the ISubscription.

Parameters
msgChannel
target

Implemented in IotDash.Domain.Mediator.SimpleMediator< TChannelKey, TMsg >.

◆ TargetCountOnChannel()

abstract int IotDash.Domain.Mediator.AbstractMediator< TChannelKey, TMsg >.TargetCountOnChannel ( TChannelKey  key)
pure virtual

Number of ITarget<TChannelKey, TMsg> subscribed to channel key .

Parameters
keyThe channel to filter by.

Implemented in IotDash.Domain.Mediator.SimpleMediator< TChannelKey, TMsg >.


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