2 * Abstract Syntax Tree Node for an application of an annotation.
5 #ifndef AST_ANNOTATION_APPL_HEADER
6 #define AST_ANNOTATION_APPL_HEADER
8 #include "ast_annotation_decl.h"
9 #include "utl_identifier.h"
10 #include "ast_expression.h"
12 #include "ace/Containers_T.h"
13 #include "ace/Vector_T.h"
16 * Abstract Syntax Tree Node for an application of an annotation.
18 * Params are implemented as a stack of name, value pairs which are independent
19 * from the finished annotation members. The members which are AST_Fields subclasses
20 * stored the same way as fields in AST_Struct.
22 class TAO_IDL_FE_Export AST_Annotation_Appl
: public virtual AST_Annotation_Decl
26 * Store Optional Annotation Parameters
35 typedef ACE_Unbounded_Stack_Iterator
<Param
*> Iterator
;
37 typedef ACE_Unbounded_Stack
<Param
*> Params
;
40 /// Delete Annotation Parameters
41 static void delete_params (Params
* params
);
44 * Create an Annotation using it's name and parameters
46 AST_Annotation_Appl (UTL_ScopedName
*name
, Params
*params
);
48 virtual ~AST_Annotation_Appl ();
51 virtual void dump (ACE_OSTREAM_TYPE
&o
);
54 virtual int ast_accept (ast_visitor
*visitor
);
57 virtual void destroy ();
59 static AST_Decl::NodeType
const NT
;
62 * Get name of the annotation as written by the user
64 const char* original_name () const;
67 * Apply a Annotation Declaration to this Application. This will either fully
68 * instantiate this object or result in an error, in which case it returns false.
70 bool apply_from (AST_Annotation_Decl
*decl
);
73 * Return pointer to the stack of parameters passed. BACKENDS SHOULDN'T USE
74 * THIS UNLESS YOU NEED EXACTLY WHAT THE USER PASSED. Backends should use the
75 * lookup and scope iterator APIs that this class inherits from AST_Scope
76 * and AST_Struct. Can be null.
81 * AST_Annotation_Decl kept in case desired by someone
83 * Will be null if accessed before apply_from() is called or if being used
84 * without a declaration.
86 AST_Annotation_Decl
*annotation_decl ();
89 * Return the parameter with the specified name if it's in the stack else
92 Param
*find_param (const char *name
);
95 /// Name of the Annotation as written
96 const char *original_name_
;
98 /// Parameters List (Can be null)
101 /// The AST_Annotation_Decl (Possibly could be null)
102 AST_Annotation_Decl
*annotation_decl_
;
105 struct Decl_Annotations_Pair
{
107 AST_Annotation_Appls
*annotations
;
110 struct Decl_Annotations_Pair_Pair
{
111 Decl_Annotations_Pair
*first
;
112 Decl_Annotations_Pair
*second
;