#ifndef __SYNCHRONIZEDSTACK_HPP #define __SYNCHRONIZEDSTACK_HPP #include "boundedstack.hpp" template class SynchronizedBoundedStack : public BoundedStack { public: SynchronizedBoundedStack() {} SynchronizedBoundedStack(const Stack &s); SynchronizedBoundedStack& operator=(const Stack &s); void push(const Item &i); Item pop(); Item top() const; int isEmpty() const; unsigned length() const; void clear(); protected: void copy(const Stack &s); void copyTo(Stack &s) const; protected: Monitor monitor; class ReadLock { SynchronizedBoundedStack *s; public: ReadLock(const SynchronizedBoundedStack *stack); ~ReadLock(); }; friend class ReadLock; class WriteLock { SynchronizedBoundedStack *s; public: WriteLock(SynchronizedBoundedStack *stack); ~WriteLock(); }; friend class WriteLock; Cursor_rep *makeCursorRep() const; int cursor_isDone(const BCursor_rep *c) const; const Item& cursor_currentItem(const BCursor_rep *c) const; void cursor_advance(BCursor_rep *c) const; void cursor_unlink(BCursor_rep *c) const; }; #include "synchronizedboundedstack.cpp" #endif