00001 00041 #ifndef _STACK_H 00042 #define _STACK_H 00043 00044 #include "container.h" 00045 00046 using std::string; 00047 00048 namespace container { 00049 00055 class Stack: public Container { 00056 public: 00057 00058 const static Info * const TYPE_INFO; 00059 00060 protected: 00061 00062 Stack(); 00063 Stack(const Stack& orig); 00064 00065 public: 00066 00067 virtual ~Stack(); 00068 00069 /********************* Stack Methods (public) *********************/ 00070 00081 void push(Entity* entity); 00082 00100 Entity * pop(); 00101 00102 protected: 00103 00104 /********************* Stack Methods (protected) *********************/ 00105 00111 virtual void push_impl(Entity* entity) = 0; 00112 00118 virtual Entity * pop_impl() = 0; 00119 00120 public: 00121 00122 /********************* Container Methods (public) *********************/ 00123 00124 int purgeContents(); 00125 00126 private: 00127 00128 /********************* Container Methods (private - reduced visibility) *********************/ 00129 00133 inline void setCount(int c) { 00134 Container::setCount(c); 00135 } 00136 00140 inline void incCount() { 00141 Container::incCount(); 00142 } 00143 00147 inline void decCount() { 00148 Container::decCount(); 00149 } 00150 00151 public: 00152 00153 /********************* Object Methods (public) *********************/ 00154 00155 virtual ostream& renderState(ostream& os) const; 00156 00157 virtual const Info* typeInfo() const; 00158 00159 virtual Object* clone(bool deepCopy = false) const = 0; 00160 00161 }; 00162 00163 } // namespace container 00164 00165 #endif /* _STACK_H */