4 //=============================================================================
8 * Extension of class AST_Sequence that provides additional means for C++
11 * @author Copyright 1994-1995 by Sun Microsystems
12 * @author Inc. and Aniruddha Gokhale
14 //=============================================================================
21 #include "ast_sequence.h"
29 // A sequence in OMG IDL does not define a scoping construct just as a struct
30 // or union or an interface do. However, in the C++ mapping, a sequence becomes
31 // a class. If the base type of a sequence is another anonymous sequence, then
32 // the base type is defined in the scope of this sequence. Hence we define
33 // be_sequence to possess the additional characteristics of a scope.
34 class be_sequence
: public virtual AST_Sequence
,
35 public virtual be_scope
,
36 public virtual be_type
50 be_sequence (AST_Expression
*v
,
56 /// Non-virtual override of frontend method.
57 be_type
*base_type () const;
60 * Returns the fully dealiased base type if it's a typedef. If it's not a
61 * typedef, the it returns the same value as as base_type().
63 be_type
*primitive_base_type () const;
65 /// Create a name for ourselves. If we are typedefed, then we get the name of
66 /// the typedef node, else we generate a name for ourselves.
67 virtual int create_name (be_typedef
*node
);
69 /// Return the managed type.
70 virtual MANAGED_TYPE
managed_type ();
72 // Scope management functions.
73 virtual AST_Sequence
*fe_add_sequence (AST_Sequence
*);
75 /// Overridden method on the be_scope class.
76 virtual be_decl
*decl ();
78 /// Overridden from class be_type.
79 virtual void gen_ostream_operator (TAO_OutStream
*os
,
83 virtual void destroy ();
86 virtual int accept (be_visitor
*visitor
);
88 /// Report the instance name for instantiation.
89 const char *instance_name ();
91 /// Common code for generating the name and parameters of our
92 /// template sequence base class.
93 int gen_base_class_name (TAO_OutStream
*os
,
94 const char * linebreak
,
95 AST_Decl
*elem_scope
);
97 /// Accessors for the member.
98 be_field
*field_node () const;
99 void field_node (be_field
*node
);
101 /// Helper to create_name, also used by the traits visitor.
102 virtual char *gen_name ();
105 /// Computes the fully scoped typecode name.
106 virtual void compute_tc_name ();
109 const char *smart_fwd_helper_name (AST_Decl
*elem_scope
,
113 /// Our managed type.
116 /// Used if we are an anonymous member, to help generate a unique name.
117 be_field
*field_node_
;