Controller |
Detailed Description
A Controller is a one-way channel for information to travel from outside a model/view/controller system into the system. It is intended to send notifications into the system of events outside the system. A controller is not allowed to display anything about the system to which it belongs -- that is the responsibility of a View [1].
- Refinement Of:
- Associated Types:
- The only type associated with the controller is the data structure that view is intended to represent. This is the value_type of the controller, and is used when setting the view to a new value of that type. In order to set a value within a model, a notification callback must be bound to the controller from the model.
Value Type typename controller_model_type<Controller>::type
The value type for the data for which the controller is sending notifications
- Notation:
T
A type that is a model of View t
Object of type T
- Definitions:
- Valid Expressions:
Name Expression Type requirements Return type Monitor monitor(t, p);
See monitor for requirements on p
void
- Expression Semantics:
Name Expression Precondition Semantics Postcondition
- Complexity Guarantees:
- Invariants:
- Type(s) Modeling this Concept:
- Any device that sends information from outside a system into the system itself. An example might be an audio microphone or a checkbox when it is selected (however, its visual updating is a View property, not part of its functionality as a controller).
- Notes:
- [1] It is legal for any one implementation to model both a Controller and a View at the same time.
- See Also:
- Example:
void my_notification_proc(const typename controller_model_type<Controller>::type& x) { std::cout << "the value of the controller changed to " << x << std::endl; } Controller t; using adobe::monitor; monitor(t, &my_notification_proc);