summaryrefslogtreecommitdiff
path: root/trunk/TAO/TAO_IDL/be_include/be_visitor_ami_pre_proc.h
blob: bcf8907e25e0908658745de67fafad0f04366cf6 (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
//
// $Id$
//

/* -*- c++ -*- */
// ============================================================================
//
// = LIBRARY
//    TAO IDL
//
// = FILENAME
//    be_visitor_ami_pre_proc.h
//
// = DESCRIPTION
//    This visitor creates for AMI implied IDL constructs
//    the appropriate AST (Abstract Syntax Tree) node,
//    sets the corresponding interface or operation strategy
//    on it and enteres the nodes into the AST.
//
// = AUTHOR
//    Michael Kircher <Michael.Kircher@mchp.siemens.de>
//
// ============================================================================

#ifndef TAO_BE_VISITOR_AMI_PRE_PROC_H
#define TAO_BE_VISITOR_AMI_PRE_PROC_H

#include "be_visitor_scope.h"
#include "ace/SString.h"

class AST_Interface;

class be_visitor_ami_pre_proc : public be_visitor_scope
{
  //
  // = TITLE
  //   AMI pre processor
  //
  // = DESCRIPTION
  //   Adds AMI implied IDL code to the AST
  //
private:
 typedef enum 
 {
   NORMAL,
   GET_OPERATION,
   SET_OPERATION
 } Operation_Kind;

public:
  be_visitor_ami_pre_proc (be_visitor_context *ctx);

  virtual ~be_visitor_ami_pre_proc (void);

  virtual int visit_root (be_root *node);
  // visit a root

  virtual int visit_module (be_module *node);
  // visit module

  virtual int visit_interface (be_interface *node);
  // visit interface

  virtual int visit_operation (be_operation *node);
  // visit an operation

  virtual int visit_attribute (be_attribute *node);
  // visit an attribute

private:
  int create_raise_operation (be_decl *node,
                              be_valuetype *excep_holder,
                              Operation_Kind operation_kind);
  // Creates a raise operation from node and inserts it in
  // excep_holder, while obeying if it is a normal operation
  // or a set or get attribute.

  be_interface *create_reply_handler (be_interface *node,
                                      be_valuetype *excep_holder);
  // create the reply handler interface

  be_valuetype *create_exception_holder (be_interface *node);
  // create the exception holder valuetype

  be_operation *create_sendc_operation (be_operation *node,
                                        int for_arguments);
  // create a method with "sendc_" prepended, if for_arguments
  // equals one the sendc operation contains also the
  // object reference to the reply handler as the first argument,
  // but this should not be marhaled, therefor we need the switch

  int create_excep_operation (be_operation *node,
                              be_interface *reply_handler,
                              be_valuetype *excep_holder);
  // create a method with "_excep" appended

  int create_reply_handler_operation (be_operation *node,
                                      be_interface *reply_handler);
  // create an operation with only the OUT and INOUT arguments

  int visit_scope (be_scope *node);
  // specialized visit_scope

  int generate_name (ACE_CString &desintation,
                     const char *prefix,
                     const char *middle_name,
                     const char *suffix);
  // concatenate the prefix, middle_name and suffix
  // and store the result in desination.

  be_operation *generate_get_operation (be_attribute *node);
  // generate a get operation out of the attribute.

  be_operation *generate_set_operation (be_attribute *node);
  // generate a set operation out of the attribute.

  AST_Interface **create_inheritance_list (be_interface *node,
                                           long &n_parents);
  // Create an inheritance list for the reply handler.
};


#endif // TAO_BE_VISITOR_AMI_PRE_PROC_H