Merge pull request #2301 from sonndinh/remove-dup-reactor-functions
[ACE_TAO.git] / TAO / orbsvcs / IFR_Service / ifr_adding_visitor.h
blobec06cf59ad2d3a60086f9e9e39158e6dd78e2214
2 /* -*- C++ -*- */
3 //=============================================================================
4 /**
5 * @file ifr_adding_visitor.h
7 * Header file for class ifr_adding_visitor.
9 * @author Jeff Parsons <parsons@cs.wustl.edu>
11 //=============================================================================
14 #ifndef TAO_IFR_ADDING_VISITOR_H
15 #define TAO_IFR_ADDING_VISITOR_H
17 #include "ifr_visitor.h"
18 #include "tao/IFR_Client/IFR_ComponentsC.h"
20 #if !defined (ACE_LACKS_PRAGMA_ONCE)
21 # pragma once
22 #endif /* ACE_LACKS_PRAGMA_ONCE */
24 class UTL_ExceptList;
26 /**
27 * @class ifr_adding_visitor
29 * @brief ifr_adding_visitor.
31 * This visitor adds items found in the IDL file being processed
32 * to the Interface Repository.
34 class ifr_adding_visitor : public ifr_visitor
36 public:
37 ifr_adding_visitor (AST_Decl *scope,
38 CORBA::Boolean in_reopened = 0,
39 bool allow_duplicate_typedefs = false);
41 virtual ~ifr_adding_visitor ();
43 virtual int visit_scope (UTL_Scope *node);
44 virtual int visit_predefined_type (AST_PredefinedType *node);
45 virtual int visit_module (AST_Module *node);
46 virtual int visit_interface (AST_Interface *node);
47 virtual int visit_interface_fwd (AST_InterfaceFwd *node);
48 virtual int visit_valuebox (AST_ValueBox *node);
49 virtual int visit_valuetype (AST_ValueType *node);
50 virtual int visit_valuetype_fwd (AST_ValueTypeFwd *node);
51 virtual int visit_component (AST_Component *node);
52 virtual int visit_component_fwd (AST_ComponentFwd *node);
53 virtual int visit_provides (AST_Provides *node);
54 virtual int visit_uses (AST_Uses *node);
55 virtual int visit_publishes (AST_Publishes *node);
56 virtual int visit_emits (AST_Emits *node);
57 virtual int visit_consumes (AST_Consumes *node);
58 virtual int visit_eventtype (AST_EventType *node);
59 virtual int visit_eventtype_fwd (AST_EventTypeFwd *node);
60 virtual int visit_home (AST_Home *node);
61 virtual int visit_structure (AST_Structure *node);
62 virtual int visit_structure_fwd (AST_StructureFwd *node);
63 virtual int visit_exception (AST_Exception *node);
64 virtual int visit_enum (AST_Enum *node);
65 virtual int visit_operation (AST_Operation *node);
66 virtual int visit_field (AST_Field *node);
67 virtual int visit_attribute (AST_Attribute *node);
68 virtual int visit_union (AST_Union *node);
69 virtual int visit_union_fwd (AST_UnionFwd *node);
70 virtual int visit_constant (AST_Constant *node);
71 virtual int visit_array (AST_Array *node);
72 virtual int visit_sequence (AST_Sequence *node);
73 virtual int visit_map (AST_Map *node);
74 virtual int visit_string (AST_String *node);
75 virtual int visit_typedef (AST_Typedef *node);
76 virtual int visit_root (AST_Root *node);
77 virtual int visit_native (AST_Native *node);
79 protected:
80 /// Conversion functions.
81 CORBA::PrimitiveKind expr_type_to_pkind (AST_Expression::ExprType et);
82 CORBA::PrimitiveKind predefined_type_to_pkind (AST_PredefinedType *node);
84 /// Determine the primitive type and insert into the Any.
85 void load_any (AST_Expression::AST_ExprValue *ev,
86 CORBA::Any &any);
88 /// Creates or looks up the element type of an array or sequence,
89 /// and stores the result in ir_current_.
90 void element_type (AST_Type *base_type, bool owned = false);
92 /// Code encapsulated out of visit_interface().
93 int create_interface_def (AST_Interface *node);
95 /// Code encapsulated out of visit_valuetype().
96 int create_value_def (AST_ValueType *node);
98 /// Code encapsulated out of visit_component().
99 int create_component_def (AST_Component *node);
101 /// Code encapsulated out of visit_home().
102 int create_home_def (AST_Home *node);
104 /// Code encapsulated out of visit_eventtype().
105 int create_event_def (AST_EventType *node);
107 /// Conditional call from visit_field().
108 int create_value_member (AST_Field *node);
110 /// Utility method to update ir_current_ for struct members, union
111 /// members, operation parameters and operation return types.
112 void get_referenced_type (AST_Type *node);
114 void fill_base_value (CORBA::ValueDef_ptr &result,
115 AST_ValueType *node);
117 void fill_base_component (CORBA::ComponentIR::ComponentDef_ptr &result,
118 AST_Component *node);
120 void fill_base_home (CORBA::ComponentIR::HomeDef_ptr &result,
121 AST_Home *node);
123 void fill_managed_component (CORBA::ComponentIR::ComponentDef_ptr &result,
124 AST_Home *node);
126 void fill_primary_key (CORBA::ValueDef_ptr &result,
127 AST_Home *node);
129 void fill_abstract_base_values (CORBA::ValueDefSeq &result,
130 AST_ValueType *node);
132 void fill_inherited_interfaces (CORBA::InterfaceDefSeq &result,
133 AST_Interface *node);
135 void fill_supported_interfaces (CORBA::InterfaceDefSeq &result,
136 AST_Interface *node);
138 void fill_interfaces (CORBA::InterfaceDefSeq &result,
139 AST_Type **list,
140 CORBA::Long length);
142 void fill_initializers (CORBA::ExtInitializerSeq &result,
143 AST_ValueType *node);
145 void fill_get_exceptions (CORBA::ExceptionDefSeq &result,
146 AST_Attribute *node);
148 void fill_set_exceptions (CORBA::ExceptionDefSeq &result,
149 AST_Attribute *node);
151 void fill_exceptions (CORBA::ExceptionDefSeq &result,
152 AST_Decl *node);
154 void fill_exceptions (CORBA::ExceptionDefSeq &result,
155 UTL_ExceptList *list);
157 void fill_params (CORBA::ParDescriptionSeq &result,
158 UTL_Scope *node);
160 void visit_all_factories (AST_Home *node,
161 CORBA::ComponentIR::HomeDef_ptr h);
163 void visit_all_finders (AST_Home *node,
164 CORBA::ComponentIR::HomeDef_ptr h);
166 void expand_id (ACE_CString &str,
167 const char *local_name);
169 protected:
171 * Holder for the IR object most recently created or looked up by
172 * the visitor. This makes it accessible by visitor methods that
173 * need the result of a call to another visitor method that
174 * creates an IR object.
176 CORBA::IDLType_var ir_current_;
178 /// Store the node whose scope (if any) we will be visiting.
179 AST_Decl *scope_;
181 /// Are we traversing the scope of a reopened module?
182 bool in_reopened_;
184 /// Do we allow duplicate typedefs?
185 bool allow_duplicate_typedefs_;
188 #endif /* TAO_IFR_ADDING_VISITOR_H */