Merge pull request #1844 from jrw972/monterey
[ACE_TAO.git] / TAO / TAO_IDL / include / utl_stack.h
blobd83159b6db7ae363c4da32a82ee7647be8e63ba8
1 /*
3 COPYRIGHT
5 Copyright 1992, 1993, 1994 Sun Microsystems, Inc. Printed in the United
6 States of America. All Rights Reserved.
8 This product is protected by copyright and distributed under the following
9 license restricting its use.
11 The Interface Definition Language Compiler Front End (CFE) is made
12 available for your use provided that you include this license and copyright
13 notice on all media and documentation and the software program in which
14 this product is incorporated in whole or part. You may copy and extend
15 functionality (but may not remove functionality) of the Interface
16 Definition Language CFE without charge, but you are not authorized to
17 license or distribute it to anyone else except as part of a product or
18 program developed by you or with the express written consent of Sun
19 Microsystems, Inc. ("Sun").
21 The names of Sun Microsystems, Inc. and any of its subsidiaries or
22 affiliates may not be used in advertising or publicity pertaining to
23 distribution of Interface Definition Language CFE as permitted herein.
25 This license is effective until terminated by Sun for failure to comply
26 with this license. Upon termination, you shall destroy or return all code
27 and documentation for the Interface Definition Language CFE.
29 INTERFACE DEFINITION LANGUAGE CFE IS PROVIDED AS IS WITH NO WARRANTIES OF
30 ANY KIND INCLUDING THE WARRANTIES OF DESIGN, MERCHANTIBILITY AND FITNESS
31 FOR A PARTICULAR PURPOSE, NONINFRINGEMENT, OR ARISING FROM A COURSE OF
32 DEALING, USAGE OR TRADE PRACTICE.
34 INTERFACE DEFINITION LANGUAGE CFE IS PROVIDED WITH NO SUPPORT AND WITHOUT
35 ANY OBLIGATION ON THE PART OF Sun OR ANY OF ITS SUBSIDIARIES OR AFFILIATES
36 TO ASSIST IN ITS USE, CORRECTION, MODIFICATION OR ENHANCEMENT.
38 SUN OR ANY OF ITS SUBSIDIARIES OR AFFILIATES SHALL HAVE NO LIABILITY WITH
39 RESPECT TO THE INFRINGEMENT OF COPYRIGHTS, TRADE SECRETS OR ANY PATENTS BY
40 INTERFACE DEFINITION LANGUAGE CFE OR ANY PART THEREOF.
42 IN NO EVENT WILL SUN OR ANY OF ITS SUBSIDIARIES OR AFFILIATES BE LIABLE FOR
43 ANY LOST REVENUE OR PROFITS OR OTHER SPECIAL, INDIRECT AND CONSEQUENTIAL
44 DAMAGES, EVEN IF SUN HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES.
46 Use, duplication, or disclosure by the government is subject to
47 restrictions as set forth in subparagraph (c)(1)(ii) of the Rights in
48 Technical Data and Computer Software clause at DFARS 252.227-7013 and FAR
49 52.227-19.
51 Sun, Sun Microsystems and the Sun logo are trademarks or registered
52 trademarks of Sun Microsystems, Inc.
54 SunSoft, Inc.
55 2550 Garcia Avenue
56 Mountain View, California 94043
58 NOTE:
60 SunOS, SunSoft, Sun, Solaris, Sun Microsystems or the Sun logo are
61 trademarks or registered trademarks of Sun Microsystems, Inc.
65 #ifndef _UTL_STACK_UTL_STACK_HH
66 #define _UTL_STACK_UTL_STACK_HH
68 #include "TAO_IDL_FE_Export.h"
70 class UTL_Scope;
71 class UTL_IdList;
72 class AST_Decl;
74 // UTL_ScopeStack implements scope nesting.
76 // Forward declaration of active iterator for UTL_ScopeStack.
77 class UTL_ScopeStackActiveIterator;
79 class TAO_IDL_FE_Export UTL_ScopeStack
81 public:
82 UTL_ScopeStack (void);
83 ~UTL_ScopeStack (void);
85 /// The initial capacity and how much to increment the capacity when needed.
86 static const size_t increments;
88 // Return top element.
89 UTL_Scope *top (void);
91 // Pop top element.
92 void pop (void);
94 // Clear entire stack.
95 void clear (void);
97 // Push an element on the stack and return stack.
98 UTL_ScopeStack *push (UTL_Scope *el);
100 // How deep is the stack now?
101 unsigned long depth (void);
103 // Return bottom element.
104 UTL_Scope *bottom (void);
106 // Return (top - 1) element.
107 UTL_Scope *next_to_top (void);
109 // return topmost non-NULL element.
110 UTL_Scope *top_non_null (void);
113 * Call lookup_by_name on all the scopes from the top down.
115 AST_Decl *lookup_by_name (UTL_IdList *name,
116 bool full_def_only = false, bool for_add = true);
118 private:
119 // Store scopes stack
120 UTL_Scope **pd_stack_data;
122 // How many allocated?
123 unsigned long pd_stack_data_nalloced;
125 // How many used?
126 unsigned long pd_stack_top;
128 // Friend active iterator class for UTL_ScopeStack.
129 friend class UTL_ScopeStackActiveIterator;
132 // Active iterator for UTL_ScopeStack.
133 class TAO_IDL_FE_Export UTL_ScopeStackActiveIterator
135 public:
136 UTL_ScopeStackActiveIterator (UTL_ScopeStack &s);
138 // Advance to next element.
139 void next (void);
141 // Get current item.
142 UTL_Scope* item (void);
144 // Is the iteration finished?
145 bool is_done (void) const;
147 private:
148 // On what to iterate?
149 UTL_ScopeStack &source;
151 // Where are we in iteration?
152 long il;
155 #endif // _UTL_STACK_UTL_STACK_HH