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 (void) 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 (void);
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 (void);
78 /// Overridden from class be_type.
79 virtual void gen_ostream_operator (TAO_OutStream
*os
,
83 virtual void destroy (void);
86 virtual int accept (be_visitor
*visitor
);
90 DEF_NARROW_FROM_DECL (be_sequence
);
92 /// Report the instance name for instantiation.
93 const char *instance_name (void);
95 /// Common code for generating the name and parameters of our
96 /// template sequence base class.
97 int gen_base_class_name (TAO_OutStream
*os
,
98 const char * linebreak
,
99 AST_Decl
*elem_scope
);
101 /// Accessors for the member.
102 be_field
*field_node (void) const;
103 void field_node (be_field
*node
);
105 /// Helper to create_name, also used by the traits visitor.
106 virtual char *gen_name (void);
110 /// Computes the fully scoped typecode name.
111 virtual void compute_tc_name (void);
114 const char *smart_fwd_helper_name (AST_Decl
*elem_scope
,
118 /// Our managed type.
121 /// Used if we are an anonymous member, to help generate a unique name.
122 be_field
*field_node_
;