Educational Objectives: After completion of this assignment, the student should be able to accomplish the following:
Background Knowledge Required: Be sure that you have mastered the material in these chapters before beginning the project: Templates , Positional Containers , Algorithm Complexity , ADTs: Stack and Queue , Function Classes and Objects , Iterators , Generic Algorithms , and Lists .
Operational Objectives: Create files constiter.h and reviter.h that contain class templates adapting any X::Iterator into X::ConstIterator and X::ReverseIterator, respectively, conforming to the type definitions in the files vector_fast_reverse.h, vector_safe_reverse.h, deque_reverse.h and list_reverse.h. (These files are in LIB/tcpp, where LIB = ~cop5517p/spring12.)
Deliverables: Five code files:
Plus report.pdf submitted to Blackboard.constiter.h # ConstRAIterator reviter.h # ReverseRRAIterator vector_reverse.cpp # implements Vector reverse iterator support deque_reverse.cpp # implements Deque reverse iterator support list_reverse.cpp # implements List reverse iterator support
Copy the files LIB/proj2/* into your working directory.
Create your files constiter.h and reviter.h containing the class templates ConstRAIterator<I> and ReverseRAIterator<I>, respectively.
One container at a time (starting with fsu::List), create files list_reverse.cpp, deque_reverse.cpp, and vector_reverse.cpp that implement the container support for reverse iterators. Note that the Vector case is the most complex and subtle, because this one file must support two different versions: fsu::fast::Vector and fsu::safe::Vector.
Test as you create, using fConstIter.cpp, fConstReverseIter.cpp, fTraverse.cpp, and fTraverseReverse.cpp (appropriately configured).
When all containers are supported, test again with fConstIter5.cpp, fConstReverseIter4.cpp, fTraverse5.cpp, and fTraverseReverse4.cpp. You may want to create several more test clients by copying and modifying the ones that are distributed in LIB/tests for the basic containers (fvector.cpp, fdeque.cpp, flist.cpp, mlist.cpp.
Write a report on your work and findings submitted as report.pdf.
Turn in the five code files using the proj2submit.sh submit script.
Warning: Submit scripts do not work on the program and linprog servers. Use shell.cs.fsu.edu to submit projects. If you do not receive the second confirmation with the contents of your project, there has been a malfunction.
Turn in your report to Blackboard.
which shows that the bulk of implementation of List and List::Iterator is re-used. Only the added functionality is implemented in list_reverse.cpp.... #include <list.cpp> // basic list implementations #include <list_reverse.cpp> // added functionality for reverse iterators } // namespace fsu #endif
which shows that the bulk of implementation of Deque and Deque::Iterator is re-used. Only the added functionality is implemented in deque_reverse.cpp.... #include <deque.cpp> // basic deque implementations #include <deque_reverse.cpp> // added functionality for reverse iterators } // namespace fsu #endif
and the last few lines of vector_safe_reverse.h:... #include <vector_base.cpp> // basic vector implementations #include <vector_fast.cpp> // fast iterator implementations #include <vector_reverse.cpp> // reverse iterator implementations }} // namespace fsu::fast #endif
which shows that the bulk of implementation of fast::Vector and safe::Vector are re-used from vector_base.cpp, vector_fast.cpp, and vector_safe.cpp (all of which are library files). This also shows that fast::Vector and safe::Vector share the same code for supporting reverse iterators! This code (which you supply) is in vector_reverse.cpp.... #include <vector_base.cpp> // basic vector implementations #include <vector_safe.cpp> // safe iterator implementations #include <vector_reverse.cpp> // reverse iterator implementations }} // namespace fsu::safe #endif
Be sure that your project builds without any of the library files (other than tests) copied to the project directory.
Also note the specialized version of fvector.cpp in the project directory:flist.cpp # in LIB/tests flistReverse.cpp flistConst.cpp flistConstReverse.cpp fdeque.cpp # in LIB/tests fdequeReverse.cpp fdequeConst.cpp fdequeConstReverse.cpp
that configures among the 5 different versions of Vector.fvector5.cpp # in proj2