Real-Time Design Patterns
Bruce Powel Douglass · 1999
away data structuring concepts from application domain classes to simply model and facilitate reuse Interface Abstract away the type of an object from its implementation to support multiple implementations of a given type and to support multiple types with a common internal structure. Policy Provide the ability to easily change algorithms and procedures dynamically. Reuse Rendezvous Provide a flexible mechanism for light-weight intertask communication. State Provide an optimal state machine implementation when some state changes are infrequent State Behavior State Table Provide an efficient means to maintain and execute large complex state machines It is common that a single source of information acts as a server for multiple clients who must be autonomously updated when the data value changes. This is particularly true with real-time data acquired through sensors. The problem is how to design an efficient means for all clients to be notified. The Observer pattern is one design solution. A single object, called the server, provides the data automatically to its clients, called observers. These are abstract classes which may be subclassed (into Concrete Server and Concrete Observer) to add the specialized behavior to deal with the specific information being served up. The observers register with the server by calling the server's Subscribe() method and deregister by calling the Detach() method. When the server receives a subscribe message, it creates a Notification Handle object which includes the address of the object. This address may be either a pointer, if the object is in the same data address space, or a logical address or identifier to be resolved by a separate communications subsystem or object broker if the target object is in a remote address space. The Not...