home *** CD-ROM | disk | FTP | other *** search
/ Windows Game Programming for Dummies (2nd Edition) / WinGamProgFD.iso / pc / DirectX SDK / DXSDK / samples / Multimedia / DirectPlay / Maze / MazeCommon / SimpleStack.h < prev    next >
Encoding:
C/C++ Source or Header  |  2001-10-31  |  1.0 KB  |  55 lines

  1. //----------------------------------------------------------------------------
  2. // File: simplestack.h
  3. //
  4. // Desc: see main.cpp
  5. //
  6. // Copyright (c) 1999-2001 Microsoft Corp. All rights reserved.
  7. //-----------------------------------------------------------------------------
  8. #ifndef _SIMPLE_STACK_H
  9. #define _SIMPLE_STACK_H
  10.  
  11.  
  12.  
  13.  
  14. //-----------------------------------------------------------------------------
  15. // Name: 
  16. // Desc: 
  17. //-----------------------------------------------------------------------------
  18. template< class Item , DWORD size > class SimpleStack
  19. {
  20. public:
  21.     SimpleStack()
  22.     {
  23.         m_dwCount = 0;
  24.     };
  25.  
  26.     void    Push( const Item& item )
  27.     {
  28.         m_Stack[m_dwCount++] = item;
  29.     };
  30.  
  31.     Item    Pop()
  32.     {
  33.         return m_Stack[--m_dwCount];
  34.     };
  35.  
  36.     DWORD   GetCount() const
  37.     {
  38.         return m_dwCount;
  39.     };
  40.  
  41.     void    Empty()
  42.     {
  43.         m_dwCount = 0;
  44.     };
  45.  
  46. private:
  47.     Item    m_Stack[size];
  48.     DWORD   m_dwCount;
  49. };
  50.  
  51.  
  52.  
  53.  
  54. #endif
  55.