hashKeyStack.h
Go to the documentation of this file.
00001 /* hashKeyStack.h
00002  */
00003 #ifndef HASH_HASHKEYSTACK_H
00004 #define HASH_HASHKEYSTACK_H
00005 #include "osl/hash/hashKey.h"
00006 #include "osl/stl/vector.h"
00007 namespace osl
00008 {
00009   namespace hash
00010   {
00011     class HashKeyStack 
00012     {
00013       typedef vector<HashKey> vector_t;
00014       vector_t data;
00015     public:
00016       explicit HashKeyStack(size_t capacity=0);
00017       ~HashKeyStack();
00018 
00019       void push(const HashKey&);
00020       void pop() { assert(! data.empty()); data.pop_back(); }
00021       void clear() { data.clear(); }
00022 
00023       const HashKey& top(size_t n=0) const
00024       {
00025         assert(n < size());
00026         vector_t::const_reverse_iterator p=data.rbegin()+n;
00027         return *p;
00028       }
00029       bool empty() const { return data.empty(); }
00030       size_t size() const { return data.size(); }
00031 
00032       void dump() const;
00033 
00034       friend bool operator==(const HashKeyStack&, const HashKeyStack&);
00035     };
00036   } // namespace hash
00037   using hash::HashKeyStack;
00038 } // namespace osl
00039 
00040 #endif /* HASH_HASHKEYSTACK_H */
00041 // ;;; Local Variables:
00042 // ;;; mode:c++
00043 // ;;; c-basic-offset:2
00044 // ;;; End:
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Defines