using System;
namespace Plane.Messaging
{
public interface IPLMessenger
{
///
/// Registers a recipient for a type of message TMessage. The action
/// parameter will be executed when a corresponding message is sent.
/// Registering a recipient does not create a hard reference to it,
/// so if this recipient is deleted, no memory leak is caused.
///
/// The type of message that the recipient registers
/// for.
/// The recipient that will receive the messages.
/// The action that will be executed when a message
/// of type TMessage is sent.
void Register(object recipient, Action action);
///
/// Sends a message to registered recipients. The message will
/// reach all recipients that registered for this message type
/// using one of the Register methods.
///
/// The type of message that will be sent.
/// The message to send to registered recipients.
void Send(TMessage message);
///
/// Unregisters a messager recipient completely. After this method
/// is executed, the recipient will not receive any messages anymore.
///
/// The recipient that must be unregistered.
void Unregister(object recipient);
}
}