3 //=============================================================================
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)
22 #endif /* ACE_LACKS_PRAGMA_ONCE */
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
37 ifr_adding_visitor (AST_Decl
*scope
,
38 CORBA::Boolean in_reopened
= 0,
39 bool allow_duplicate_typedefs
= false);
41 virtual ~ifr_adding_visitor (void);
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_string (AST_String
*node
);
74 virtual int visit_typedef (AST_Typedef
*node
);
75 virtual int visit_root (AST_Root
*node
);
76 virtual int visit_native (AST_Native
*node
);
79 /// Conversion functions.
80 CORBA::PrimitiveKind
expr_type_to_pkind (AST_Expression::ExprType et
);
81 CORBA::PrimitiveKind
predefined_type_to_pkind (AST_PredefinedType
*node
);
83 /// Determine the primitive type and insert into the Any.
84 void load_any (AST_Expression::AST_ExprValue
*ev
,
87 /// Creates or looks up the element type of an array or sequence,
88 /// and stores the result in ir_current_.
89 void element_type (AST_Type
*base_type
, bool owned
= false);
91 /// Code encapsulated out of visit_interface().
92 int create_interface_def (AST_Interface
*node
);
94 /// Code encapsulated out of visit_valuetype().
95 int create_value_def (AST_ValueType
*node
);
97 /// Code encapsulated out of visit_component().
98 int create_component_def (AST_Component
*node
);
100 /// Code encapsulated out of visit_home().
101 int create_home_def (AST_Home
*node
);
103 /// Code encapsulated out of visit_eventtype().
104 int create_event_def (AST_EventType
*node
);
106 /// Conditional call from visit_field().
107 int create_value_member (AST_Field
*node
);
109 /// Utility method to update ir_current_ for struct members, union
110 /// members, operation parameters and operation return types.
111 void get_referenced_type (AST_Type
*node
);
113 void fill_base_value (CORBA::ValueDef_ptr
&result
,
114 AST_ValueType
*node
);
116 void fill_base_component (CORBA::ComponentIR::ComponentDef_ptr
&result
,
117 AST_Component
*node
);
119 void fill_base_home (CORBA::ComponentIR::HomeDef_ptr
&result
,
122 void fill_managed_component (CORBA::ComponentIR::ComponentDef_ptr
&result
,
125 void fill_primary_key (CORBA::ValueDef_ptr
&result
,
128 void fill_abstract_base_values (CORBA::ValueDefSeq
&result
,
129 AST_ValueType
*node
);
131 void fill_inherited_interfaces (CORBA::InterfaceDefSeq
&result
,
132 AST_Interface
*node
);
134 void fill_supported_interfaces (CORBA::InterfaceDefSeq
&result
,
135 AST_Interface
*node
);
137 void fill_interfaces (CORBA::InterfaceDefSeq
&result
,
141 void fill_initializers (CORBA::ExtInitializerSeq
&result
,
142 AST_ValueType
*node
);
144 void fill_get_exceptions (CORBA::ExceptionDefSeq
&result
,
145 AST_Attribute
*node
);
147 void fill_set_exceptions (CORBA::ExceptionDefSeq
&result
,
148 AST_Attribute
*node
);
150 void fill_exceptions (CORBA::ExceptionDefSeq
&result
,
153 void fill_exceptions (CORBA::ExceptionDefSeq
&result
,
154 UTL_ExceptList
*list
);
156 void fill_params (CORBA::ParDescriptionSeq
&result
,
159 void visit_all_factories (AST_Home
*node
,
160 CORBA::ComponentIR::HomeDef_ptr h
);
162 void visit_all_finders (AST_Home
*node
,
163 CORBA::ComponentIR::HomeDef_ptr h
);
165 void expand_id (ACE_CString
&str
,
166 const char *local_name
);
170 * Holder for the IR object most recently created or looked up by
171 * the visitor. This makes it accessible by visitor methods that
172 * need the result of a call to another visitor method that
173 * creates an IR object.
175 CORBA::IDLType_var ir_current_
;
177 /// Store the node whose scope (if any) we will be visiting.
180 /// Are we traversing the scope of a reopened module?
183 /// Do we allow duplicate typedefs?
184 bool allow_duplicate_typedefs_
;
187 #endif /* TAO_IFR_ADDING_VISITOR_H */