Merge pull request #1844 from jrw972/monterey
[ACE_TAO.git] / TAO / TAO_IDL / ast / ast_argument.cpp
blob5867a6c0763aa6726dd6274a85378db3e9711b0b
1 /*
3 COPYRIGHT
5 Copyright 1992, 1993, 1994 Sun Microsystems, Inc. Printed in the United
6 States of America. All Rights Reserved.
8 This product is protected by copyright and distributed under the following
9 license restricting its use.
11 The Interface Definition Language Compiler Front End (CFE) is made
12 available for your use provided that you include this license and copyright
13 notice on all media and documentation and the software program in which
14 this product is incorporated in whole or part. You may copy and extend
15 functionality (but may not remove functionality) of the Interface
16 Definition Language CFE without charge, but you are not authorized to
17 license or distribute it to anyone else except as part of a product or
18 program developed by you or with the express written consent of Sun
19 Microsystems, Inc. ("Sun").
21 The names of Sun Microsystems, Inc. and any of its subsidiaries or
22 affiliates may not be used in advertising or publicity pertaining to
23 distribution of Interface Definition Language CFE as permitted herein.
25 This license is effective until terminated by Sun for failure to comply
26 with this license. Upon termination, you shall destroy or return all code
27 and documentation for the Interface Definition Language CFE.
29 INTERFACE DEFINITION LANGUAGE CFE IS PROVIDED AS IS WITH NO WARRANTIES OF
30 ANY KIND INCLUDING THE WARRANTIES OF DESIGN, MERCHANTIBILITY AND FITNESS
31 FOR A PARTICULAR PURPOSE, NONINFRINGEMENT, OR ARISING FROM A COURSE OF
32 DEALING, USAGE OR TRADE PRACTICE.
34 INTERFACE DEFINITION LANGUAGE CFE IS PROVIDED WITH NO SUPPORT AND WITHOUT
35 ANY OBLIGATION ON THE PART OF Sun OR ANY OF ITS SUBSIDIARIES OR AFFILIATES
36 TO ASSIST IN ITS USE, CORRECTION, MODIFICATION OR ENHANCEMENT.
38 SUN OR ANY OF ITS SUBSIDIARIES OR AFFILIATES SHALL HAVE NO LIABILITY WITH
39 RESPECT TO THE INFRINGEMENT OF COPYRIGHTS, TRADE SECRETS OR ANY PATENTS BY
40 INTERFACE DEFINITION LANGUAGE CFE OR ANY PART THEREOF.
42 IN NO EVENT WILL SUN OR ANY OF ITS SUBSIDIARIES OR AFFILIATES BE LIABLE FOR
43 ANY LOST REVENUE OR PROFITS OR OTHER SPECIAL, INDIRECT AND CONSEQUENTIAL
44 DAMAGES, EVEN IF SUN HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES.
46 Use, duplication, or disclosure by the government is subject to
47 restrictions as set forth in subparagraph (c)(1)(ii) of the Rights in
48 Technical Data and Computer Software clause at DFARS 252.227-7013 and FAR
49 52.227-19.
51 Sun, Sun Microsystems and the Sun logo are trademarks or registered
52 trademarks of Sun Microsystems, Inc.
54 SunSoft, Inc.
55 2550 Garcia Avenue
56 Mountain View, California 94043
58 NOTE:
60 SunOS, SunSoft, Sun, Solaris, Sun Microsystems or the Sun logo are
61 trademarks or registered trademarks of Sun Microsystems, Inc.
65 // AST_Argument nodes denote arguments to an operation. They
66 // are AST_Fields with directions. Thus, they have a name
67 // (an UTL_ScopedName) and a type (a subclass of AST_Type).
68 // Additionally they have a direction field which takes values
69 // from the enum AST_Argument::Direction.
71 #include "ast_argument.h"
72 #include "ast_visitor.h"
74 // Static functions.
76 // Convert an enum Direction value to a char *.
77 static const char *
78 direction_to_string (AST_Argument::Direction d)
80 switch (d)
82 case AST_Argument::dir_IN:
83 return "in";
84 case AST_Argument::dir_OUT:
85 return "out";
86 case AST_Argument::dir_INOUT:
87 return "inout";
90 return 0;
93 AST_Decl::NodeType const
94 AST_Argument::NT = AST_Decl::NT_argument;
96 AST_Argument::AST_Argument (Direction d,
97 AST_Type *ft,
98 UTL_ScopedName *n)
99 : COMMON_Base (),
100 AST_Decl (AST_Decl::NT_argument, n),
101 AST_Field (AST_Decl::NT_argument, ft, n),
102 pd_direction (d)
106 AST_Argument::~AST_Argument (void)
110 // Dump this AST_Argument node to the ostream o.
111 void
112 AST_Argument::dump (ACE_OSTREAM_TYPE &o)
114 this->dump_i (o, direction_to_string (pd_direction));
115 this->dump_i (o, " ");
116 AST_Field::dump (o);
120 AST_Argument::ast_accept (ast_visitor *visitor)
122 return visitor->visit_argument (this);
125 void
126 AST_Argument::destroy (void)
128 this->AST_Field::destroy ();
131 AST_Argument::Direction
132 AST_Argument::direction (void)
134 return this->pd_direction;
137 IMPL_NARROW_FROM_DECL(AST_Argument)