summaryrefslogtreecommitdiff
path: root/TAO/TAO_IDL/be_include/be_visitor_sequence.h
blob: d4be4a936d3f6173a9d164583981b1e5252c3011 (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
/* -*- c++ -*- */
//
// $Id$
//

#if !defined (TAO_BE_VISITOR_SEQUENCE_H)
#define TAO_BE_VISITOR_SEQUENCE_H

#include "be_visitor.h"

class be_visitor_sequence_ch : public be_visitor
{
  //
  // = TITLE
  //    be_visitor_sequence_ch
  //
  // = DESCRIPTION
  //   This is a concrete visitor to generate the client header for
  //   sequences
  //
public:
  be_visitor_sequence_ch (void);
  // constructor

  ~be_visitor_sequence_ch (void);
  // destructor

  virtual int visit_sequence (be_sequence *node);
  // visit sequence node
};

typedef ACE_Singleton <be_visitor_sequence_ch, ACE_SYNCH_RECURSIVE_MUTEX>
TAO_BE_VISITOR_SEQUENCE_CH;

class be_visitor_sequence_base_ch : public be_visitor
{
  //
  // = TITLE
  //    be_visitor_sequence_base_ch
  //
  // = DESCRIPTION
  //   This is a concrete visitor to generate the template parameters
  //   for a TAO_*_Sequence instantiation.
  //
  // = BUGS
  //   The class name is misleading, eventually this class could be
  //   used to generate code in other files, not only the client
  //   header. 
  //   The visitor factory should provide a factory method that builds
  //   this class on the fly.
  //
public:
  be_visitor_sequence_base_ch (TAO_OutStream *stream,
			       be_decl *sequence_scope,
			       be_type *base_type);
  // Constructor, set the stream to write to, the scope where the
  // sequence is defined and the base type for the sequence.

  ~be_visitor_sequence_base_ch (void);
  // destructor

  // = Visitor methods.
  virtual int visit_predefined_type (be_predefined_type *node);
  virtual int visit_interface (be_interface *node);
  virtual int visit_interface_fwd (be_interface_fwd *node);
  virtual int visit_structure (be_structure *node);
  virtual int visit_enum (be_enum *node);
  virtual int visit_union (be_union *node);
  virtual int visit_array (be_array *node);
  virtual int visit_string (be_string *node);
  virtual int visit_sequence (be_sequence *node);
  virtual int visit_typedef (be_typedef *node);

protected:
  be_decl *seq_scope (void);
  // scope node of the saved sequence node

  int visit_node (be_type *);
  // helper that does the common job

private:
  be_type* current_type_;
  // The scoped name for the current argument type name.
  // We cannot use just node->name() because we could be using an
  // aliased name (through typedefs) in which case the real name must
  // be used.
};

class be_visitor_sequence_elemtype : public be_visitor
{
  //
  // = TITLE
  //    be_visitor_sequence_elemtype
  //
  // = DESCRIPTION
  //   This is a concrete visitor to generate the return type for the
  //   [] operators
  //
  // = NOTES
  //    This class may eventually go away when the _var and _out classes are
  //    generated using templates
public:
  be_visitor_sequence_elemtype (TAO_OutStream *stream,
				be_decl *sequence_scope,
				be_type *base_type);
  // Constructor, set the stream to write to, the scope where the
  // sequence is defined and the base type for the sequence.

  ~be_visitor_sequence_elemtype (void);
  // destructor

  // = Visitors
  virtual int visit_predefined_type (be_predefined_type *node);
  virtual int visit_interface (be_interface *node);
  virtual int visit_interface_fwd (be_interface_fwd *node);
  virtual int visit_structure (be_structure *node);
  virtual int visit_enum (be_enum *node);
  virtual int visit_union (be_union *node);
  virtual int visit_array (be_array *node);
  virtual int visit_sequence (be_sequence *node);
  virtual int visit_typedef (be_typedef *node);
  virtual int visit_string (be_string *node);

protected:
  be_decl *seq_scope (void);
  // scope node of the saved sequence node

  int visit_node (be_type *);
  // helper that does the common job

  be_type* current_type_;
  // The scoped name for the current argument type name.
  // We cannot use just node->name() because we could be using an
  // aliased name (through typedefs) in which case the real name must
  // be used.
};

#endif /* TAO_BE_VISITOR_SEQUENCE_H */