Use =default for skeleton copy constructor
[ACE_TAO.git] / TAO / TAO_IDL / include / ast_annotation_appl.h
blobce160a1c7d8db899e0b21cd81c62305d4e45f1dc
1 /**
2 * Abstract Syntax Tree Node for an application of an annotation.
3 */
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"
15 /**
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
24 public:
25 /**
26 * Store Optional Annotation Parameters
28 ///{
29 struct Param {
30 Param ();
31 ~Param ();
32 Identifier *id;
33 AST_Expression *expr;
34 bool used;
35 typedef ACE_Unbounded_Stack_Iterator<Param*> Iterator;
37 typedef ACE_Unbounded_Stack<Param*> Params;
38 ///}
40 /// Delete Annotation Parameters
41 static void delete_params (Params* params);
43 /**
44 * Create an Annotation using it's name and parameters
46 AST_Annotation_Appl (UTL_ScopedName *name, Params *params);
48 virtual ~AST_Annotation_Appl ();
50 /// AST Dumping
51 virtual void dump (ACE_OSTREAM_TYPE &o);
53 /// Visiting
54 virtual int ast_accept (ast_visitor *visitor);
56 /// Cleanup
57 virtual void destroy ();
59 static AST_Decl::NodeType const NT;
61 /**
62 * Get name of the annotation as written by the user
64 const char* original_name () const;
66 /**
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);
72 /**
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.
78 Params *params ();
80 /**
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 ();
88 /**
89 * Return the parameter with the specified name if it's in the stack else
90 * returns 0.
92 Param *find_param (const char *name);
94 private:
95 /// Name of the Annotation as written
96 const char *original_name_;
98 /// Parameters List (Can be null)
99 Params *params_;
101 /// The AST_Annotation_Decl (Possibly could be null)
102 AST_Annotation_Decl *annotation_decl_;
105 struct Decl_Annotations_Pair {
106 AST_Decl *decl;
107 AST_Annotation_Appls *annotations;
110 struct Decl_Annotations_Pair_Pair {
111 Decl_Annotations_Pair *first;
112 Decl_Annotations_Pair *second;
115 #endif