PureMVC::Model Class Reference

A Multiton IModel implementation. More...

#include <pmvcpp.h>

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

List of all members.

Public Member Functions

 Model ()
 Constructor.
void registerProxy (IProxy *proxy)
 Register an IProxy with the Model.
IProxyretrieveProxy (std::string proxyName)
 Retrieve an IProxy from the Model.
bool hasProxy (std::string proxyName)
 Check if a Proxy is registered.
IProxyremoveProxy (std::string proxyName)
 Remove an IProxy from the Model.
virtual void setMultitonKey (std::string key)
 Set multiton key.
virtual std::string getMultitonKey ()
 Get multiton key.

Static Public Member Functions

static IModelgetInstance (std::string key)
 Model Multiton Factory method.
static void removeModel (std::string key)
 Remove an IModel instance.

Protected Attributes

std::map< std::string, IProxy * > proxyMap

Detailed Description

A Multiton IModel implementation.

In PureMVC, the Model class provides access to model objects (Proxies) by named lookup.

The Model assumes these responsibilities:

Your application must register IProxy instances with the Model. Typically, you use an ICommand to create and register IProxy instances once the Facade has initialized the Core actors.

See also:
Proxy::Proxy
IProxy::IProxy

Constructor & Destructor Documentation

Model::Model (  ) 

Constructor.

This IModel implementation is a Multiton, so you should not call the constructor directly, but instead call the static Multiton Factory method Model.getInstance( multitonKey ) Unlike the AS3 version of PMVC, if you are going to subclass Model, you should stick your initialization code in your subclass constructor. Keep in mind though, that the MultitonKey for this instance does not get set until after the constructor is called from getInstance.


Member Function Documentation

IModel * Model::getInstance ( std::string  key  )  [static]

Model Multiton Factory method.

Returns:
the instance for this Multiton key
std::string MultitonKeyHeir::getMultitonKey (  )  [virtual, inherited]

Get multiton key.

Returns the multiton key.

Returns:
The string key name

Implements PureMVC::IMultitonKeyHeir.

bool Model::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::IModel.

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

Register an IProxy with the Model.

Parameters:
proxy an IProxy to be held by the Model.

Implements PureMVC::IModel.

void Model::removeModel ( std::string  key  )  [static]

Remove an IModel instance.

Parameters:
multitonKey of IModel instance to remove
IProxy * Model::removeProxy ( std::string  proxyName  )  [virtual]

Remove an IProxy from the Model.

Parameters:
proxyName name of the IProxy instance to be removed.
Returns:
the IProxy that was removed from the Model

Implements PureMVC::IModel.

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

Retrieve an IProxy from the Model.

Parameters:
proxyName 
Returns:
the IProxy instance previously registered with the given proxyName.

Implements PureMVC::IModel.

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:34 2010 for PureMVC++ by  doxygen 1.6.1