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

Putting It All Together

Listing 10 illustrates an expanded version of the main() function from Listing 1.

Listing 10 Mediator In Action

int _tmain(int argc, _TCHAR* argv[])
  LspDirector* anExampleMediator = new LspDirector(555);
  anExampleMediator->ChangeQoSDetails("Expedited Forwarding");

  delete anExampleMediator;

  return 0;

Listing 10 does the following:

  1. Creates a mediator instance.
  2. Creates some widgets.
  3. Changes the widget configurations.
  4. Deletes the mediator.

Figure 2 illustrates the program output.

Figure 2

Figure 2 Program output

The first two lines of Figure 2 illustrate the path and QoS widgets being constructed and initialized. Figure 1 shows that the path R2R3R4R5 describes the route taken by LSP123. The QoS configuration is set to Assured Forwarding. The first two lines of Figure 2 occur as a result of executing the first two lines of Listing 10.

The third line in Figure 2 shows the path being modified to R2R6R5 (refer to Figure 1 for this new path). This line occurs as a result of executing the third line in Listing 10. In Figure 2 (line 4), you can see that the mediator (or director) has been informed of the change.

Then, the QoS setting is modified in exactly the same way with similar results.

  • + Share This
  • 🔖 Save To Your Account