Merge pull request #1844 from jrw972/monterey
[ACE_TAO.git] / TAO / TAO_IDL / include / ast_annotation_appls.h
blob0686717622e3faeba252985a838770316db5a55c
1 #ifndef AST_ANNOTATION_APPL_VECTOR_HEADER
2 #define AST_ANNOTATION_APPL_VECTOR_HEADER
4 #include "ace/Vector_T.h"
5 #include "ace/Mutex.h"
6 #include "ace/Bound_Ptr.h"
8 #include "TAO_IDL_FE_Export.h"
10 class AST_Annotation_Appl;
11 class AST_Annotation_Decl;
13 /**
14 * Container for AST_Annotation_Appl
16 * Uses ACE_Strong_Bound_Ptr because they can be shared between AST_Decl.
18 class TAO_IDL_FE_Export AST_Annotation_Appls {
19 public:
20 typedef ACE_Strong_Bound_Ptr<AST_Annotation_Appl, ACE_Mutex> AST_Annotation_Appl_Ptr;
21 typedef ACE_Vector<AST_Annotation_Appl_Ptr> AST_Annotation_Appl_Ptrs;
22 typedef AST_Annotation_Appl_Ptrs::iterator iterator;
23 typedef AST_Annotation_Appl_Ptrs::const_iterator const_iterator;
25 AST_Annotation_Appls ();
26 AST_Annotation_Appls (const AST_Annotation_Appls& other);
27 ~AST_Annotation_Appls ();
29 AST_Annotation_Appls &operator= (const AST_Annotation_Appls& other);
31 /**
32 * Add an AST_Annotation_Appl to the vector. This class assumes ownership of
33 * the pointer which is managed by ACE_Strong_Bound_Ptr.
35 void add (AST_Annotation_Appl *appl);
37 /**
38 * Add all the AST_Annotation_Appls from another AST_Annotation_Appls to the
39 * this one.
41 void add (const AST_Annotation_Appls& other);
43 bool empty () const;
44 size_t size () const;
46 /// Iterate through ACE_Strong_Bound_Ptr<AST_Annotation_Appl, ACE_Mutex>
47 ///{
48 iterator begin ();
49 iterator end ();
50 const_iterator begin () const;
51 const_iterator end () const;
52 ///}
54 /**
55 * Direct access to the AST_Annotation_Appl pointers by index.
57 AST_Annotation_Appl *operator[] (size_t index);
59 /**
60 * Return last AST_Annotation_Appl that applies the AST_Annotation_Decl
61 * or return 0 if there are non that do.
63 AST_Annotation_Appl *find (AST_Annotation_Decl *annotation);
65 /**
66 * Same as find (AST_Annotation_Decl*) except do a look up of the
67 * AST_Annotation_Decl first.
69 AST_Annotation_Appl *find (const char *annotation);
71 private:
72 AST_Annotation_Appl_Ptrs vector_;
75 #endif