My Project
hashKeyStack.h
Go to the documentation of this file.
1 /* hashKeyStack.h
2  */
3 #ifndef HASH_HASHKEYSTACK_H
4 #define HASH_HASHKEYSTACK_H
5 #include "osl/hashKey.h"
6 #include <vector>
7 namespace osl
8 {
9  namespace hash
10  {
11  class HashKeyStack
12  {
13  typedef std::vector<HashKey> vector_t;
15  public:
16  explicit HashKeyStack(size_t capacity=0);
17  ~HashKeyStack();
18 
19  void push(const HashKey&);
20  void pop() { assert(! data.empty()); data.pop_back(); }
21  void clear() { data.clear(); }
22 
23  const HashKey& top(size_t n=0) const
24  {
25  assert(n < size());
26  vector_t::const_reverse_iterator p=data.rbegin()+n;
27  return *p;
28  }
29  bool empty() const { return data.empty(); }
30  size_t size() const { return data.size(); }
31 
32  void dump() const;
33 
34  friend bool operator==(const HashKeyStack&, const HashKeyStack&);
35  };
36  } // namespace hash
37  using hash::HashKeyStack;
38 } // namespace osl
39 
40 #endif /* HASH_HASHKEYSTACK_H */
41 // ;;; Local Variables:
42 // ;;; mode:c++
43 // ;;; c-basic-offset:2
44 // ;;; End:
osl::hash::HashKeyStack::dump
void dump() const
Definition: hashKeyStack.cc:24
osl::hash::HashKeyStack::clear
void clear()
Definition: hashKeyStack.h:21
osl::hash::HashKeyStack::~HashKeyStack
~HashKeyStack()
Definition: hashKeyStack.cc:13
osl::hash::HashKey
Definition: hashKey.h:153
osl::hash::HashKeyStack
Definition: hashKeyStack.h:12
osl::hash::HashKeyStack::top
const HashKey & top(size_t n=0) const
Definition: hashKeyStack.h:23
osl::hash::HashKeyStack::pop
void pop()
Definition: hashKeyStack.h:20
hashKey.h
osl::hash::HashKeyStack::operator==
friend bool operator==(const HashKeyStack &, const HashKeyStack &)
Definition: hashKeyStack.cc:36
osl::hash::HashKeyStack::size
size_t size() const
Definition: hashKeyStack.h:30
osl::hash::HashKeyStack::HashKeyStack
HashKeyStack(size_t capacity=0)
Definition: hashKeyStack.cc:7
osl::hash::HashKeyStack::vector_t
std::vector< HashKey > vector_t
Definition: hashKeyStack.h:13
osl::hash::HashKeyStack::push
void push(const HashKey &)
Definition: hashKeyStack.cc:18
osl::hash::HashKeyStack::empty
bool empty() const
Definition: hashKeyStack.h:29
osl::hash::HashKeyStack::data
vector_t data
Definition: hashKeyStack.h:14
osl
Definition: additionalEffect.h:6