aboutsummaryrefslogtreecommitdiff
path: root/PDContainer/include/HStack.h
blob: 8050af9823541c34e00cf05ba8a62d9aa872aab4 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
// *********************(c)*2004*********************>
// -holzilib--holzilib--holzilib--holzilib--holzilib->
// ++++PD-External++by+Georg+Holzmann++grh@gmx.at++++>
//
// PDContainer: 
// this is a port of the containers from the C++ STL
// (Standard Template Library)
// for usage see the documentation and PD help files
// for license see readme.txt
//
// HStack.h

#ifndef _h_stack_h__
#define _h_stack_h__


#include "include/QueueStack.h"
#include <stack>

using std::stack;


//---------------------------------------------------
/* this is the class of the stack
 */
class HStack : 
public QueueStack< stack<Element>, int >
{

 private:

  /* Copy Construction is not allowed
   */
  HStack(const HStack &src)
    { }

  /* assignement operator is not allowed
   */
  const HStack& operator = (const HStack&)
    { return *this; }

 public:

  /* Standard Constructor
   * no namespace
   */
  HStack()
    { dataname_ = "h_stack"; }

  /* Constructor
   * with a namespace
   */
  HStack(string h_namespace)
    {
      dataname_ = "h_stack";
      setNamespace(h_namespace);  
    }

  /* Destructor
   */
  virtual ~HStack() { }

  /* inserts an element in the container
   */
  virtual void push(Element value)
    {  data_[h_namespace_].push(value);  }

  /* returns the element from the top of
   * the stack
   */
  virtual Element &top() const 
    {  return data_[h_namespace_].top(); }
};



#endif //_h_stack_h__