#ifndef LISTELEMENT_H #define LISTELEMENT_H //***************************************************************************** // // ListElement.h // //***************************************************************************** // // Copyright (C) 1996 // // Ronald A. MacCracken // Graduate Student // Computer Science Department // University of California // Davis, CA 95616 // // Permission is granted to use at your own risk and // distribute this software in source and binary forms // provided the above copyright notice and this paragraph // are preserved on all copies. This software is provided // "as is" with no express or implied warranty. // //***************************************************************************** //***************************************************************************** // // NOTE: This class is used solely by the the template List and ListIterator // classes, and should not be used in application code. // // This class' constructors, like the List class, creates copies of the // data if a reference is passed, but uses the data if a pointer is passed. // //***************************************************************************** template class ListElement { private: TYPE data ; ListElement* next ; private: void Copy ( const ListElement& ) ; void Delete ( void ) ; public: // default constructor ListElement ( void ) ; // user-defined constructors ListElement ( const TYPE& ) ; // copy constructors ListElement ( const ListElement& ) ; // destructors ~ListElement ( void ) ; // assignment operator ListElement& operator= ( const ListElement& ) ; // return new element with same data ListElement* Get_Copy ( void ) const ; // access functions ListElement* Get_Next ( void ) const { return next ; } TYPE& Get_Data ( void ) { return data ; } const TYPE& Get_Data ( void ) const { return data ; } void Set_Data ( const TYPE& d ) { data = d ; } void Set_Next ( ListElement* n ) { next = n ; } } ; #include "ListElement.C" #endif