// Compute the size type of the node in question. int AST_Structure::compute_size_type (void) { for (UTL_ScopeActiveIterator si (this, UTL_Scope::IK_decls); !si.is_done (); si.next ()) { // Get the next AST decl node. AST_Decl *d = si.item (); if (d->node_type () == AST_Decl::NT_enum_val) { continue; } AST_Field *f = AST_Field::narrow_from_decl (d); AST_Type *t = f->field_type (); if (t != 0) { this->size_type (t->size_type ()); // While we're iterating, we might as well do this one too. this->has_constructor (t->has_constructor ()); } else { ACE_DEBUG ((LM_DEBUG, "WARNING (%N:%l) be_structure::compute_size_type - " "narrow_from_decl returned 0\n")); } } return 0; }
// Compute the size type of the node in question. int AST_Union::compute_size_type (void) { for (UTL_ScopeActiveIterator si (this, UTL_Scope::IK_decls); !si.is_done (); si.next ()) { // Get the next AST decl node. AST_Decl *d = si.item (); if (d->node_type () == AST_Decl::NT_enum_val) { continue; } AST_Field *f = AST_Field::narrow_from_decl (d); if (f != 0) { AST_Type *t = f->field_type (); // Our sizetype depends on the sizetype of our members. Although // previous value of sizetype may get overwritten, we are // guaranteed by the "size_type" call that once the value reached // be_decl::VARIABLE, nothing else can overwrite it. this->size_type (t->size_type ()); } else { ACE_DEBUG ((LM_DEBUG, "WARNING (%N:%l) be_union::compute_size_type - " "narrow_from_decl returned 0\n")); } } return 0; }
int be_visitor_connector_dds_exs::visit_connector (be_connector *node) { if (node->imported ()) { return 0; } if (!this->begin (node)) { return -1; } // If we have a connector within a templated module if (! this->t_args_.is_empty ()) { os_ << be_nl << this->node_->local_name () << "_exec_i::" << this->node_->local_name () << "_exec_i (void)" << be_idt_nl << ": " << this->base_tname_ << "_Connector_T"; os_ << " <" << be_idt << be_idt_nl; os_ << "CCM_" << this->node_->flat_name () << "_Traits," << be_nl; size_t slot = 1UL; for (FE_Utils::T_ARGLIST::CONST_ITERATOR i (this->t_args_); !i.done (); i.advance (), ++slot) { AST_Decl **item = 0; i.next (item); AST_Decl *d = *item; if (this->is_dds_type (node, d)) { os_ << d->flat_name () << "_DDS_Traits"; } else { os_ << d->name (); } bool needs_bool = false; bool is_fixed = false; FE_Utils::T_Param_Info *param = 0; if (this->t_params_->get (param, slot - 1) != 0) { ACE_ERROR_RETURN ((LM_ERROR, ACE_TEXT ("be_visitor_connector_dds_exh::") ACE_TEXT ("visit_connector - ") ACE_TEXT ("template param fetch failed\n ")), -1); } if (d->node_type () == AST_Decl::NT_typedef) { /// Strip away all layers of typedef before narrowing. AST_Typedef *td = AST_Typedef::narrow_from_decl (d); d = td->primitive_base_type (); } /// No need to check if this is 0, but must narrow /// to call virtual function size_type() below. AST_Type *t = AST_Type::narrow_from_decl (d); switch (param->type_) { case AST_Decl::NT_type: case AST_Decl::NT_struct: case AST_Decl::NT_union: needs_bool = true; is_fixed = (t->size_type () == AST_Type::FIXED); break; default: break; } if (needs_bool) { os_ << "," << be_nl << (is_fixed ? "true" : "false"); } if (slot < this->t_args_.size ()) { os_ << "," << be_nl; } } os_ << "> ()" << be_uidt << be_uidt << be_uidt_nl << "{" << be_nl << "}"; os_ << be_nl_2 << this->node_->local_name () << "_exec_i::~" << this->node_->local_name () << "_exec_i (void)" << be_nl << "{" << be_nl << "}"; this->gen_exec_entrypoint_defn (); } os_ << be_uidt_nl << "}"; return 0; }
int be_visitor_connector_dds_exh::visit_connector (be_connector *node) { if (node->imported ()) { return 0; } if (!this->begin (node)) { return -1; } // If we have a connector within a templated module if (! this->t_args_.is_empty ()) { // Generate all needed dds_traits for (FE_Utils::T_ARGLIST::CONST_ITERATOR i (this->t_args_); !i.done (); i.advance ()) { AST_Decl **item = 0; i.next (item); AST_Decl *d = *item; if (this->is_dds_type (node, d)) { this->gen_dds_traits (d); } } // Generate connector traits this->gen_connector_traits (); os_ << be_nl_2 << "class " << this->export_macro_.c_str () << " " << this->node_->local_name () << "_exec_i" << be_idt_nl << ": public " << this->base_tname_ << "_Connector_T"; os_ << " <" << be_idt << be_idt_nl; os_ << "CCM_" << this->node_->flat_name () << "_Traits," << be_nl; size_t slot = 1UL; for (FE_Utils::T_ARGLIST::CONST_ITERATOR i (this->t_args_); !i.done (); i.advance (), ++slot) { AST_Decl **item = 0; i.next (item); AST_Decl *d = *item; if (this->is_dds_type (node, d)) { os_ << d->flat_name () << "_DDS_Traits"; } else { os_ << d->name (); } bool needs_bool = false; bool is_fixed = false; FE_Utils::T_Param_Info *param = 0; if (this->t_params_->get (param, slot - 1) != 0) { ACE_ERROR_RETURN ((LM_ERROR, ACE_TEXT ("be_visitor_connector_dds_exh::") ACE_TEXT ("visit_connector - ") ACE_TEXT ("template param fetch failed\n ")), -1); } if (d->node_type () == AST_Decl::NT_typedef) { /// Strip away all layers of typedef before narrowing. AST_Typedef *td = AST_Typedef::narrow_from_decl (d); d = td->primitive_base_type (); } /// No need to check if this is 0, but must narrow /// to call virtual function size_type() below. AST_Type *t = AST_Type::narrow_from_decl (d); switch (param->type_) { case AST_Decl::NT_type: case AST_Decl::NT_struct: case AST_Decl::NT_union: needs_bool = true; is_fixed = (t->size_type () == AST_Type::FIXED); break; default: break; } if (needs_bool) { os_ << "," << be_nl << (is_fixed ? "true" : "false"); } if (slot < this->t_args_.size ()) { os_ << "," << be_nl; } } os_ << ">"; os_ << be_uidt << be_uidt << be_uidt_nl << "{" << be_nl << "public:" << be_idt_nl << this->node_->local_name () << "_exec_i (void);" << be_nl << "virtual ~" << this->node_->local_name () << "_exec_i (void);" << be_uidt_nl << "};"; this->gen_exec_entrypoint_decl (); } os_ << be_uidt_nl << "}"; /// Unset the flags in the port interfaces list. This is /// also done in visit_mirror_port(), but we must also do /// it here to catch a port interface that didn't come to /// us from an extended port or mirror port. for (ACE_Unbounded_Queue<be_interface *>::ITERATOR iter ( this->port_ifaces_); !iter.done (); iter.advance ()) { be_interface **item = 0; iter.next (item); (*item)->dds_connector_traits_done (false); } return 0; }