CSE 532S Component Configurator Studio

Please complete the required studio exercises listed below, along with the (optional) enrichment exercises if they interest you.

As you work through the exercises, please record your answers in a file, and upon completion please send e-mail with your answers to the cse532@seas.wustl.edu account with subject line Component Configurator studio.

Please make sure that the name of each person who worked on these exercises is listed at the top of your reply message, and that you number your answers so they are easy for us to match up with the appropriate exercise.

Visual Studio 2013 is not successfully compiling ACE on the Windows machines in Urbauer 218, so you should please use Visual Studio 2012 for this studio (and for subsequent studios and for the lab 3 assignment).


    Required Exercises

  1. If you have not done so already, modify your client code from the Acceptor and Connector studio exercises (or if you would like one of the later studios that extends that code) so that each of the service handlers is a subclass of the ACE_Service_Object class (either directly or through multiple levels of inheritance, possibly via another ACE class that is derived from it. As the answer to this exercise please name the most derived ACE class along the inheritance path from ACE_Service_Object to each of your client-side service handler classes.

  2. Implement a singleton data structure into which a pointer to each service handler is stored when it is created along with an initially empty string that serves as a label for that object. Each time a service handler's address is initially entered into the data structure, and/or each time the label for a service handler object is changed in the data structure, a list with the label and address (as a hexadecimal number) of each object in the data structure should be printed out to cout (in a thread-safe manner if and as necessary). Compile and run your client code, and as the answer to this exercise show one of the lists of service handler labels and addresses.

  3. Implement a simple user interface that reads one line of text at a time from cin and if the line is a recognizable command, enacts it. The code for this feature should run concurrenctly with the other client code, by wrapping it within a reactively dispatched service handler, an active object, or both, and should interact with other client-side objects in a thread-safe manner as needed.

    Implement handling for a command of the form rename <address> <label>, where <address> is a hexadecimal number and <label> is a string of characters with no intervening spaces. When that command is given to the client program's standard input, the user interface should first look up whether an object having the address given by the hexadecimal number is found in the data structure you implemented in the previous exercise. If so it should replace the label for that service handler and again print out the list of handler labels and addresses. If not it should issue an appropriate error message (to cerr or cout, again in a thread-safe manner). As the answer to this exercise please show output of your programs that demonstrates this behavior.

  4. If you have not done so already, implement init, fini, suspend, resume, and info methods in your service handlers (e.g., according to the description of the ACE_Service_Object interface given in Section 5.2 of the C++NPV2 textbook). In particular, each service object should maintain a variable that records its current status (running, suspended, etc.) which should be printed out by the info method and also may affect the applicability or behavior of various methods (and their commands described next).

    Implement corresponding commands in your user interface which are enacted by calling the appropriate method on the appropriate service handler object. Those commands should allow objects to be referred to either by their labels, though optionally you may also support commands referring to objects by their addresses. Build and run your client code, and as the answer to this exercise please (1) summarize how you implemented each of the commands, and (2) show representative output demonstrating the use of each command.

    Enrichment Exercises (Optional)

  5. Modify your server code in a similar manner to how you extended your client code per the exercises above. Run your server on a different machine (or at least in a separate terminal window) than your client and try issuing different commands to your server's handler objects through its cin based user interface. As the answer to this exercise please summarize the changes you made and show a fragment of the output produced by each of the different commands.

  6. After completing the previous enrichment exercise, modify the user interfaces for both your client and server commands so that commands can be issued selectively to either the client or the server (e.g., by prefixing commands with "C" or "S" to indicate which they are targeting, or allowing the user interface to be toggeled between different modes, one targeting the client and one targeting the server.

    Modify the client and server so that if a command for the other is received on one it passes it along to the other, and if a command addressed to it is received (either from the local user interface or from the other side) it is enacted. As the answer to this exercise please summarize the changes you made and show a fragment of the output produced by each of the different commands.