CS251 Lab1

Writing Your Own C++ String Package and Hash Table Template

C++ Primer

DDD Tutorial

Goal

In this lab you will learn some C++ features such a operator overloading, constant arguments, iterators, and templates. You will  implement your own String C++ class and hash table template.

Part 1. Download the Initial Sources and Tests

1. Copy the tar file lab1-src.tar.Z into your working directory. lab1-src has everything you need for this part. Uncompress and untar the file:
>uncompress lab1-src.tar.Z
>tar -xvf lab1-src.tar

Part 2. Implementing MyString claSS


Modify the file "MyString.cc" to implement your own MyString class that stores internally the string as a C string. This class will make string manipulation easier. See the interface in MyString.h

Yort goal is to make all the tests that test the different methods. Run the following tests:

TestMyString test1
TestMyString test2
TestMyString test3
TestMyString test4
TestMyString test5
TestMyString test6

Part 3. Implement HashTableVoid

Implement the class HashTableVoid that maps strings of type "const char *" to data of type "void *". Implement this class as covered in class.

Your goal is to make all the tests for the HashTableVoid class run.

HashTableVoidTest test1
HashTableVoidTest test2
HashTableVoidTest test3
HashTableVoidTest test4
HashTableVoidTest test5
HashTableVoidTest test6

Part 4. Implement HashTableTemplate

Implement the class HashTableTemplate that maps strings of type "const char *" to data of any type. Implement this class as covered in class.

Your goal is to make all the tests for the HashTableTemplate class run.

HashTableTemplateTest test1
HashTableTemplateTest test2
HashTableTemplateTest test3
HashTableTemplateTest test4
HashTableTemplateTest test5
HashTableTemplateTest test6

Also make sure to run the following tests:

testWcVoid
testWcTemplate

Here is an example of a Linked List Template: ListTemplate.h and ListTemplateTest.cc that you can use as base for your implementation.

Turning in Your Project

Follow these instructions to turnin lab1. Make sure to run the testall script often since your lab will be graded using this script.
  1. Login to your data acocunt.
  2. Change to the directory above lab1-src.
  3. Type "turnin -c cs251 -p lab1 lab1-src"
  4. Type  "turnin -c cs251 -p lab1 -v" to make sure you have submitted the right files.
The deadline for this lab is Thursday June 23th, 11:59pm.