//list_c.h
/*************************************************************************
@class: List
This is a first-pass implementation of a List class that uses only C
and basic C++ enhancements to C for its implementation. The purpose of
this class is to work out the basic functionality of the list class as
well as practice a few functional C++ enhancements prior to movinging
into more advanced concepts.
*************************************************************************/
#ifndef ListC_H
#include <stdio.h> 	//needed for size_t
#include <iostream.h>

struct List	{
	enum { ELEMENTS=10 };
	void *values_[ELEMENTS];
	int count_;    	//number of elements filled
	int current_;	   //current index into list
};

List* List_ctor();
List* List_ctor(const List&);
void dtor(List* theList);
int insert(List* theList, void* value);
inline size_t entries(const List* theList) { return theList->count_; }
void* at(const List* theList,size_t pos);
void *getFirst(List* theList);
void* next(List* theList);
void assign(List* theList, const List& source);
int isEqual(List* theList, const List&);
typedef int (*Writer)(void*, ostream& str);
typedef int (*Reader)(void*&, istream& str);
int saveOn(const List*  theList, ostream& str, Writer writer);
int restoreFrom(List* theList, istream& str, Reader reader);
#endif
//end of file


