Notification and View Services: Overview
As explained in
Chapter 2, Rogue Wave® Server is a C++ library that lets you design server object models in which objects are interconnected via relations. Object attributes are either editable (
entry data members), or calculated automatically (
derived data members).
Suppose we want to represent the Network object server, introduced in the previous chapter. This object server implements an object model as follows:
The
Network class owns a list of
Domains defined by the
domains relation.
Each
Domain owns several
Nodes defined by the
nodes relation, and a set of
Lines defined by the
lines relation.
Each line has a capacity and uses a starting node (
input relation) and a target node (
output relation).
The nodes have an
inputCapacity and an
outputCapacity whose value is the sum of their incoming and outgoing lines, respectively.
The figure below shows the various kinds of graphical representations for this model:
A tree representation with the network object itself as the root. The domain list is at the first level and the list of nodes in each domain is at the second level.
A double-entry table where each network domain appears in a row.
A world map of the network nodes and lines.
Various Graphical Representations of the Network Object Server
Interaction between the server objects and these representations is controlled by notification services. Notification has three key features. It allows you to:
Map your server object structure to one or more representations. This mapping involves navigating from one server object to other server objects, starting from one or more objects previously designated as the
origin(s), and recursively through the relations interconnecting the server objects. During this process, known as propagation, representation objects are created and associated with some of the server objects met on the notification path.
For example, to create a map as a representation of a domain, notification will propagate along the nodes and lines relations within this domain. Each node in the domain will be associated with a dot on the map, and each line with a connector. In addition, the propagation will extend to all lines in the domain that use this node as input or output. Finally, to ensure that no connector on the map has a loose end, propagation will also extend to the input and output relations for the lines represented.
Edit server objects by editing their representations.
For example, if the starting point of a connector on a map is moved from one node to another, the input node of the associated line will change accordingly in the Network model.
This functionality requires you store the association between each representation object and the server object it represents.
Moreover, it is necessary to interpret the external modification of a representation object (for example, through user interactions) into modification(s) to perform on its associated server object.
Maintain consistency between all representations when a server object is modified:
For example, when the input node of a line changes, the corresponding row is removed from the table representing the outgoing lines of the former input node and is added to the table representing the outgoing lines of the new input node.
Symmetrically, this functionality requires you to store each server object and its representation object(s). It is also necessary to translate the modification of a server object into modification(s) of its representation objects.
Version 6.3
Copyright © 2018, Rogue Wave Software, Inc. All Rights Reserved.