A Multiton IModel
implementation.
More...
#include <pmvcpp.h>
Public Member Functions | |
Model () | |
Constructor. | |
void | registerProxy (IProxy *proxy) |
Register an IProxy with the Model . | |
IProxy * | retrieveProxy (std::string proxyName) |
Retrieve an IProxy from the Model . | |
bool | hasProxy (std::string proxyName) |
Check if a Proxy is registered. | |
IProxy * | removeProxy (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 IModel * | getInstance (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 |
A Multiton IModel
implementation.
In PureMVC, the Model
class provides access to model objects (Proxies) by named lookup.
The Model
assumes these responsibilities:
IProxy
instances. IProxy
instances. 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.
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
.
IModel * Model::getInstance | ( | std::string | key | ) | [static] |
std::string MultitonKeyHeir::getMultitonKey | ( | ) | [virtual, inherited] |
Get multiton key.
Returns the multiton key.
Implements PureMVC::IMultitonKeyHeir.
bool Model::hasProxy | ( | std::string | proxyName | ) | [virtual] |
Check if a Proxy is registered.
proxyName |
proxyName
. Implements PureMVC::IModel.
void Model::registerProxy | ( | IProxy * | proxy | ) | [virtual] |
Register an IProxy
with the Model
.
Implements PureMVC::IModel.
void Model::removeModel | ( | std::string | key | ) | [static] |
IProxy * Model::removeProxy | ( | std::string | proxyName | ) | [virtual] |
IProxy * Model::retrieveProxy | ( | std::string | proxyName | ) | [virtual] |
Retrieve an IProxy
from the Model
.
proxyName |
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.
key | The name of the key |
Implements PureMVC::IMultitonKeyHeir.