PureMVC::Facade Class Reference

A base Multiton IFacade implementation. More...

#include <pmvcpp.h>

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

List of all members.

Public Member Functions

 Facade ()
 Constructor.
template<class T >
void registerCommand (int notificationName)
 Register an ICommand with the Controller by Notification name.
void removeCommand (int notificationName)
 Remove a previously registered ICommand to INotification mapping from the Controller.
bool hasCommand (int notificationName)
 Check if a Command is registered for a given Notification.
void registerProxy (IProxy *proxy)
 Register an IProxy with the Model by name.
IProxyretrieveProxy (std::string proxyName)
 Retrieve an IProxy from the Model by name.
IProxyremoveProxy (std::string proxyName)
 Remove an IProxy from the Model by name.
bool hasProxy (std::string proxyName)
 Check if a Proxy is registered.
void registerMediator (IMediator *mediator)
 Register a IMediator with the View.
IMediatorretrieveMediator (std::string mediatorName)
 Retrieve an IMediator from the View.
IMediatorremoveMediator (std::string mediatorName)
 Remove an IMediator from the View.
bool hasMediator (std::string mediatorName)
 Check if a Mediator is registered or not.
void sendNotification (int notificationName, void *body, int notificationType)
 Create and send an INotification.
void sendNotification (int notificationName, void *body)
 Send a INotification.
void sendNotification (int notificationName, int notificationType)
 Send a INotification.
void sendNotification (int notificationName)
 Send a INotification.
void notifyObservers (INotification *notification)
 Notify Observers.
void initializeNotifier (std::string key)
 Set the Multiton key for this facade instance.
virtual void setMultitonKey (std::string key)=0
 Set multiton key.
virtual std::string getMultitonKey ()=0
 Get multiton key.
virtual void setMultitonKey (std::string key)
 Set multiton key.
virtual std::string getMultitonKey ()
 Get multiton key.

Static Public Member Functions

static FacadegetInstance (std::string)
 Facade multiton factory method.
static bool hasCore (std::string key)
 Check if a Core is registered or not.
static void removeCore (std::string key)
 Remove a Core.

Protected Member Functions

void initializeFacade ()
 Initialize the Multiton Facade instance.
void initializeController ()
 Initialize the Controller.
void initializeModel ()
 Initialize the Model.
void initializeView ()
 Initialize the View.

Protected Attributes

IControllercontroller
IModelmodel
IViewview

Detailed Description

A base Multiton IFacade implementation.

See also:
Model
View
Controller

Constructor & Destructor Documentation

Facade::Facade (  ) 

Constructor.

This IFacade implementation is a Multiton, so you should not call the constructor directly, but instead call the static Factory method, passing the unique key for this instance Facade.getInstance( multitonKey )

Exceptions:
Error Error if instance for this Multiton key has already been constructed

Member Function Documentation

Facade * Facade::getInstance ( std::string  key  )  [static]

Facade multiton factory method.

Returns:
the Multiton instance of the Facade
std::string MultitonKeyHeir::getMultitonKey (  )  [virtual, inherited]

Get multiton key.

Returns the multiton key.

Returns:
The string key name

Implements PureMVC::IMultitonKeyHeir.

virtual std::string PureMVC::IMultitonKeyHeir::getMultitonKey (  )  [pure virtual, inherited]

Get multiton key.

Returns the multiton key.

Returns:
The string key name

Implemented in PureMVC::MultitonKeyHeir.

bool Facade::hasCommand ( int  notificationName  )  [virtual]

Check if a Command is registered for a given Notification.

Parameters:
notificationName 
Returns:
whether a Command is currently registered for the given notificationName.

Implements PureMVC::IFacade.

bool Facade::hasCore ( std::string  key  )  [static]

Check if a Core is registered or not.

Parameters:
key the multiton key for the Core in question
Returns:
whether a Core is registered with the given key.
bool Facade::hasMediator ( std::string  mediatorName  )  [virtual]

Check if a Mediator is registered or not.

Parameters:
mediatorName 
Returns:
whether a Mediator is registered with the given mediatorName.

Implements PureMVC::IFacade.

bool Facade::hasProxy ( std::string  proxyName  )  [virtual]

Check if a Proxy is registered.

Parameters:
proxyName 
Returns:
whether a Proxy is currently registered with the given proxyName.

Implements PureMVC::IFacade.

void Facade::initializeController (  )  [protected]

Initialize the Controller.

Called by the initializeFacade method. Override this method in your subclass of Facade if one or both of the following are true:

  • You wish to initialize a different IController.
  • You have Commands to register with the Controller at startup..

