summaryrefslogtreecommitdiff
path: root/TAO/TAO_IDL/be_include/be_decl.h
blob: 742002a7a7e7e9e94d07199ef35a980bf328570b (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
/* -*- c++ -*- */
// $Id$

// ============================================================================
//
// = LIBRARY
//    TAO IDL
//
// = FILENAME
//    be_decl.h
//
// = DESCRIPTION
//    Extension of the AST_Decl class.
//
// = AUTHOR
//    Copyright 1994-1995 by Sun Microsystems, Inc.
//    and
//    Aniruddha Gokhale
//
// ============================================================================

#ifndef TAO_BE_DECL_H
#define TAO_BE_DECL_H

#include "ast_decl.h"

class be_scope;
class be_visitor;

class be_decl : public virtual AST_Decl
{
  // = TITLE
  //    be_decl
  // = DESCRIPTION
  //    The back end extension of the AST_Decl class. Provides an abstract
  //    interface.
  //
public:
  enum SIZE_TYPE
  {
    SIZE_UNKNOWN,
    FIXED,
    VARIABLE
  };
  // Undicates if we are fixed size or variable. Most useful for structs,
  // unions, and arrays.

  be_decl (void);
  // Default constructor.

  be_decl (AST_Decl::NodeType type, 
           UTL_ScopedName *n, 
           UTL_StrList *pragmas);
  // Constructor that sets the node type.

  ~be_decl (void);
  // Destructor.

  virtual void size_type (SIZE_TYPE);
  // Set the size type.

  virtual SIZE_TYPE size_type (void);
  // Return our size type.

  const char *flat_name (void);
  // Return the flattened full scoped name.

  // Methods used by the interface type strategy.
  void compute_full_name  (const char *prefix,
                           const char *suffix,
                           char *&name);
  // Both the arguments should be non-null!!!. Applies prefix and
  // suffix to the local name and makes a flat name.

  void compute_flat_name (const char *prefix,
                          const char *suffix,
                          char *& name);
  // Both the arguments should be non-null!!!. Applies prefix and
  // suffix to the local name and makes a flat name.


  void compute_repoID (const char *prefix,
                       const char *suffix,
                       char *& name);
  // Apply the prefix and suffix to the local name and compute the
  // repoID.  Both the parameters should be non-null.

  // End of Methods use by the interface type strategy.

  virtual idl_bool is_nested (void);
  // Determines if we are inside of a nested scope or not.

  virtual be_scope *scope (void);
  // Return the scope created by this node (if one exists).

  // Visiting
  virtual int accept (be_visitor *visitor);

  idl_bool has_constructor (void);
  // Accessor for protected member.

  void has_constructor (idl_bool value);
  // Mutator for protected member.

  // Boolean methods to test if code was already generated.
  idl_bool cli_hdr_gen (void);
  idl_bool cli_stub_gen (void);
  idl_bool cli_inline_gen (void);
  idl_bool srv_hdr_gen (void);
  idl_bool impl_hdr_gen (void);
  idl_bool srv_skel_gen (void);
  idl_bool impl_skel_gen (void);
  idl_bool srv_inline_gen (void);
  idl_bool cli_hdr_any_op_gen (void);
  idl_bool cli_stub_any_op_gen (void);
  idl_bool cli_hdr_cdr_op_gen (void);
  idl_bool cli_stub_cdr_op_gen (void);
  idl_bool cli_inline_cdr_op_gen (void);
  idl_bool cli_inline_cdr_decl_gen (void);

  // Set the flag indicating that code generation is done.
  void cli_hdr_gen (idl_bool);
  void cli_stub_gen (idl_bool);
  void cli_inline_gen (idl_bool);
  void srv_hdr_gen (idl_bool);
  void impl_hdr_gen (idl_bool);
  void srv_skel_gen (idl_bool);
  void impl_skel_gen (idl_bool);
  void srv_inline_gen (idl_bool);
  void cli_hdr_any_op_gen (idl_bool);
  void cli_stub_any_op_gen (idl_bool);
  void cli_hdr_cdr_op_gen (idl_bool);
  void cli_stub_cdr_op_gen (idl_bool);
  void cli_inline_cdr_op_gen (idl_bool);
  void cli_inline_cdr_decl_gen (idl_bool);

  idl_bool is_child (be_decl *node);
  // Am I a direct child of node?

  // Narrowing
  DEF_NARROW_METHODS1 (be_decl, AST_Decl);
  DEF_NARROW_FROM_DECL (be_decl);

protected:
  virtual int compute_size_type (void);
  // Determine our size type and set it if it is unknown.

  virtual void compute_flat_name (void);
  // Compute the flattened fully scoped name.

  virtual void destroy ();
  // Cleanup function.

  // Variables that indicate if the code generation for that node is already
  // been done. This way we avoid regenerating same code.
  idl_bool cli_hdr_gen_;
  idl_bool cli_stub_gen_;
  idl_bool cli_inline_gen_;
  idl_bool srv_hdr_gen_;
  idl_bool impl_hdr_gen_;
  idl_bool srv_skel_gen_;
  idl_bool impl_skel_gen_;
  idl_bool srv_inline_gen_;
  idl_bool cli_hdr_any_op_gen_;
  idl_bool cli_stub_any_op_gen_;
  idl_bool cli_hdr_cdr_op_gen_;
  idl_bool cli_stub_cdr_op_gen_;
  idl_bool cli_inline_cdr_op_gen_;
  idl_bool cli_inline_cdr_decl_gen_;

  char *flat_name_;
  // Flattened fully scoped name.

  SIZE_TYPE size_type_;
  // Whether we are fixed or variable size (by default fixed).

  idl_bool has_constructor_;
  // Attribute that helps a union determine whether a member
  // should be included by value or by reference.
};

#endif // if !defined