home *** CD-ROM | disk | FTP | other *** search
/ Tricks of the Windows Gam…ming Gurus (2nd Edition) / Disc2.iso / msdn_vcb / samples / vc98 / sdk / netds / winsock / dt_dll / cstack.h next >
Text File  |  1997-09-21  |  978b  |  42 lines

  1. /*++
  2.  
  3.   Copyright (c) 1995 Intel Corp
  4.  
  5.   Module Name:
  6.  
  7.     cstack.h
  8.  
  9.   Abstract:
  10.  
  11.     Creates a subclass of Stack_c that can push and pop an integer
  12.     counter onto or off a stack.
  13.  
  14. --*/
  15. #ifndef _CSTACKH_
  16. #define _CSTACKH_
  17.  
  18. #include "nowarn.h"  /* turn off benign warnings */
  19. #ifndef _WINSOCKAPI_
  20. #define _WINSOCKAPI_   /* Prevent inclusion of winsock.h in windows.h */
  21. #endif
  22. #include <winsock2.h>
  23. #include "nowarn.h"  /* some warnings may have been turned back on */
  24. #include "nideque.h"
  25. #include "stack.h"
  26.  
  27. class Cstack_c : private Stack_c<int> {
  28.  
  29. public:
  30.     Cstack_c() : Stack_c<int>() { counter = 0; }
  31.     ~Cstack_c()                 {}
  32.     inline BOOL CPush()         {return Stack_c<int>::Push(counter++);}
  33.     inline BOOL CPop(int &Data) {return Stack_c<int>::Pop(Data);}
  34.     inline int  CGetCounter()   {return counter;}
  35.     inline BOOL IsEmpty()       {return Stack_c<int>::IsEmpty();}
  36.  
  37. private:
  38.     int counter;
  39. };
  40.  
  41. #endif
  42.