home *** CD-ROM | disk | FTP | other *** search
/ Liren Large Software Subsidy 7 / 07.iso / c / c081_11 / 1.ddi / CLASSINC.ZIP / STACK.H < prev    next >
Encoding:
C/C++ Source or Header  |  1991-02-13  |  2.2 KB  |  108 lines

  1. // Borland C++ - (C) Copyright 1991 by Borland International
  2.  
  3. // Contents ----------------------------------------------------------------
  4. //
  5. //      Stack
  6. //
  7. // Description
  8. //
  9. //      Defines the class Stack.
  10. //
  11. // End ---------------------------------------------------------------------
  12.  
  13. // Interface Dependencies ---------------------------------------------------
  14.  
  15. #ifndef __STACK_H
  16. #define __STACK_H
  17.  
  18. #ifndef __IOSTREAM_H
  19. #include <iostream.h>
  20. #define __IOSTREAM_H
  21. #endif
  22.  
  23. #ifndef __CLSTYPES_H
  24. #include <clstypes.h>
  25. #endif
  26.  
  27. #ifndef __OBJECT_H
  28. #include <object.h>
  29. #endif
  30.  
  31. #ifndef __CONTAIN_H
  32. #include <contain.h>
  33. #endif
  34.  
  35. #ifndef __LIST_H
  36. #include <list.h>
  37. #endif
  38.  
  39. // End Interface Dependencies ------------------------------------------------
  40.  
  41. // Class //
  42.  
  43. class Stack:  public Container
  44. {
  45. public:
  46.     virtual ~Stack();
  47.  
  48.             void            push( Object& );
  49.             Object&         pop();
  50.             Object&         top() const;
  51.     virtual int             isEmpty() const;
  52.  
  53.     virtual ContainerIterator& initIterator() const;
  54.  
  55.     virtual classType       isA() const;
  56.     virtual char           *nameOf() const;
  57.     virtual hashValueType   hashValue() const;
  58.  
  59. private:
  60.     List    theStack;
  61. };
  62.  
  63. // Description -------------------------------------------------------------
  64. //
  65. //     Defines the container class Stack.
  66. //
  67. // Public Members
  68. //
  69. //     push
  70. //
  71. //     Pushes an object on the stack.
  72. //
  73. //     pop
  74. // 
  75. //     Pops an object from the stack and delivers that object into the
  76. //      ownership of the receiver.
  77. //
  78. //      top
  79. //
  80. //      Returns a refrence to the object on the top of the stack.  The
  81. //      object remains in the ownership of the stack.  You must make 
  82. //      sure not to destroy this object while it is still owned by the stack.
  83. //
  84. //      initIterator
  85. //
  86. //      Stack iterator initializer.
  87. //
  88. //     isA
  89. //
  90. //     Returns the class type for a stack.
  91. //
  92. //     nameOf
  93. //
  94. //     Returns a pointer to the character string "Stack."
  95. //     
  96. //     hashValue
  97. //
  98. //     Returns a pre-defined value for stacks.
  99. //
  100. //     isEmpty
  101. //
  102. //     Returns whether the stack is empty.
  103. //
  104. // End ---------------------------------------------------------------------
  105.  
  106. #endif  // __STACK_H
  107.  
  108.