summaryrefslogtreecommitdiff
path: root/trunk/TAO/orbsvcs/IFR_Service/ifr_adding_visitor.h
blob: 73c7257ced6aed52528507e04b2a6b0bb69e77e2 (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
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
// $Id$

/* -*- C++ -*- */
// ============================================================================
//
// = LIBRARY
//    TAO_IFR_BE_DLL
//
// = FILENAME
//    ifr_adding_visitor.h
//
// = DESCRIPTION
//    Header file for class ifr_adding_visitor.
//
// = AUTHOR
//    Jeff Parsons <parsons@cs.wustl.edu>
//
// ============================================================================

#ifndef TAO_IFR_ADDING_VISITOR_H
#define TAO_IFR_ADDING_VISITOR_H

#include "ifr_visitor.h"
#include "tao/IFR_Client/IFR_ComponentsC.h"

#if !defined (ACE_LACKS_PRAGMA_ONCE)
# pragma once
#endif /* ACE_LACKS_PRAGMA_ONCE */

class UTL_ExceptList;

class ifr_adding_visitor : public ifr_visitor
{
  //
  // = TITLE
  //    ifr_adding_visitor.
  //
  // = DESCRIPTION
  //    This visitor adds items found in the IDL file being processed
  //    to the Interface Repository.
  //
public:
  ifr_adding_visitor (AST_Decl *scope,
                      CORBA::Boolean in_reopened = 0);
  // Constructor.

  virtual ~ifr_adding_visitor (void);
  // Destructor.

  virtual int visit_scope (UTL_Scope *node);
  // Visit the scope.

  virtual int visit_predefined_type (AST_PredefinedType *node);
  // Visit the predefined type.

  virtual int visit_module (AST_Module *node);
  // Visit module.

  virtual int visit_interface (AST_Interface *node);
  // Visit interface.

  virtual int visit_interface_fwd (AST_InterfaceFwd *node);
  // Visit interface_fwd.

  virtual int visit_valuebox (AST_ValueBox *node);
  // Visit valuebox.

  virtual int visit_valuetype (AST_ValueType *node);
  // Visit valuetype.

  virtual int visit_valuetype_fwd (AST_ValueTypeFwd *node);
  // Visit valuetype_fwd.

  virtual int visit_component (AST_Component *node);
  // Visit component.

  virtual int visit_component_fwd (AST_ComponentFwd *node);
  // Visit component_fwd

  virtual int visit_eventtype (AST_EventType *node);
  // Visit valuetype.

  virtual int visit_eventtype_fwd (AST_EventTypeFwd *node);
  // Visit valuetype_fwd

  virtual int visit_home (AST_Home *node);
  // Visit component home.

  virtual int visit_factory (AST_Factory *node);
  // Visit a factory construct.

  virtual int visit_structure (AST_Structure *node);
  // Visit a structure.

  virtual int visit_exception (AST_Exception *node);
  // Visit exception

  virtual int visit_enum (AST_Enum *node);
  // Visit an enum.

  virtual int visit_operation (AST_Operation *node);
  // Visit an operation.

  virtual int visit_field (AST_Field *node);
  // Visit a field.

  virtual int visit_attribute (AST_Attribute *node);
  // Visit an attribute.

  virtual int visit_union (AST_Union *node);
  // Visit union.

  virtual int visit_constant (AST_Constant *node);
  // Visit a constant.

  virtual int visit_array (AST_Array *node);
  // Visit an array.

  virtual int visit_sequence (AST_Sequence *node);
  // Visit a sequence.

  virtual int visit_string (AST_String *node);
  // Visit a string.

  virtual int visit_typedef (AST_Typedef *node);
  // Visit a typedef.

  virtual int visit_root (AST_Root *node);
  // Visit the root.

  virtual int visit_native (AST_Native *node);
  // Visit a native.

protected:
  CORBA::PrimitiveKind expr_type_to_pkind (AST_Expression::ExprType et);
  CORBA::PrimitiveKind predefined_type_to_pkind (AST_PredefinedType *node);
  // Conversion functions.

  void load_any (AST_Expression::AST_ExprValue *ev,
                 CORBA::Any &any);
  // Determine the primitive type and insert into the Any.

  void element_type (AST_Type *base_type);
  // Creates or looks up the element type of an array or sequence,
  // and stores the result in ir_current_.

  int create_interface_def (AST_Interface *node);
  // Code encapsulated out of visit_interface().

  int create_value_def (AST_ValueType *node);
  // Code encapsulated out of visit_valuetype().

  int create_component_def (AST_Component *node);
  // Code encapsulated out of visit_component().

  int create_home_def (AST_Home *node);
  // Code encapsulated out of visit_home().

  int create_event_def (AST_EventType *node);
  // Code encapsulated out of visit_eventtype().

  int create_value_member (AST_Field *node);
  // Conditional call from visit_field().

  void get_referenced_type (AST_Type *node);
  // Utility method to update ir_current_ for struct members, union
  // members, operation parameters and operation return types.

  void fill_base_value (CORBA::ValueDef_ptr &result,
                        AST_ValueType *node);

  void fill_base_component (CORBA::ComponentIR::ComponentDef_ptr &result,
                            AST_Component *node);

  void fill_base_home (CORBA::ComponentIR::HomeDef_ptr &result,
                       AST_Home *node);

  void fill_managed_component (CORBA::ComponentIR::ComponentDef_ptr &result,
                               AST_Home *node);

  void fill_primary_key (CORBA::ValueDef_ptr &result,
                         AST_Home *node);

  void fill_abstract_base_values (CORBA::ValueDefSeq &result,
                                  AST_ValueType *node);

  void fill_inherited_interfaces (CORBA::InterfaceDefSeq &result,
                                  AST_Interface *node);

  void fill_supported_interfaces (CORBA::InterfaceDefSeq &result,
                                  AST_Interface *node);

  void fill_interfaces (CORBA::InterfaceDefSeq &result,
                        AST_Interface **list,
                        CORBA::Long length);

  void fill_initializers (CORBA::ExtInitializerSeq &result,
                          AST_ValueType *node);

  void fill_get_exceptions (CORBA::ExceptionDefSeq &result,
                            AST_Attribute *node);

  void fill_set_exceptions (CORBA::ExceptionDefSeq &result,
                            AST_Attribute *node);

  void fill_exceptions (CORBA::ExceptionDefSeq &result,
                        AST_Decl *node);

  void fill_exceptions (CORBA::ExceptionDefSeq &result,
                        UTL_ExceptList *list);

  void fill_params (CORBA::ParDescriptionSeq &result,
                    AST_Operation *node);

  void visit_all_provides (AST_Component *node,
                           CORBA::ComponentIR::ComponentDef_ptr c);

  void visit_all_uses (AST_Component *node,
                       CORBA::ComponentIR::ComponentDef_ptr c);

  void visit_all_emits (AST_Component *node,
                        CORBA::ComponentIR::ComponentDef_ptr c);

  void visit_all_publishes (AST_Component *node,
                            CORBA::ComponentIR::ComponentDef_ptr c);

  void visit_all_consumes (AST_Component *node,
                           CORBA::ComponentIR::ComponentDef_ptr c);

  void visit_all_factories (AST_Home *node,
                            CORBA::ComponentIR::HomeDef_ptr h);

  void visit_all_finders (AST_Home *node,
                          CORBA::ComponentIR::HomeDef_ptr h);

  void expand_id (ACE_CString &str,
                  const char *local_name);

protected:
  CORBA::IDLType_var ir_current_;
  // Holder for the IR object most recently created or looked up by
  // the visitor. This makes it accessible by visitor methods that
  // need the result of a call to another visitor method that
  // creates an IR object.

  AST_Decl *scope_;
  // Store the node whose scope (if any) we will be visiting.

  CORBA::Boolean in_reopened_;
  // Are we traversing the scope of a reopened module?
};

#endif /* TAO_IFR_ADDING_VISITOR_H */