VR-Vantage API Documentation
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
10.5 - The Creator Pattern

Table of Contents

The Creator pattern lets you replace a single class in a system with a specialized subclass.

You might do this to fix a bug, or to add or change the behavior of specific functions. This is usually done through the Factory Method pattern. Unfortunately, if an application allows multiple parallel hierarchies (such as two display engines in the same application), the Factory Method pattern fails, because it indiscriminately sets the override class for all users. To implement similar behavior, but allow for changes to a class implementation tied to a specific root object, VR-Vantage uses the Creator pattern.

The Creator pattern involves two classes, the class which can be replaced (called the object class) and a class that does the creation (called the creator class). The creator instance is a Rooted Singleton of a given type registered with the root display engine. It can be accessed by anyone who has a root object pointer. All users of the object class use a Rooted Singleton of the creator class to create an instance of the object class.

The exampleCreator example uses the Creator pattern to cause a derived channel to get created when the display engine creates a channel. For details, please see the exampleCreator example.

10.5.1 The Creator Pattern Specification

The Creator pattern has the following requirements and behavior:

[<< The Factory Pattern] [Home] [Top of Page] [The Humble Dialog Pattern >>]



Copyright © 2005-2013 VT MÄK. All Rights Reserved (www.mak.com)