PureMVC::Notifier Class Reference

A Base INotifier implementation. More...

#include <pmvcpp.h>

Inheritance diagram for PureMVC::Notifier:
Inheritance graph
[legend]
Collaboration diagram for PureMVC::Notifier:
Collaboration graph
[legend]

List of all members.

Public Member Functions

void sendNotification (int notificationName, void *body, int notificationType)
 Create and send an INotification.
void sendNotification (int notificationName, int notificationType)
 Send a INotification.
void sendNotification (int notificationName, void *body)
 Send a INotification.
void sendNotification (int notificationName)
 Send a INotification.
void initializeNotifier (std::string key)
 Initialize this INotifier instance.
virtual void setMultitonKey (std::string key)
 Set multiton key.
virtual std::string getMultitonKey ()
 Get multiton key.

Protected Member Functions

IFacadegetFacade ()

Detailed Description

A Base INotifier implementation.

MacroCommand, Command, Mediator and Proxy all have a need to send Notifications.

The INotifier interface provides a common method called sendNotification that relieves implementation code of the necessity to actually construct Notifications.

The Notifier class, which all of the above mentioned classes extend, provides an initialized reference to the Facade Multiton, which is required for the convienience method for sending Notifications, but also eases implementation as these classes have frequent Facade interactions and usually require access to the facade anyway.

NOTE: There is one caveat to notifiers, they cannot send notifications or reach the facade until they have a valid multitonKey.

The multitonKey is set: * on a Command when it is executed by the Controller * on a Mediator is registered with the View * on a Proxy is registered with the Model.

See also:
Proxy::Proxy
Facade::Facade
Mediator::Mediator
MacroCommand::MacroCommand
SimpleCommand::SimpleCommand

Member Function Documentation

std::string MultitonKeyHeir::getMultitonKey (  )  [virtual, inherited]

Get multiton key.

Returns the multiton key.

Returns:
The string key name

Implements PureMVC::IMultitonKeyHeir.

void Notifier::initializeNotifier ( std::string  key  )  [virtual]

Initialize this INotifier instance.

This is how a Notifier gets its multitonKey. Calls to sendNotification or to access the facade will fail until after this method has been called.

Mediators, Commands or Proxies may override this method in order to send notifications or access the Multiton Facade instance as soon as possible. They CANNOT access the facade in their constructors, since this method will not yet have been called.

Parameters:
key the multitonKey for this INotifier to use

Implements PureMVC::INotifier.

void Notifier::sendNotification ( int  notificationName  )  [virtual]

Send a INotification.

Convenience method to prevent having to construct new notification instances in our implementation code.

Parameters:
notificationName the name of the notification to send

Implements PureMVC::INotifier.

void Notifier::sendNotification ( int  notificationName,
void *  body 
) [virtual]

Send a INotification.

Convenience method to prevent having to construct new notification instances in our implementation code.

Parameters:
notificationName the name of the notification to send
body the body of the notification (optional)

Implements PureMVC::INotifier.

void Notifier::sendNotification ( int  notificationName,
int  notificationType 
) [virtual]

Send a INotification.

Convenience method to prevent having to construct new notification instances in our implementation code.

Parameters:
notificationName the name of the notification to send
type the type of the notification (optional)

Implements PureMVC::INotifier.

void Notifier::sendNotification ( int  notificationName,
void *  body,
int  notificationType 
) [virtual]

Create and send an INotification.

Keeps us from having to construct new INotification instances in our implementation code.

Parameters:
notificationName the name of the notiification to send
body the body of the notification (optional)
type the type of the notification (optional)

Implements PureMVC::INotifier.

void MultitonKeyHeir::setMultitonKey ( std::string  key  )  [virtual, inherited]

Set multiton key.

Sets the multiton key.

Parameters:
key The name of the key

Implements PureMVC::IMultitonKeyHeir.


The documentation for this class was generated from the following files:
 All Classes Namespaces Functions Variables

Generated on Wed Feb 17 17:11:30 2010 for PureMVC++ by  doxygen 1.6.1