3 //=============================================================================
5 * @file ast_visitor_tmpl_module_inst.h
7 * This visitor creates nodes resulting
8 * from the instantiation of a template module, or from a
9 * reference to one inside another, and adds these nodes
12 * @author Jeff Parsons
14 //=============================================================================
17 #ifndef TAO_AST_VISITOR_TMPL_MODULE_INST_H
18 #define TAO_AST_VISITOR_TMPL_MODULE_INST_H
20 #include "ast_visitor.h"
25 class ast_visitor_context
;
28 * @class ast_visitor_tmpl_module_inst
30 * @brief ast_visitor_tmpl_module_inst
32 * Adds implied IDL code to the AST related to the
33 * instantiation or alias of a template module.
35 class ast_visitor_tmpl_module_inst
: public ast_visitor
38 ast_visitor_tmpl_module_inst (ast_visitor_context
*ctx
,
39 bool ref_only
= false);
41 virtual ~ast_visitor_tmpl_module_inst ();
43 virtual int visit_decl (AST_Decl
*d
);
44 virtual int visit_scope (UTL_Scope
*node
);
45 virtual int visit_type (AST_Type
*node
);
46 virtual int visit_predefined_type (AST_PredefinedType
*node
);
47 virtual int visit_interface_fwd (AST_InterfaceFwd
*node
);
48 virtual int visit_valuetype_fwd (AST_ValueTypeFwd
*node
);
49 virtual int visit_component (AST_Component
*node
);
50 virtual int visit_home (AST_Home
*node
);
51 virtual int visit_component_fwd (AST_ComponentFwd
*node
);
52 virtual int visit_template_module_ref (AST_Template_Module_Ref
*node
);
53 virtual int visit_porttype (AST_PortType
*node
);
54 virtual int visit_provides (AST_Provides
*node
);
55 virtual int visit_uses (AST_Uses
*node
);
56 virtual int visit_publishes (AST_Publishes
*node
);
57 virtual int visit_emits (AST_Emits
*node
);
58 virtual int visit_consumes (AST_Consumes
*node
);
59 virtual int visit_extended_port (AST_Extended_Port
*node
);
60 virtual int visit_mirror_port (AST_Mirror_Port
*node
);
61 virtual int visit_connector (AST_Connector
*node
);
62 virtual int visit_eventtype_fwd (AST_EventTypeFwd
*node
);
63 virtual int visit_structure_fwd (AST_StructureFwd
*node
);
64 virtual int visit_exception (AST_Exception
*node
);
65 virtual int visit_expression (AST_Expression
*node
);
66 virtual int visit_enum (AST_Enum
*node
);
67 virtual int visit_union (AST_Union
*node
);
68 virtual int visit_union_fwd (AST_UnionFwd
*node
);
69 virtual int visit_union_branch (AST_UnionBranch
*node
);
70 virtual int visit_union_label (AST_UnionLabel
*node
);
71 virtual int visit_enum_val (AST_EnumVal
*node
);
72 virtual int visit_array (AST_Array
*node
);
73 virtual int visit_sequence (AST_Sequence
*node
);
74 virtual int visit_map (AST_Map
*node
);
75 virtual int visit_string (AST_String
*node
);
76 virtual int visit_native (AST_Native
*node
);
77 virtual int visit_valuebox (AST_ValueBox
*node
);
78 virtual int visit_param_holder (AST_Param_Holder
*node
);
79 virtual int visit_root (AST_Root
*node
);
80 virtual int visit_module (AST_Module
*node
);
81 virtual int visit_template_module (AST_Template_Module
*node
);
82 virtual int visit_template_module_inst (AST_Template_Module_Inst
*node
);
83 virtual int visit_eventtype (AST_EventType
*node
);
84 virtual int visit_valuetype (AST_ValueType
*node
);
85 virtual int visit_interface (AST_Interface
*node
);
86 virtual int visit_attribute (AST_Attribute
*node
);
87 virtual int visit_operation (AST_Operation
*node
);
88 virtual int visit_argument (AST_Argument
*node
);
89 virtual int visit_typedef (AST_Typedef
*node
);
90 virtual int visit_constant (AST_Constant
*node
);
91 virtual int visit_structure (AST_Structure
*node
);
92 virtual int visit_field (AST_Field
*node
);
93 virtual int visit_factory (AST_Factory
*node
);
94 virtual int visit_finder (AST_Finder
*node
);
97 // Store for passing on to subsequent create modules.
98 AST_Template_Module_Inst
*tmi_
;
101 // If arg is a param holder, return the matching template arg,
102 // otherwise return arg unchanged. If the arg is declared in
103 // the scope of a template module, the returned node will be a
104 // copy created in the scope of the template module instantiation.
105 AST_Decl
*reify_type (AST_Decl
*d
);
107 // Utility method used for attributes and operations.
108 UTL_ExceptList
*reify_exception_list (UTL_ExceptList
*orig
);
110 // Utility method to create a NameList from a list of inherited
111 // or supported types that may contain a template param ref.
112 UTL_NameList
*create_name_list (AST_Type
**list
, long length
);
115 ast_visitor_context
*ctx_
;
117 // Flag to branch in visit_valuetype() where we create an
118 // eventtype or a valuetype.
121 // Flag to branch in visit_factory() where we create a
122 // finder or a factory.
125 // Flag to short_circuit reifying if we are the base class of
126 // ast_visitor_tmpl_module_ref.
130 #endif // TAO_AST_VISITOR_TMPL_MODULE_INST_H