Arrays of elements. Use your
Arrayimplementation from Lab 2. You can assume that the type with which the
Arrayis instantiated supports the less-than (<) operation, and supports shifting to/from
Arrayare encapsulated in a
Sorterobject sorts the data in each
Sort_Info<T>, then places the output in the
Sorterto see the results of, and progress of, a sort. Observers can use these sort results in one of several forms, such as graphically or with simple text.
Sorterinterface (Sorter.h) that is part of the distribution for this lab.
Sort_Infotemplate class (Sort_Info.h) that is part of the distribution for this lab.
Sort_Observerinterface (Sort_Observer.h) that is part of the distribution for this lab. See the Sort Viewer section, below, for information on using the Sort Viewer.
Sort_Infotemplate class, based on the interface supplied.
Sorter. It must:
Sort_Info<T>requests and returns
Sort Viewer. This should simply be a matter of adding calls to the
Sort_Observerinterface to your selection sort implementation.
NOTE: this Lab should involve fewer of the intricate C++ details that we've encountered in previous labs. However, it does require more planning and design work up front. Please allow sufficient time for that. If you haven't completed your design and started the implementation by the end of the first week, you probably won't be able to complete the lab by the end of the second week.
Sort_Info_Base class declares a few enums. enums are
separate types, like classes. But, they can only have a limited
number of values, which are specified in the enum declaration. enums
are represented with integers (or something smaller), and can be
promoted to (used as) integers.
Shifting enums from istreams is a bit tricky. The course C++ I/O slides (gzip-ps) (pdf) show a couple of ways to do it; see slides 14-16. You can use either approach for Lab 6.
You can use your
Sort_Info_Base::print () and
Sort_Info_Base::read () methods in the derived
Sort_Info<T>) class, even though they're pure
virtual. Just call them explicitly, using the
~cs342/bin/lab6. That will copy several files to a new
lab6subdirectory. You can
cd lab6and enter
maketo compile the code, if you like. However, it will not build until your implementation is filled in.
NOTE: You can use the distribution mechanism to
revert one or more of your files at any time. First, delete the file
mv it to a file with a different name, such
Sorter.cc.BAD). Then, run
cvs update to
update your workspace. That will replace any missing files. It will
also let you know of any files that you modified but did not delete.
cvs is in pkg
gnu, in case you don't find it
After obtaining the Lab 6 distribution, copy your
Array.cc files from your Lab 2 or 5 workspace.
readme) documenting what you did to satisfy this assignment.
readmecontains a minimum list of sections that you must provide. (Please replace the comments in  with your descriptions.) These files will be submitted automatically when you execute the command:
NOTE: there is a Makefile target that allows you to test what you are going to turn in:
It places the output that will be
turned in into the
TEST_TURNIN directory. You are
responsible for using
make test_turnin, and verifying
that the files that you will submit are correct.
Sort_Viewer_Client. To use:
Sort_Viewer_Client.cc. It would be best to write a small adapter class to insulate the direct calls, and to make it easier to shutdown the
Sort_Viewer_Clientconnection to the
% pkgadd java_1.1.7 % javac Sort_Viewer.java % java Sort_Viewer &
Please see the Lab 4 assignment for notes on using the History class to help track and count instantiations and deletions of an instrumented class.
Please see the Lab 2 assignment for hints on compiling templates.