114 lines
2.6 KiB
C++
114 lines
2.6 KiB
C++
//## begin module.cm preserve=no
|
|
|
|
// %X% %Q% %Z% %W%
|
|
|
|
//## end module.cm
|
|
|
|
|
|
|
|
//## begin module.cp preserve=no
|
|
|
|
//## end module.cp
|
|
|
|
|
|
|
|
//## Module: List; Pseudo Package specification
|
|
|
|
//## Subsystem: figures
|
|
|
|
//## Source file: H:\kurs\avC++\lab4\List.h
|
|
|
|
|
|
|
|
#ifndef List_h
|
|
|
|
#define List_h 1
|
|
|
|
|
|
|
|
//## begin module.additionalIncludes preserve=no
|
|
|
|
//## end module.additionalIncludes
|
|
|
|
|
|
|
|
//## begin module.includes preserve=yes
|
|
|
|
//## end module.includes
|
|
|
|
|
|
|
|
// Node
|
|
|
|
#include "Node.h"
|
|
|
|
//## begin module.additionalDeclarations preserve=yes
|
|
|
|
//## end module.additionalDeclarations
|
|
|
|
|
|
|
|
|
|
|
|
//## Class: List; Parameterized Class
|
|
|
|
//## Category: Figures
|
|
|
|
//## Subsystem: figures
|
|
|
|
//## Persistence: Transient
|
|
|
|
//## Cardinality/Multiplicity: n
|
|
|
|
|
|
|
|
template <class T>
|
|
|
|
class List
|
|
|
|
{
|
|
|
|
//## begin List.initialDeclarations preserve=yes
|
|
|
|
//## end List.initialDeclarations
|
|
|
|
|
|
|
|
public:
|
|
|
|
//## Constructors (generated)
|
|
|
|
List();
|
|
|
|
|
|
|
|
//## Destructor (generated)
|
|
|
|
~List();
|
|
|
|
|
|
|
|
|
|
|
|
//## Other Operations (specified)
|
|
|
|
//## Operation: getFirst%937920679
|
|
|
|
T getFirst ();
|
|
|
|
|
|
|
|
//## Operation: getNext%937920680
|
|
|
|
T getNext ();
|
|
|
|
|
|
|
|
//## Operation: isLast%937920681
|
|
|
|
bool isLast ();
|
|
|
|
|
|
|
|
//## Operation: addElement%938503949
|
|
|
|
void addElement (T element);
|
|
|
|
|
|
|
|
//## Operation: isEmpty%939023037
|
|
|
|
bool isEmpty ();
|
|
|
|
|
|
|
|
|
|
|
|
// Additional Public Declarations
|
|
|
|
//## begin List.public preserve=yes
|
|
|
|
int getSize ();
|
|
|
|
//## end List.public
|
|
|
|
|
|
|
|
protected:
|
|
|
|
// Additional Protected Declarations
|
|
|
|
//## begin List.protected preserve=yes
|
|
|
|
//## end List.protected
|
|
|
|
|
|
|
|
private:
|
|
|
|
// Additional Private Declarations
|
|
|
|
//## begin List.private preserve=yes
|
|
|
|
//## end List.private
|
|
|
|
|
|
|
|
private: //## implementation
|
|
|
|
// Data Members for Has Relationships
|
|
|
|
|
|
|
|
//## Documentation List::head.has
|
|
|
|
//## begin List::head.has preserve=no public: Node {1 -> 1UO}
|
|
|
|
Node<T> *head;
|
|
|
|
//## end List::head.has
|
|
|
|
|
|
|
|
// Data Members for Class Attributes
|
|
|
|
|
|
|
|
//## Attribute: current
|
|
|
|
//## begin List::current.attr preserve=no private: Node<T> {R}
|
|
|
|
Node<T> *current;
|
|
|
|
//## end List::current.attr
|
|
|
|
|
|
|
|
// Additional Implementation Declarations
|
|
|
|
//## begin List.implementation preserve=yes
|
|
|
|
int size;
|
|
|
|
//## end List.implementation
|
|
|
|
|
|
|
|
};
|
|
|
|
|
|
|
|
//## begin List.postscript preserve=yes
|
|
|
|
#include "list.cpp"
|
|
|
|
//## end List.postscript
|
|
|
|
|
|
|
|
// Parameterized Class List
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
//## begin module.epilog preserve=yes
|
|
|
|
//## end module.epilog
|
|
|
|
|
|
|
|
|
|
|
|
#endif
|
|
|