Example #1
0
DDS_StdString
be_Type::EnclosingScopeString(AST_Decl * decl)
{
   DDS_StdString ret;

   assert(decl);

   if (decl)
   {
      UTL_Scope * enclosingScope = decl->defined_in();
      AST_Decl * enclosingDecl;

      if (enclosingScope)
      {
         if ((enclosingDecl = (AST_Decl*)enclosingScope->narrow((long) & AST_Decl::type_id)))
         {
            ret = NameToString(enclosingDecl->name(), 0);
         }
         else
         {
            DDSError((DDS_StdString)"Can't narrow enclosing scope for " + NameToString(decl->name(), 0));
         }
      }
   }

   return ret;
}
Example #2
0
void
be_type::gen_fwd_helper_name (void)
{
  AST_Decl *parent = ScopeAsDecl (this->defined_in ());
  Identifier *segment = 0;
  char *tmp = 0;
  this->fwd_helper_name_.clear (true);

  if (parent != 0 && parent->node_type () != AST_Decl::NT_root)
    {
      for (UTL_IdListActiveIterator i (parent->name ());
           !i.is_done ();
           i.next ())
        {
          segment = i.item ();
          tmp = segment->get_string ();

          if (ACE_OS::strcmp (tmp, "") == 0)
            {
              continue;
            }

          this->fwd_helper_name_ += tmp;
          this->fwd_helper_name_ += "::";
        }
    }
  else
    {
      this->fwd_helper_name_= "";
    }

  this->fwd_helper_name_ += "tao_";
  this->fwd_helper_name_ += this->local_name ()->get_string ();
}
Example #3
0
UTL_ScopedName * make_fully_scoped_name (Identifier * id)
{
   UTL_ScopedName * result = NULL;
   UTL_Scope *s = idl_global->scopes()->top_non_null();
   AST_Decl * d = ScopeAsDecl(s);
   UTL_ScopedName * lastComponent = new UTL_ScopedName(id, NULL);
   UTL_ScopedName * leadComponents = d->name();

   if (leadComponents)
   {
      result = (UTL_IdList*)leadComponents->copy(); // YO downcast
      result->nconc(lastComponent);
   }
   else
   {
      result = lastComponent;
   }

   return result;
}
Example #4
0
void
be_visitor_connector_dds_exh::gen_interface_connector_trait (
  be_interface *iface,
  be_field *port_elem,
  bool for_facet)
{
  if (!iface->dds_connector_traits_done ())
    {
      AST_Decl *scope = ScopeAsDecl (iface->defined_in ());
      bool global = (scope->node_type () == AST_Decl::NT_root);
      const char *smart_scope = (global ? "" : "::");
      const char *lname = iface->local_name ();

      os_ << be_nl
          << "typedef ::" << scope->name () << smart_scope
          << (!for_facet ? "" : "CCM_") << lname
          << " " << port_elem->local_name ()->get_string ()
          << "_type;";

      iface->dds_connector_traits_done (true);
      this->port_ifaces_.enqueue_tail (iface);
    }
}
Example #5
0
int
be_visitor_facet_exh::visit_provides (be_provides *node)
{
  be_type *impl = node->provides_type ();
  const char *iname =
    impl->original_local_name ()->get_string ();

  ACE_CString lname_str (this->ctx_->port_prefix ());
  lname_str += node->original_local_name ()->get_string ();
  const char *lname = lname_str.c_str ();

  AST_Decl *s = ScopeAsDecl (impl->defined_in ());
  ACE_CString sname_str =
    IdentifierHelper::orig_sn (s->name (), false);
  const char *sname = sname_str.c_str ();
  const char *global = (sname_str == "" ? "" : "::");

  AST_Decl *c_scope = ScopeAsDecl (this->node_->defined_in ());
  bool is_global = (c_scope->node_type () == AST_Decl::NT_root);
  const char *smart_scope = (is_global ? "" : "::");

  os_ << be_nl_2
      << "///  Executor implementation class for "
      << lname << " facet";

  os_ << be_nl
      << "class "
      << lname << "_exec_i" << be_idt_nl
      << ": public virtual " << global << sname << "::CCM_"
      << iname << "," << be_idt_nl
      << "public virtual ::CORBA::LocalObject"
      << be_uidt << be_uidt_nl
      << "{" << be_nl
      << "public:" << be_idt_nl
      << "/// Constructor" << be_nl
      << "/// @param[in] ctx - Container context" << be_nl
      << lname << "_exec_i (" << be_idt_nl
      << smart_scope << c_scope->full_name () << "::CCM_"
      << this->node_->local_name ()
      << "_Context_ptr ctx);" << be_uidt_nl
      << "/// Destructor" << be_nl
      << "virtual ~" << lname << "_exec_i (void);";

  if (impl->node_type () == AST_Decl::NT_interface)
    {
      be_interface *intf =
        be_interface::narrow_from_decl (impl);

      os_ << be_nl_2
          << "/** @name Operations and attributes from "
          << intf->full_name () << " */" << be_nl
          << "//@{";

      int const status =
        intf->traverse_inheritance_graph (
          be_visitor_facet_exh::method_helper,
          &os_);

      if (status == -1)
        {
          ACE_ERROR_RETURN ((LM_ERROR,
                             ACE_TEXT ("be_visitor_facet_exh::")
                             ACE_TEXT ("visit_provides - ")
                             ACE_TEXT ("traverse_inheritance_graph() ")
                             ACE_TEXT ("failed\n")),
                            -1);
        }

      os_ << be_nl << "//@}";
    }

  os_ << be_uidt << be_nl_2
      << "private:" << be_idt_nl
      << "/// Context for component instance. Used for all middleware communication." << be_nl
      << smart_scope << c_scope->full_name () << "::CCM_"
      << this->node_->local_name ()
      << "_Context_var ciao_context_;" << be_uidt_nl
      << "};";

  return 0;
}
int
ast_visitor_tmpl_module_inst::visit_home (AST_Home *node)
{
  UTL_ScopedName *base_name = 0;
  AST_Decl *parent =
    this->reify_type (node->base_home ());

  if (parent != 0)
    {
      base_name = parent->name ();
    }

  UTL_NameList *supports_names =
    this->create_name_list (node->supports (),
                            node->n_supports ());

  UTL_ScopedName *managed_comp_name = 0;

  AST_Component *managed_comp =
    AST_Component::narrow_from_decl (
      this->reify_type (node->managed_component ()));

  if (managed_comp != 0)
    {
      managed_comp_name = managed_comp->name ();
    }

  UTL_ScopedName *p_key_name = 0;

  AST_ValueType *p_key =
    AST_ValueType::narrow_from_decl (
      this->reify_type (node->primary_key ()));

  if (p_key != 0)
    {
      p_key_name = p_key->name ();
    }

  Identifier *node_id = 0;
  ACE_NEW_RETURN (node_id,
                  Identifier (node->local_name ()->get_string ()),
                  -1);

  UTL_ScopedName *local_name = 0;
  ACE_NEW_RETURN (local_name,
                  UTL_ScopedName (node_id, 0),
                  -1);

  FE_HomeHeader header (local_name,
                        base_name,
                        supports_names,
                        managed_comp_name,
                        p_key_name);

  AST_Home *added_home =
    idl_global->gen ()->create_home (header.name (),
                                     header.base_home (),
                                     header.managed_component (),
                                     header.primary_key (),
                                     header.supports (),
                                     header.n_supports (),
                                     header.supports_flat (),
                                     header.n_supports_flat ());

  if (supports_names != 0)
    {
      supports_names->destroy ();
      delete supports_names;
      supports_names = 0;
    }

  idl_global->scopes ().top ()->add_to_scope (added_home);

  // Update the scope management.
  idl_global->scopes ().push (added_home);

  if (this->visit_scope (node) != 0)
    {
      ACE_ERROR_RETURN ((LM_ERROR,
                         ACE_TEXT ("ast_visitor_tmpl_module_inst::")
                         ACE_TEXT ("visit_home - ")
                         ACE_TEXT ("visit_scope failed\n")),
                        -1);
    }

  // Through with this scope.
  idl_global->scopes ().pop ();

  return 0;
}
int
ast_visitor_tmpl_module_inst::visit_component (AST_Component *node)
{
  UTL_ScopedName *base_name = 0;
  AST_Decl *parent =
    this->reify_type (node->base_component ());

  if (parent != 0)
    {
      base_name = parent->name ();
    }

  UTL_NameList *supports_names =
    this->create_name_list (node->supports (),
                            node->n_supports ());

  Identifier *node_id = 0;
  ACE_NEW_RETURN (node_id,
                  Identifier (node->local_name ()->get_string ()),
                  -1);

  UTL_ScopedName *local_name = 0;
  ACE_NEW_RETURN (local_name,
                  UTL_ScopedName (node_id, 0),
                  -1);

  FE_ComponentHeader header (local_name,
                             base_name,
                             supports_names,
                             false);

  AST_Component *added_comp =
    idl_global->gen ()->create_component (header.name (),
                                          header.base_component (),
                                          header.supports (),
                                          header.n_supports (),
                                          header.supports_flat (),
                                          header.n_supports_flat ());

  if (supports_names != 0)
    {
      supports_names->destroy ();
      delete supports_names;
      supports_names = 0;
    }

  idl_global->scopes ().top ()->add_to_scope (added_comp);

  // Update the scope management.
  idl_global->scopes ().push (added_comp);

  if (this->visit_scope (node) != 0)
    {
      ACE_ERROR_RETURN ((LM_ERROR,
                         ACE_TEXT ("ast_visitor_tmpl_module_inst::")
                         ACE_TEXT ("visit_component - ")
                         ACE_TEXT ("visit_scope failed\n")),
                        -1);
    }

  // Through with this scope.
  idl_global->scopes ().pop ();

  return 0;
}
Example #8
0
// Visit the Constant node and its scope.
int
be_visitor_constant_ch::visit_constant (be_constant *node)
{
  if (node->cli_hdr_gen () || node->imported ())
    {
      return 0;
    }

  TAO_OutStream *os = this->ctx_->stream ();

  *os << be_nl_2 << "// TAO_IDL - Generated from" << be_nl
      << "// " << __FILE__ << ":" << __LINE__;

  // If we are defined in the outermost scope, then the value is assigned
  // to us here itself, else it will be in the *.cpp file.

  AST_Decl::NodeType nt = AST_Decl::NT_pre_defined;
  AST_Decl *tdef = node->constant_value ()->get_tdef ();
  AST_Decl::NodeType bnt = AST_Decl::NT_pre_defined;
  AST_Expression::ExprType etype = node->et ();
  AST_Decl::NodeType snt = node->defined_in ()->scope_node_type ();

  if (tdef != 0)
    {
      nt = tdef->node_type ();
      be_typedef *td = be_typedef:: narrow_from_decl (tdef);
      bnt = td->base_node_type ();
    }

  *os << be_nl_2;

  if (! node->is_nested ())
    {
      *os << "const ";

      if (etype == AST_Expression::EV_enum)
        {
          *os << node->enum_full_name ();
        }
      else if (nt == AST_Decl::NT_typedef)
        {
          *os << tdef->name ();
        }
      else
        {
          *os << node->exprtype_to_string ();
        }

      *os << " " << node->local_name ();
    }
  // We are nested inside an interface or a valuetype.
  else
    {
      if (snt != AST_Decl::NT_module)
        {
          *os << "static ";
        }
      else if (!be_global->gen_inline_constants ())
        {
          *os << "extern " << be_global->stub_export_macro () << " ";
        }

      *os << "const ";

      if (etype == AST_Expression::EV_enum)
        {
          *os << node->enum_full_name ();
        }
      else if (nt == AST_Decl::NT_typedef)
        {
          if (bnt == AST_Decl::NT_string || bnt == AST_Decl::NT_wstring)
            {
              *os << node->exprtype_to_string ();
            }
          else
            {
              *os << tdef->name ();
            }
        }
      else
        {
          *os << node->exprtype_to_string ();
        }

      *os << " " << node->local_name ();
    }

  // If this is true, can't generate inline constants.
  bool forbidden_in_class = (snt != AST_Decl::NT_root
                             && snt != AST_Decl::NT_module
                             && (etype == AST_Expression::EV_string
                                 || etype == AST_Expression::EV_wstring
                                 || etype == AST_Expression::EV_float
                                 || etype == AST_Expression::EV_double
                                 || etype == AST_Expression::EV_longdouble));

  if (!node->is_nested ()
      || (be_global->gen_inline_constants () && !forbidden_in_class))
    {
      *os << " = " << node->constant_value ();
    }

  *os << ";";

  node->cli_hdr_gen (true);
  return 0;
}
Example #9
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;
}
Example #10
0
int
be_visitor_component_ex_idl::visit_component (
  be_component *node)
{
  if (node->imported ())
    {
      return 0;
    }

  be_util::gen_nesting_open (os_, node);

  be_visitor_executor_ex_idl exec_visitor (this->ctx_);

  if (exec_visitor.visit_component (node) == -1)
    {
      ACE_ERROR_RETURN ((LM_ERROR,
                         ACE_TEXT ("be_visitor_component_ex_idl::")
                         ACE_TEXT ("visit_component - ")
                         ACE_TEXT ("executor visitor failed\n")),
                        -1);
    }

  be_visitor_context_ex_idl context_visitor (this->ctx_);

  if (context_visitor.visit_component (node) == -1)
    {
      ACE_ERROR_RETURN ((LM_ERROR,
                         ACE_TEXT ("be_visitor_component_ex_idl::")
                         ACE_TEXT ("visit_component - ")
                         ACE_TEXT ("context visitor failed\n")),
                        -1);
    }

  be_util::gen_nesting_close (os_, node);

  AST_Decl *scope = ScopeAsDecl (node->defined_in ());

  ACE_CString sname_str =
    IdentifierHelper::orig_sn (scope->name ());
  const char *sname = sname_str.c_str ();

  const char *lname =
    node->original_local_name ()->get_string ();

  const char *global = (sname_str == "" ? "" : "::");

  os_ << be_nl_2
      << "module CIAO_" << node->flat_name () << "_Impl" << be_nl
      << "{" << be_idt_nl;

  os_ << "local interface " << lname << "_Exec" << be_idt_nl
      << ": " << global << sname << "::CCM_" << lname
      << "," << be_idt_nl;

  os_ << "::Components::" << be_global->ciao_container_type ()
      << "Component" << be_uidt << be_uidt_nl;

  os_ << "{" << be_nl
      << "};";

  os_ << be_uidt_nl
      << "};";

  return 0;
}
Example #11
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;
}
Example #12
0
int
be_visitor_attribute::visit_attribute (be_attribute *node)
{
    this->ctx_->node (node);
    this->ctx_->attribute (node);

    UTL_Scope *s = node->defined_in ();
    AST_Decl *d = ScopeAsDecl (s);
    ACE_CString op_name (this->ctx_->port_prefix ());
    op_name += node->local_name ()->get_string ();
    Identifier *op_id = 0;
    ACE_NEW_RETURN (op_id,
                    Identifier (op_name.c_str ()),
                    -1);

    UTL_ScopedName *op_ln = 0;
    ACE_NEW_RETURN (op_ln,
                    UTL_ScopedName (op_id, 0),
                    -1);

    UTL_ScopedName *op_sn =
        static_cast<UTL_ScopedName *> (d->name ()->copy ());
    op_sn->nconc (op_ln);

    // first the "get" operation
    be_operation get_op (node->field_type (),
                         AST_Operation::OP_noflags,
                         0,
                         node->is_local (),
                         node->is_abstract ());

    get_op.set_defined_in (s);
    get_op.set_name (op_sn);
    UTL_ExceptList *get_exceptions = node->get_get_exceptions ();

    if (0 != get_exceptions)
    {
        get_op.be_add_exceptions (get_exceptions->copy ());
    }

    be_visitor_context ctx (*this->ctx_);
    int status = 1;

    switch (this->ctx_->state ())
    {
    // These two cases are the only ones that could involve a strategy.
    case TAO_CodeGen::TAO_ROOT_CH:
    case TAO_CodeGen::TAO_INTERFACE_CH:
    {
        ctx.state (TAO_CodeGen::TAO_OPERATION_CH);
        be_visitor_operation_ch visitor (&ctx);
        status = get_op.accept (&visitor);
        break;
    }
    case TAO_CodeGen::TAO_ROOT_CS:
    {
        ctx.state (TAO_CodeGen::TAO_OPERATION_CS);
        be_visitor_operation_cs visitor (&ctx);
        status = get_op.accept (&visitor);
        break;
    }
    case TAO_CodeGen::TAO_ROOT_SH:
    {
        be_visitor_operation_sh visitor (&ctx);
        status = get_op.accept (&visitor);
        break;
    }
    case TAO_CodeGen::TAO_ROOT_IH:
    {
        be_visitor_operation_ih visitor (&ctx);
        status = get_op.accept (&visitor);
        break;
    }
    case TAO_CodeGen::TAO_ROOT_SS:
    {
        be_visitor_operation_ss visitor (&ctx);
        status = get_op.accept (&visitor);
        break;
    }
    case TAO_CodeGen::TAO_ROOT_IS:
    {
        be_visitor_operation_is visitor (&ctx);
        status = get_op.accept (&visitor);
        break;
    }
    case TAO_CodeGen::TAO_INTERFACE_DIRECT_PROXY_IMPL_SH:
    {
        be_visitor_operation_proxy_impl_xh visitor (&ctx);
        status = get_op.accept (&visitor);
        break;
    }
    case TAO_CodeGen::TAO_INTERFACE_DIRECT_PROXY_IMPL_SS:
    {
        be_visitor_operation_direct_proxy_impl_ss visitor (&ctx);
        status = get_op.accept (&visitor);
        break;
    }
    case TAO_CodeGen::TAO_INTERFACE_SMART_PROXY_CH:
    {
        be_visitor_operation_smart_proxy_ch visitor (&ctx);
        status = get_op.accept (&visitor);
        break;
    }
    case TAO_CodeGen::TAO_INTERFACE_SMART_PROXY_CS:
    {
        be_visitor_operation_smart_proxy_cs visitor (&ctx);
        status = get_op.accept (&visitor);
        break;
    }
    case TAO_CodeGen::TAO_ROOT_TIE_SH:
    {
        be_visitor_operation_tie_sh visitor (&ctx);
        status = get_op.accept (&visitor);
        break;
    }
    case TAO_CodeGen::TAO_ROOT_TIE_SS:
    {
        be_visitor_operation_tie_ss visitor (&ctx);
        status = get_op.accept (&visitor);
        break;
    }
    case TAO_CodeGen::TAO_ROOT_SVTH:
    case TAO_CodeGen::TAO_ROOT_SVH:
    {
        be_visitor_operation_ch visitor (&ctx);
        status = get_op.accept (&visitor);
        break;
    }
    case TAO_CodeGen::TAO_ROOT_SVTS:
    case TAO_CodeGen::TAO_ROOT_SVS:
    {
        be_visitor_operation_svs visitor (&ctx);
        visitor.scope (this->op_scope_);
        status = get_op.accept (&visitor);
        break;
    }
    case TAO_CodeGen::TAO_ROOT_EXH:
    {
        be_visitor_operation_ch visitor (&ctx);
        status = get_op.accept (&visitor);
        break;
    }
    case TAO_CodeGen::TAO_ROOT_EXS:
    {
        be_visitor_operation_exs visitor (&ctx);
        visitor.scope (this->op_scope_);
        visitor.class_extension (this->exec_class_extension_.c_str ());
        status = get_op.accept (&visitor);
        break;
    }
    case TAO_CodeGen::TAO_ROOT_CNH:
    case TAO_CodeGen::TAO_ROOT_CNS:
        break;
    default:
        get_op.destroy ();
        return 0;
    }

    if (status == -1)
    {
        get_op.destroy ();
        ACE_ERROR_RETURN ((LM_ERROR,
                           "(%N:%l) be_visitor_attribute::"
                           "visit_attribute - "
                           "codegen for get_attribute failed\n"),
                          -1);
    }

    // Do nothing for readonly attributes.
    if (node->readonly ())
    {
        get_op.destroy ();
        return 0;
    }

    status = 1;

    // Create the set method.
    Identifier id ("void");
    UTL_ScopedName sn (&id,
                       0);

    // The return type  is "void".
    be_predefined_type rt (AST_PredefinedType::PT_void,
                           &sn);

    // Argument type is the same as the attribute type.
    AST_Argument *arg =
        idl_global->gen ()->create_argument (AST_Argument::dir_IN,
                node->field_type (),
                node->name ());

    arg->set_name ((UTL_IdList *) node->name ()->copy ());

    // Create the operation.
    be_operation set_op (&rt,
                         AST_Operation::OP_noflags,
                         0,
                         node->is_local (),
                         node->is_abstract ());
    set_op.set_defined_in (node->defined_in ());
    set_op.set_name (static_cast<UTL_ScopedName *> (op_sn->copy ()));
    set_op.be_add_argument (arg);

    UTL_ExceptList *set_exceptions = node->get_set_exceptions ();

    if (0 != set_exceptions)
    {
        set_op.be_add_exceptions (set_exceptions->copy ());
    }

    ctx = *this->ctx_;
    status = 1;

    switch (this->ctx_->state ())
    {
    // These two cases are the only ones that could involved a strategy.
    case TAO_CodeGen::TAO_ROOT_CH:
    case TAO_CodeGen::TAO_INTERFACE_CH:
    {
        ctx.state (TAO_CodeGen::TAO_OPERATION_CH);
        be_visitor_operation_ch visitor (&ctx);
        status = set_op.accept (&visitor);
        break;
    }
    case TAO_CodeGen::TAO_ROOT_CS:
    {
        ctx.state (TAO_CodeGen::TAO_OPERATION_CS);
        be_visitor_operation_cs visitor (&ctx);
        status = set_op.accept (&visitor);
        break;
    }
    case TAO_CodeGen::TAO_ROOT_SH:
    {
        be_visitor_operation_sh visitor (&ctx);
        status = set_op.accept (&visitor);
        break;
    }
    case TAO_CodeGen::TAO_ROOT_IH:
    {
        be_visitor_operation_ih visitor (&ctx);
        status = set_op.accept (&visitor);
        break;
    }
    case TAO_CodeGen::TAO_ROOT_SS:
    {
        be_visitor_operation_ss visitor (&ctx);
        status = set_op.accept (&visitor);
        break;
    }
    case TAO_CodeGen::TAO_ROOT_IS:
    {
        be_visitor_operation_is visitor (&ctx);
        status = set_op.accept (&visitor);
        break;
    }
    case TAO_CodeGen::TAO_INTERFACE_DIRECT_PROXY_IMPL_SH:
    {
        be_visitor_operation_proxy_impl_xh visitor (&ctx);
        status = set_op.accept (&visitor);
        break;
    }
    case TAO_CodeGen::TAO_INTERFACE_DIRECT_PROXY_IMPL_SS:
    {
        be_visitor_operation_direct_proxy_impl_ss visitor (&ctx);
        status = set_op.accept (&visitor);
        break;
    }
    case TAO_CodeGen::TAO_INTERFACE_SMART_PROXY_CH:
    {
        be_visitor_operation_smart_proxy_ch visitor (&ctx);
        status = set_op.accept (&visitor);
        break;
    }
    case TAO_CodeGen::TAO_INTERFACE_SMART_PROXY_CS:
    {
        be_visitor_operation_smart_proxy_cs visitor (&ctx);
        status = set_op.accept (&visitor);
        break;
    }
    case TAO_CodeGen::TAO_ROOT_TIE_SH:
    {
        be_visitor_operation_tie_sh visitor (&ctx);
        status = set_op.accept (&visitor);
        break;
    }
    case TAO_CodeGen::TAO_ROOT_TIE_SS:
    {
        be_visitor_operation_tie_ss visitor (&ctx);
        status = set_op.accept (&visitor);
        break;
    }
    case TAO_CodeGen::TAO_ROOT_SVTH:
    case TAO_CodeGen::TAO_ROOT_SVH:
    {
        be_visitor_operation_ch visitor (&ctx);
        status = set_op.accept (&visitor);
        break;
    }
    case TAO_CodeGen::TAO_ROOT_SVTS:
    case TAO_CodeGen::TAO_ROOT_SVS:
    {
        be_visitor_operation_svs visitor (&ctx);
        visitor.scope (this->op_scope_);
        status = set_op.accept (&visitor);
        break;
    }
    case TAO_CodeGen::TAO_ROOT_EXH:
    {
        be_visitor_operation_ch visitor (&ctx);
        status = set_op.accept (&visitor);
        break;
    }
    case TAO_CodeGen::TAO_ROOT_EXS:
    {
        be_visitor_operation_exs visitor (&ctx);
        visitor.scope (this->op_scope_);
        visitor.class_extension (this->exec_class_extension_.c_str ());
        status = set_op.accept (&visitor);
        break;
    }
    case TAO_CodeGen::TAO_ROOT_CNH:
    case TAO_CodeGen::TAO_ROOT_CNS:
        break;
    default:
        // Error.
        set_op.destroy ();
        rt.destroy ();
        ACE_ERROR_RETURN ((LM_ERROR,
                           "(%N:%l) be_visitor_attribute::"
                           "visit_attribute - "
                           "bad codegen state\n"),
                          -1);
    }

    if (status == 0)
    {
        get_op.destroy ();
        set_op.destroy ();
        rt.destroy ();
        return 0;
    }
    else if (status == -1)
    {
        get_op.destroy ();
        set_op.destroy ();
        rt.destroy ();
        ACE_ERROR_RETURN ((LM_ERROR,
                           "(%N:%l) be_visitor_attribute::"
                           "visit_attribute - "
                           "codegen for get_attribute failed\n"),
                          -1);
    }

    get_op.destroy ();
    set_op.destroy ();
    rt.destroy ();
    return 0;
}