home *** CD-ROM | disk | FTP | other *** search
/ OS/2 Shareware BBS: 10 Tools / 10-Tools.zip / oclsrc15.zip / OCL / Include / OStack.inl < prev    next >
Text File  |  1996-08-12  |  2KB  |  83 lines

  1. // OCL - OS/2 Class Library
  2. // (c) Cubus 1995
  3. // All Rights Reserved
  4. // OStack.inl
  5.  
  6. /*
  7.  * Redistribution and use in source and binary forms, with or without
  8.  * modification, are permitted provided that the following conditions
  9.  * are met:
  10.  * 1. Redistributions of source code must retain the above copyright
  11.  *    notice, this list of conditions and the following disclaimer.
  12.  * 2. Neither the name Cubus nor the name Team OCL may be used to
  13.  *    endorse or promote products derived from this software
  14.  *    without specific prior written permission.
  15.  * 3. See OCL.INF for a detailed copyright notice.
  16.  *
  17.  *              THIS SOFTWARE IS PROVIDED ``AS IS'' AND
  18.  * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
  19.  * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
  20.  * ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
  21.  * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
  22.  * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
  23.  * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
  24.  * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
  25.  * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
  26.  * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
  27.  * SUCH DAMAGE.
  28.  */
  29.  
  30. // $Header: W:/Projects/OCL/Include/rcs/OStack.inl 1.50 1996/08/11 23:47:31 B.STEIN Release $
  31.  
  32. #ifndef OSTACK_INLINED
  33.   #define OSTACK_INLINED
  34.  
  35. template <class T>
  36. OStack<T>::OStack(BOOL copyElements)
  37.   : OList<T>(copyElements)
  38.   {} 
  39.  
  40.  
  41. template <class T>
  42. OStack<T>::OStack(OStack<T>& stack, BOOL copyElements)
  43.   : OList<T>(stack, copyElements)
  44.   {}
  45.  
  46. template <class T>
  47. OStack<T>::~OStack()
  48.   {}
  49.  
  50. template <class T>
  51. PSZ OStack<T>::isOfType() const
  52. {
  53.  return("OStack<T>");
  54.  
  55. template <class T>
  56. void OStack<T>::push(T& item)
  57. {
  58.  addFirst(&item);
  59. }
  60.  
  61. template <class T>
  62. void OStack<T>::push(T *item)
  63. {
  64.  addFirst(item);
  65. }
  66.  
  67. template <class T>
  68. T* OStack<T>::pop()
  69. {
  70.  T* retVal = (T*) _getFirst();
  71.  
  72.  if (retVal)
  73.    remove(retVal);
  74.  
  75.  return(retVal); 
  76. }
  77.  
  78.  
  79. #endif // OSTACK_INLINED
  80.  
  81. // end of source
  82.