diff options
author | parsons <parsons@ae88bc3d-4319-0410-8dbf-d08b4c9d3795> | 2000-11-03 21:11:56 +0000 |
---|---|---|
committer | parsons <parsons@ae88bc3d-4319-0410-8dbf-d08b4c9d3795> | 2000-11-03 21:11:56 +0000 |
commit | a0cc85fe96cb41bd5b53fe1b54f5c7434cbea851 (patch) | |
tree | 88f6314d502362afe15101281cb71af42d785708 | |
parent | 40e2506dcf5e710e9718cc92fec951400ef67787 (diff) | |
download | ATCD-a0cc85fe96cb41bd5b53fe1b54f5c7434cbea851.tar.gz |
ChangeLogTag: Fri Nov 3 14:53:08 2000 Jeff Parsons <parsons@cs.wustl.edu>
-rw-r--r-- | TAO/TAO_IDL/ast/ast_exception.cpp | 2 | ||||
-rw-r--r-- | TAO/TAO_IDL/ast/ast_structure.cpp | 88 | ||||
-rw-r--r-- | TAO/TAO_IDL/ast/ast_union.cpp | 6 | ||||
-rw-r--r-- | TAO/TAO_IDL/include/ast_structure.h | 13 |
4 files changed, 78 insertions, 31 deletions
diff --git a/TAO/TAO_IDL/ast/ast_exception.cpp b/TAO/TAO_IDL/ast/ast_exception.cpp index 558ff170361..48b7af8fe66 100644 --- a/TAO/TAO_IDL/ast/ast_exception.cpp +++ b/TAO/TAO_IDL/ast/ast_exception.cpp @@ -209,6 +209,8 @@ AST_Exception::fe_add_field (AST_Field *t) I_FALSE, t->local_name ()); + this->fields_.enqueue_tail (t); + return t; } diff --git a/TAO/TAO_IDL/ast/ast_structure.cpp b/TAO/TAO_IDL/ast/ast_structure.cpp index 0d787c4c4e2..7b90ebc2b7e 100644 --- a/TAO/TAO_IDL/ast/ast_structure.cpp +++ b/TAO/TAO_IDL/ast/ast_structure.cpp @@ -177,34 +177,6 @@ AST_Structure::in_recursion (AST_Type *node) return 0; } -// Compute total number of members. -int -AST_Structure::compute_member_count (void) -{ - this->member_count_ = 0; - - // If there are elements in this scope. - if (this->nmembers () > 0) - { - // Instantiate a scope iterator. - UTL_ScopeActiveIterator *si = 0; - ACE_NEW_RETURN (si, - UTL_ScopeActiveIterator (this, - UTL_Scope::IK_decls), - -1); - - while (!si->is_done ()) - { - this->member_count_++; - si->next (); - } - - delete si; - } - - return 0; -} - // Return the member count. int AST_Structure::member_count (void) @@ -217,6 +189,20 @@ AST_Structure::member_count (void) return this->member_count_; } +size_t +AST_Structure::nfields (void) const +{ + return this->fields_.size (); +} + +int +AST_Structure::field (AST_Field **&result, + size_t slot) const +{ + return this->fields_.get (result, + slot); +} + idl_bool AST_Structure::is_local (void) { @@ -303,6 +289,8 @@ AST_Structure::fe_add_field (AST_Field *t) I_FALSE, t->local_name ()); + this->fields_.enqueue_tail (t); + return t; } @@ -493,6 +481,34 @@ AST_Structure::fe_add_enum_val (AST_EnumVal *t) return t; } +// Compute total number of members. +int +AST_Structure::compute_member_count (void) +{ + this->member_count_ = 0; + + // If there are elements in this scope. + if (this->nmembers () > 0) + { + // Instantiate a scope iterator. + UTL_ScopeActiveIterator *si = 0; + ACE_NEW_RETURN (si, + UTL_ScopeActiveIterator (this, + UTL_Scope::IK_decls), + -1); + + while (!si->is_done ()) + { + this->member_count_++; + si->next (); + } + + delete si; + } + + return 0; +} + // Dump this AST_Structure node to the ostream o. void AST_Structure::dump (ostream &o) @@ -510,7 +526,7 @@ AST_Structure::dump (ostream &o) AST_Decl::dump (o); o << " {\n"; UTL_Scope::dump (o); - idl_global->indent ()->skip_to( o); + idl_global->indent ()->skip_to (o); o << "}"; } @@ -529,3 +545,17 @@ AST_Structure::destroy (void) IMPL_NARROW_METHODS2(AST_Structure, AST_ConcreteType, UTL_Scope) IMPL_NARROW_FROM_DECL(AST_Structure) IMPL_NARROW_FROM_SCOPE(AST_Structure) + +// ACE_node<AST_Decl *> is already in AST_Module.cpp. + +#if defined (ACE_HAS_EXPLICIT_TEMPLATE_INSTANTIATION) + +template class ACE_Node<AST_Field *>; +template class ACE_Unbounded_Queue<AST_Field *>; + +#elif defined (ACE_HAS_TEMPLATE_INSTANTIATION_PRAGMA) + +#pragma instantiate ACE_Node<AST_Decl *> +#pragma instantiate ACE_Unbounded_Queue<AST_Decl *> + +#endif /* ACE_HAS_EXPLICIT_TEMPLATE_INSTANTIATION */ diff --git a/TAO/TAO_IDL/ast/ast_union.cpp b/TAO/TAO_IDL/ast/ast_union.cpp index 7463367ab49..1afba5730e9 100644 --- a/TAO/TAO_IDL/ast/ast_union.cpp +++ b/TAO/TAO_IDL/ast/ast_union.cpp @@ -91,7 +91,7 @@ AST_Union::AST_Union (AST_ConcreteType *dt, : AST_Decl (AST_Decl::NT_union, n, p), - UTL_Scope(AST_Decl::NT_union), + UTL_Scope (AST_Decl::NT_union), COMMON_Base (local, abstract) { @@ -301,7 +301,7 @@ AST_Union::lookup_label (AST_UnionBranch *b) AST_Decl *d = 0; AST_UnionBranch *fb = 0; - lv->set_ev(lv->coerce (this->pd_udisc_type)); + lv->set_ev (lv->coerce (this->pd_udisc_type)); if (lv->ev () == 0) { @@ -525,6 +525,8 @@ AST_Union::fe_add_union_branch (AST_UnionBranch *t) I_FALSE, t->local_name ()); + this->fields_.enqueue_tail (t); + return t; } diff --git a/TAO/TAO_IDL/include/ast_structure.h b/TAO/TAO_IDL/include/ast_structure.h index 53b3eed0005..c633a9fd19b 100644 --- a/TAO/TAO_IDL/include/ast_structure.h +++ b/TAO/TAO_IDL/include/ast_structure.h @@ -108,6 +108,13 @@ public: virtual int member_count (void); // Return the count of members. + virtual size_t nfields (void) const; + // Return the count of actual fields. + + virtual int field (AST_Field **&result, + size_t slot) const; + // Get an individual field node. + virtual idl_bool is_local (void); // Overwrite the is_local method. @@ -123,6 +130,12 @@ public: // Visiting. virtual int ast_accept (ast_visitor *visitor); +protected: + ACE_Unbounded_Queue<AST_Field *> fields_; + // Container for this struct's field nodes. Excludes nodes included + // in member_count, i.e., enum values of an enum declared inside + // the struct. + private: friend int tao_yyparse (void); // Scope Management Protocol. |