Publishers of technology books, eBooks, and videos for creative people

Home > Articles > Web Design & Development > PHP/MySQL/Scripting

  • Print
  • + Share This
Like this article? We recommend

Mediator Subclass

Listing 3 illustrates the mediator subclass, LspDirector, which is derived from ConnectionDirector. Notice that this derived class is less generic than the base class for the reasons mentioned in the previous section.

Listing 3 Mediator Class: LspDirector

class LspDirector : public ConnectionDirector
  explicit LspDirector(int);
  virtual ~LspDirector(void);

  virtual void WidgetChanged(Widget*);
  virtual void CreateWidgets();
  void ChangePath(char*);
  void ChangeQoSDetails(char*);

  int lspId;
  PathWidget* _lspPath;
  QosWidget* _qosDescriptor;

The class LspDirector contains three private data members that relate to the dependent objects. The lspId is used to differentiate each LSP instance in the network; in other words, each LSP has its own instance ID. So, in Figure 1, LSP123 has a unique ID that differs from any other LSP in the network. The other two data members are pointers to the dependent objects (the widgets—more about them in the next section).

The two methods ChangePath() and ChangeQoSDetails() are used to apply configuration changes to the widgets. Let’s now finally see what’s in a widget!

  • + Share This
  • 🔖 Save To Your Account