home *** CD-ROM | disk | FTP | other *** search
/ Power GUI Programming with VisualAge C++ / powergui.iso / trialva / ibmcppw / include / iastk.inl < prev    next >
Encoding:
Text File  |  1996-02-22  |  3.2 KB  |  127 lines

  1. /**********************************************************************
  2. *                                                                     *
  3. *  IBM(R) VisualAge(TM) for C++ for Windows(R), Version 3.5           *
  4. *                                                                     *
  5. *  PID: 5622-880                                                      *
  6. *  - Licensed Material - Program-Property of IBM                      *
  7. *  (C) Copyright IBM Corp. 1991, 1995 - All Right Reserved.           *
  8. *                                                                     *
  9. *  US Government Users Restricted Rights - Use, duplication or        *
  10. *  disclosure restricted by GSA ADP Schedule Contract with IBM Corp.  *
  11. *                                                                     *
  12. *  VisualAge, and IBM are trademarks or registered trademarks of      *
  13. *  International Business Machines Corporation.                       *
  14. *  Windows is a registered trademark of Microsoft Corporation.        *
  15. *                                                                     *
  16. **********************************************************************/
  17.  
  18. // ---
  19. // IAStack
  20. // ---
  21.  
  22. template <class Element>
  23. inline
  24. IAStack <Element>::
  25. IAStack (INotifier& notifier)
  26. { SetImpl ((Implementation*)¬ifier);
  27. }
  28.  
  29. template <class Element>
  30. inline
  31. IAStack <Element>::
  32. ~IAStack ()
  33. {
  34. }
  35.  
  36. template <class Element>
  37. inline void
  38. IAStack <Element>::
  39. addAsLast (Element const& element)
  40. { ImplOf (*this).AddAsLast (&element);
  41. }
  42.  
  43. template <class Element>
  44. inline void
  45. IAStack <Element>::
  46. addAsLast (Element const& element, ICursor& cursor)
  47. { ImplOf (*this).AddAsLast (&element, CrsrImplOf (cursor));
  48. }
  49.  
  50. template <class Element>
  51. inline long
  52. IAStack <Element>::
  53. compare (IAStack <Element> const& collection,
  54.          long (*compFunc) (Element const&, Element const&)) const
  55. { return ImplOf (*this).
  56.     Compare (ImplOf (collection), (ICompFunc)compFunc, 0);
  57. }
  58.  
  59. template <class Element>
  60. inline void
  61. IAStack <Element>::
  62. pop ()
  63. { ImplOf (*this).RemoveLast ();
  64. }
  65.  
  66. template <class Element>
  67. inline void
  68. IAStack <Element>::
  69. pop (Element& element)
  70. { element = *(Element const*) ImplOf (*this).Last ();
  71.   ImplOf (*this).RemoveLast ();
  72. }
  73.  
  74. template <class Element>
  75. inline void
  76. IAStack <Element>::
  77. push (Element const& element)
  78. { ImplOf (*this).AddAsLast (&element);
  79. }
  80.  
  81. template <class Element>
  82. inline void
  83. IAStack <Element>::
  84. push (Element const& element, ICursor& cursor)
  85. { ImplOf (*this).AddAsLast (&element, CrsrImplOf (cursor));
  86. }
  87.  
  88. template <class Element>
  89. inline void
  90. IAStack <Element>::
  91. removeLast ()
  92. { ImplOf (*this).RemoveLast ();
  93. }
  94.  
  95. template <class Element>
  96. inline Element const&
  97. IAStack <Element>::
  98. top () const
  99. { return *(Element const*) ImplOf (*this).Last ();
  100. }
  101.  
  102. // protected members
  103.  
  104. template <class Element>
  105. inline
  106. IAStack <Element>::
  107. IAStack ()
  108. {
  109. }
  110.  
  111. template <class Element>
  112. inline
  113. IAStack <Element>::
  114. IAStack (IAStack <Element> const& collection)
  115. : Inherited (collection)
  116. {
  117. }
  118.  
  119. // private members
  120.  
  121. template <class Element>
  122. inline IAStack <Element>::Implementation&
  123. IAStack <Element>::
  124. ImplOf (IAStack <Element> const& collection)
  125. { return *(Implementation*)collection.ivImpl;
  126. }
  127.