If you don't want to initialize a different IController, call super.initializeController() at the beginning of your method, then register Commands.

void Facade::initializeFacade (  )  [protected]

Initialize the Multiton Facade instance.

Called automatically by getInstance.

void Facade::initializeModel (  )  [protected]

Initialize the Model.

Called by the initializeFacade method. Override this method in your subclass of Facade if one or both of the following are true:

  • You wish to initialize a different IModel.
  • You have Proxys to register with the Model that do not retrieve a reference to the Facade at construction time.

If you don't want to initialize a different IModel, call super.initializeModel() at the beginning of your method, then register Proxys.

Note: This method is rarely overridden; in practice you are more likely to use a Command to create and register Proxys with the Model, since Proxys with mutable data will likely need to send INotifications and thus will likely want to fetch a reference to the Facade during their construction.

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

Set the Multiton key for this facade instance.

Not called directly, but instead when getInstance is invoked. It is necessary to be public in order to implement INotifier.

Implements PureMVC::INotifier.

void Facade::initializeView (  )  [protected]

Initialize the View.

Called by the initializeFacade method. Override this method in your subclass of Facade if one or both of the following are true:

  • You wish to initialize a different IView.
  • You have Observers to register with the View

If you don't want to initialize a different IView, call super.initializeView() at the beginning of your method, then register IMediator instances.

Note: This method is rarely overridden; in practice you are more likely to use a Command to create and register Mediators with the View, since IMediator instances will need to send INotifications and thus will likely want to fetch a reference to the Facade during their construction.

void Facade::notifyObservers ( INotification notification  )  [virtual]

Notify Observers.

This method is left public mostly for backward compatibility, and to allow you to send custom notification classes using the facade.

Usually you should just call sendNotification and pass the parameters, never having to construct the notification yourself.

Parameters:
notification the INotification to have the View notify Observers of.

Implements PureMVC::IFacade.

template<class T >
void PureMVC::Facade::registerCommand ( int  notificationName  )  [inline]

Register an ICommand with the Controller by Notification name.

commandClassRef a reference to the Class of the ICommand

Parameters:
notificationName the name of the INotification to associate the ICommand with
void Facade::registerMediator ( IMediator mediator  )  [virtual]

Register a IMediator with the View.

Parameters:
mediatorName the name to associate with this IMediator
mediator a reference to the IMediator

Implements PureMVC::IFacade.

void Facade::registerProxy ( IProxy proxy  )  [virtual]

Register an IProxy with the Model by name.

Parameters:
proxyName the name of the IProxy.
proxy the IProxy instance to be registered with the Model.

Implements PureMVC::IFacade.

void Facade::removeCommand ( int  notificationName  )  [virtual]

Remove a previously registered ICommand to INotification mapping from the Controller.

Parameters:
notificationName the name of the INotification to remove the ICommand mapping for

Implements PureMVC::IFacade.

void Facade::removeCore ( std::string  key  )  [static]

Remove a Core.

Remove the Model, View, Controller and Facade instances for the given key.

Parameters:
multitonKey of the Core to remove
IMediator * Facade::removeMediator ( std::string  mediatorName  )  [virtual]

Remove an IMediator from the View.

Parameters:
mediatorName name of the IMediator to be removed.
Returns:
the IMediator that was removed from the View

Implements PureMVC::IFacade.

IProxy * Facade::removeProxy ( std::string  proxyName  )  [virtual]

Remove an IProxy from the Model by name.

Parameters:
proxyName the IProxy to remove from the Model.
Returns:
the IProxy that was removed from the Model

Implements PureMVC::IFacade.

IMediator * Facade::retrieveMediator ( std::string  mediatorName  )  [virtual]

Retrieve an IMediator from the View.

Parameters:
mediatorName 
Returns:
the IMediator previously registered with the given mediatorName.

Implements PureMVC::IFacade.

IProxy * Facade::retrieveProxy ( std::string  proxyName  )  [virtual]

Retrieve an IProxy from the Model by name.

Parameters:
proxyName the name of the proxy to be retrieved.
Returns:
the IProxy instance previously registered with the given proxyName.

Implements PureMVC::IFacade.

void Facade::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 Facade::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 Facade::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 Facade::sendNotification ( int  notificationName,
void *  body,
int  notificationType 
) [virtual]

Create and send an INotification.

Keeps us from having to construct new notification 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.

virtual void PureMVC::IMultitonKeyHeir::setMultitonKey ( std::string  key  )  [pure virtual, inherited]

Set multiton key.

Sets the multiton key.

Parameters:
key The name of the key

Implemented in PureMVC::MultitonKeyHeir.


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

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