OpenIndiana and Solaris port
[oweals/cde.git] / cde / programs / dtinfo / dtinfo / src / Basic / AgentStack.hh
1 /*
2  * $XConsortium: AgentStack.hh /main/3 1996/06/11 16:17:26 cde-hal $
3  *
4  * Copyright (c) 1991 HaL Computer Systems, Inc.  All rights reserved.
5  * UNPUBLISHED -- rights reserved under the Copyright Laws of the United
6  * States.  Use of a copyright notice is precautionary only and does not
7  * imply publication or disclosure.
8  * 
9  * This software contains confidential information and trade secrets of HaL
10  * Computer Systems, Inc.  Use, disclosure, or reproduction is prohibited
11  * without the prior express written permission of HaL Computer Systems, Inc.
12  * 
13  *                         RESTRICTED RIGHTS LEGEND
14  * Use, duplication, or disclosure by the Government is subject to
15  * restrictions as set forth in subparagraph (c)(l)(ii) of the Rights in
16  * Technical Data and Computer Software clause at DFARS 252.227-7013.
17  *                        HaL Computer Systems, Inc.
18  *                  1315 Dell Avenue, Campbell, CA  95008
19  *"
20  */
21
22 class Agent;
23
24 #ifndef _AgentStack_hh
25 #define _AgentStack_hh
26
27 class AgentStackEntry
28 {
29 public: // functions
30   AgentStackEntry (Agent *a, AgentStackEntry *n)
31     : f_agent (a), f_next(n) { };
32   Agent *agent()
33     { return f_agent; }
34   AgentStackEntry *next ()
35     { return f_next; }
36   
37 protected: // variables
38   Agent           *f_agent;
39   AgentStackEntry *f_next;
40 };
41
42 class AgentStack
43 {
44 public: // functions
45   AgentStack ()
46     : top(NULL) {};
47   //  NOTE: Need a "real" destructor
48   //  ~AgentStack ();
49   void push (Agent *agent)
50     { top = new AgentStackEntry (agent, top); }                          
51   Agent *pop ()
52     { Agent *agent = top->agent ();
53       AgentStackEntry *entry = top;
54       top = entry->next();
55       delete entry;
56       return (agent);
57     }
58
59 protected: // variables
60   AgentStackEntry *top;
61 };
62
63 #endif /* _AgentStack_hh */
64 /* DO NOT ADD ANY LINES AFTER THIS #endif */