Merge pull request #2301 from sonndinh/remove-dup-reactor-functions
[ACE_TAO.git] / TAO / TAO_IDL / be_include / be_sequence.h
blob4ec3e99e4f77d62d6369e6b3e7524a780b7e3a4e
1 // -*- C++ -*-
4 //=============================================================================
5 /**
6 * @file be_sequence.h
8 * Extension of class AST_Sequence that provides additional means for C++
9 * mapping.
11 * @author Copyright 1994-1995 by Sun Microsystems
12 * @author Inc. and Aniruddha Gokhale
14 //=============================================================================
16 #ifndef BE_SEQUENCE_H
17 #define BE_SEQUENCE_H
19 #include "be_scope.h"
20 #include "be_type.h"
21 #include "ast_sequence.h"
23 class AST_Expression;
24 class AST_Type;
25 class be_visitor;
26 class be_typedef;
27 class be_field;
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
38 public:
39 enum MANAGED_TYPE
41 MNG_UNKNOWN,
42 MNG_NONE,
43 MNG_STRING,
44 MNG_WSTRING,
45 MNG_OBJREF,
46 MNG_VALUE,
47 MNG_PSEUDO
50 be_sequence (AST_Expression *v,
51 AST_Type *bt,
52 UTL_ScopedName *n,
53 bool local,
54 bool abstract);
56 /// Non-virtual override of frontend method.
57 be_type *base_type () const;
59 /**
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,
80 bool use_underscore);
82 /// Cleanup method.
83 virtual void destroy ();
85 // Visiting.
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 ();
104 protected:
105 /// Computes the fully scoped typecode name.
106 virtual void compute_tc_name ();
108 private:
109 const char *smart_fwd_helper_name (AST_Decl *elem_scope,
110 be_type *elem);
112 private:
113 /// Our managed type.
114 MANAGED_TYPE mt_;
116 /// Used if we are an anonymous member, to help generate a unique name.
117 be_field *field_node_;
120 #endif