pragma Style_Checks ("NM32766");
pragma Warnings (Off, "use of an anonymous access type allocator");
pragma Warnings (Off, "unnecessary with of ancestor");

---------------------------------------------------
--  This file has been generated automatically from
--  /pbulk/work/net/ada-polyorb/work/PolyORB-25.0/idls/cos/naming/CosNaming.idl
--  by IAC (IDL to Ada Compiler) 25.0w (rev. unknown).
---------------------------------------------------
--  NOTE: If you modify this file by hand, your
--  changes will be lost when you re-run the
--  IDL to Ada compiler.
---------------------------------------------------

with PolyORB.Std;
with PolyORB.Exceptions;
with CORBA.Object.Helper;
with CosNaming.NamingContext.Helper;
with PolyORB.Utils.Strings;
with PolyORB.Utils.Strings.Lists;
with PolyORB.Initialization;

package body CosNaming.NamingContextExt.Helper is

   
   package body Internals is

      NamingContextExt_Initialized : PolyORB.Std.Boolean :=
        False;

      ---------------------------------
      -- Initialize_NamingContextExt --
      ---------------------------------

      procedure Initialize_NamingContextExt is
         Name_Ü : constant CORBA.String :=
           CORBA.To_CORBA_String
              ("NamingContextExt");
         Id_Ü : constant CORBA.String :=
           CORBA.To_CORBA_String
              ("IDL:omg.org/CosNaming/NamingContextExt:1.0");
      begin
         if not NamingContextExt_Initialized
         then
            NamingContextExt_Initialized :=
              True;
            CosNaming.NamingContextExt.Helper.TC_NamingContextExt :=
              CORBA.TypeCode.Internals.To_CORBA_Object
                 (PolyORB.Any.TypeCode.Tcf_Object);
            CORBA.Internals.Add_Parameter
              (TC_NamingContextExt,
               CORBA.To_Any
                 (Name_Ü));
            CORBA.Internals.Add_Parameter
              (TC_NamingContextExt,
               CORBA.To_Any
                 (Id_Ü));
            CORBA.TypeCode.Internals.Disable_Ref_Counting
              (TC_NamingContextExt);
            CORBA.TypeCode.Internals.Freeze
              (TC_NamingContextExt);
         end if;
      end Initialize_NamingContextExt;

      ----------
      -- Wrap --
      ----------

      function Wrap
        (X : access CosNaming.NamingContextExt.StringName)
        return PolyORB.Any.Content'Class
      is
      begin
         return CORBA.Wrap
           (CORBA.String
              (X.all)'Unrestricted_Access);
      end Wrap;

      StringName_Initialized : PolyORB.Std.Boolean :=
        False;

      ---------------------------
      -- Initialize_StringName --
      ---------------------------

      procedure Initialize_StringName is
         Name_Ü : constant CORBA.String :=
           CORBA.To_CORBA_String
              ("StringName");
         Id_Ü : constant CORBA.String :=
           CORBA.To_CORBA_String
              ("IDL:omg.org/CosNaming/NamingContextExt/StringName:1.0");
      begin
         if not StringName_Initialized
         then
            StringName_Initialized :=
              True;
            CosNaming.NamingContextExt.Helper.TC_StringName :=
              CORBA.TypeCode.Internals.Build_Alias_TC
                 (Name => Name_Ü,
                  Id => Id_Ü,
                  Parent => CORBA.TC_String);
            CORBA.TypeCode.Internals.Disable_Ref_Counting
              (TC_StringName);
            CORBA.TypeCode.Internals.Freeze
              (TC_StringName);
         end if;
      end Initialize_StringName;

      ----------
      -- Wrap --
      ----------

      function Wrap
        (X : access CosNaming.NamingContextExt.Address)
        return PolyORB.Any.Content'Class
      is
      begin
         return CORBA.Wrap
           (CORBA.String
              (X.all)'Unrestricted_Access);
      end Wrap;

      Address_Initialized : PolyORB.Std.Boolean :=
        False;

      ------------------------
      -- Initialize_Address --
      ------------------------

      procedure Initialize_Address is
         Name_Ü : constant CORBA.String :=
           CORBA.To_CORBA_String
              ("Address");
         Id_Ü : constant CORBA.String :=
           CORBA.To_CORBA_String
              ("IDL:omg.org/CosNaming/NamingContextExt/Address:1.0");
      begin
         if not Address_Initialized
         then
            Address_Initialized :=
              True;
            CosNaming.NamingContextExt.Helper.TC_Address :=
              CORBA.TypeCode.Internals.Build_Alias_TC
                 (Name => Name_Ü,
                  Id => Id_Ü,
                  Parent => CORBA.TC_String);
            CORBA.TypeCode.Internals.Disable_Ref_Counting
              (TC_Address);
            CORBA.TypeCode.Internals.Freeze
              (TC_Address);
         end if;
      end Initialize_Address;

      ----------
      -- Wrap --
      ----------

      function Wrap
        (X : access CosNaming.NamingContextExt.URLString)
        return PolyORB.Any.Content'Class
      is
      begin
         return CORBA.Wrap
           (CORBA.String
              (X.all)'Unrestricted_Access);
      end Wrap;

      URLString_Initialized : PolyORB.Std.Boolean :=
        False;

      --------------------------
      -- Initialize_URLString --
      --------------------------

      procedure Initialize_URLString is
         Name_Ü : constant CORBA.String :=
           CORBA.To_CORBA_String
              ("URLString");
         Id_Ü : constant CORBA.String :=
           CORBA.To_CORBA_String
              ("IDL:omg.org/CosNaming/NamingContextExt/URLString:1.0");
      begin
         if not URLString_Initialized
         then
            URLString_Initialized :=
              True;
            CosNaming.NamingContextExt.Helper.TC_URLString :=
              CORBA.TypeCode.Internals.Build_Alias_TC
                 (Name => Name_Ü,
                  Id => Id_Ü,
                  Parent => CORBA.TC_String);
            CORBA.TypeCode.Internals.Disable_Ref_Counting
              (TC_URLString);
            CORBA.TypeCode.Internals.Freeze
              (TC_URLString);
         end if;
      end Initialize_URLString;

      procedure Raise_InvalidAddress_From_Any
        (Item : PolyORB.Any.Any;
         Message : PolyORB.Std.String);

      pragma No_Return (Raise_InvalidAddress_From_Any);

      -----------------------------------
      -- Raise_InvalidAddress_From_Any --
      -----------------------------------

      procedure Raise_InvalidAddress_From_Any
        (Item : PolyORB.Any.Any;
         Message : PolyORB.Std.String)
      is
         Members : constant CosNaming.NamingContextExt.InvalidAddress_Members :=
           CosNaming.NamingContextExt.Helper.From_Any
              (CORBA.Any
                 (Item));
      begin
         PolyORB.Exceptions.User_Raise_Exception
           (InvalidAddress'Identity,
            Members,
            Message);
      end Raise_InvalidAddress_From_Any;

      InvalidAddress_Initialized : PolyORB.Std.Boolean :=
        False;

      -------------------------------
      -- Initialize_InvalidAddress --
      -------------------------------

      procedure Initialize_InvalidAddress is
         Name_Ü : constant CORBA.String :=
           CORBA.To_CORBA_String
              ("InvalidAddress_Members");
         Id_Ü : constant CORBA.String :=
           CORBA.To_CORBA_String
              ("IDL:omg.org/CosNaming/NamingContextExt/InvalidAddress:1.0");
      begin
         if not InvalidAddress_Initialized
         then
            InvalidAddress_Initialized :=
              True;
            CosNaming.NamingContextExt.Helper.TC_InvalidAddress :=
              CORBA.TypeCode.Internals.To_CORBA_Object
                 (PolyORB.Any.TypeCode.Tcf_Except);
            CORBA.Internals.Add_Parameter
              (TC_InvalidAddress,
               CORBA.To_Any
                 (Name_Ü));
            CORBA.Internals.Add_Parameter
              (TC_InvalidAddress,
               CORBA.To_Any
                 (Id_Ü));
            PolyORB.Exceptions.Register_Exception
              (CORBA.TypeCode.Internals.To_PolyORB_Object
                 (TC_InvalidAddress),
               Raise_InvalidAddress_From_Any'Access);
            CORBA.TypeCode.Internals.Disable_Ref_Counting
              (TC_InvalidAddress);
            CORBA.TypeCode.Internals.Freeze
              (TC_InvalidAddress);
         end if;
      end Initialize_InvalidAddress;

   end Internals;

   --------------
   -- From_Any --
   --------------

   function From_Any
     (Item : CORBA.Any)
     return CosNaming.NamingContextExt.Ref
   is
   begin
      return To_Ref
        (CORBA.Object.Helper.From_Any
           (Item));
   end From_Any;

   ------------
   -- To_Any --
   ------------

   function To_Any
     (Item : CosNaming.NamingContextExt.Ref)
     return CORBA.Any
   is
      A : CORBA.Any :=
        CORBA.Object.Helper.To_Any
           (CORBA.Object.Ref
              (Item));
   begin
      CORBA.Internals.Set_Type
        (A,
         TC_NamingContextExt);
      return A;
   end To_Any;

   ----------------------
   -- Unchecked_To_Ref --
   ----------------------

   function Unchecked_To_Ref
     (The_Ref : CORBA.Object.Ref'Class)
     return CosNaming.NamingContextExt.Ref
   is
      Result : CosNaming.NamingContextExt.Ref;
   begin
      Set
        (Result,
         CORBA.Object.Object_Of
           (The_Ref));
      return Result;
   end Unchecked_To_Ref;

   ------------
   -- To_Ref --
   ------------

   function To_Ref
     (The_Ref : CORBA.Object.Ref'Class)
     return CosNaming.NamingContextExt.Ref
   is
   begin
      if (CORBA.Object.Is_Nil
        (The_Ref)
         or else CORBA.Object.Is_A
           (The_Ref,
            Repository_Id))
      then
         return Unchecked_To_Ref
           (The_Ref);
      end if;
      CORBA.Raise_Bad_Param
        (CORBA.Default_Sys_Member);
   end To_Ref;

   --------------
   -- From_Any --
   --------------

   function From_Any
     (Item : CORBA.Any)
     return CosNaming.NamingContextExt.StringName
   is
      Result : constant CORBA.String :=
        CORBA.From_Any
           (Item);
   begin
      return CosNaming.NamingContextExt.StringName
        (Result);
   end From_Any;

   ------------
   -- To_Any --
   ------------

   function To_Any
     (Item : CosNaming.NamingContextExt.StringName)
     return CORBA.Any
   is
      Result : CORBA.Any :=
        CORBA.To_Any
           (CORBA.String
              (Item));
   begin
      CORBA.Internals.Set_Type
        (Result,
         TC_StringName);
      return Result;
   end To_Any;

   --------------
   -- From_Any --
   --------------

   function From_Any
     (Item : CORBA.Any)
     return CosNaming.NamingContextExt.Address
   is
      Result : constant CORBA.String :=
        CORBA.From_Any
           (Item);
   begin
      return CosNaming.NamingContextExt.Address
        (Result);
   end From_Any;

   ------------
   -- To_Any --
   ------------

   function To_Any
     (Item : CosNaming.NamingContextExt.Address)
     return CORBA.Any
   is
      Result : CORBA.Any :=
        CORBA.To_Any
           (CORBA.String
              (Item));
   begin
      CORBA.Internals.Set_Type
        (Result,
         TC_Address);
      return Result;
   end To_Any;

   --------------
   -- From_Any --
   --------------

   function From_Any
     (Item : CORBA.Any)
     return CosNaming.NamingContextExt.URLString
   is
      Result : constant CORBA.String :=
        CORBA.From_Any
           (Item);
   begin
      return CosNaming.NamingContextExt.URLString
        (Result);
   end From_Any;

   ------------
   -- To_Any --
   ------------

   function To_Any
     (Item : CosNaming.NamingContextExt.URLString)
     return CORBA.Any
   is
      Result : CORBA.Any :=
        CORBA.To_Any
           (CORBA.String
              (Item));
   begin
      CORBA.Internals.Set_Type
        (Result,
         TC_URLString);
      return Result;
   end To_Any;

   --------------
   -- From_Any --
   --------------

   function From_Any
     (Item : CORBA.Any)
     return CosNaming.NamingContextExt.InvalidAddress_Members
   is
      Result_Ü : CosNaming.NamingContextExt.InvalidAddress_Members;
      pragma Warnings (Off);
      pragma Unreferenced (Item);
      pragma Warnings (On);
   begin
      return Result_Ü;
   end From_Any;

   ------------
   -- To_Any --
   ------------

   function To_Any
     (Item : CosNaming.NamingContextExt.InvalidAddress_Members)
     return CORBA.Any
   is
      Result_Ü : constant CORBA.Any :=
        CORBA.Internals.Get_Empty_Any_Aggregate
           (CosNaming.NamingContextExt.Helper.TC_InvalidAddress);
      pragma Warnings (Off);
      pragma Unreferenced (Item);
      pragma Warnings (On);
   begin
      return Result_Ü;
   end To_Any;

   --------------------------
   -- Raise_InvalidAddress --
   --------------------------

   procedure Raise_InvalidAddress
     (Members : CosNaming.NamingContextExt.InvalidAddress_Members)
   is
   begin
      PolyORB.Exceptions.User_Raise_Exception
        (InvalidAddress'Identity,
         Members);
   end Raise_InvalidAddress;

   function From_Any
     (Item : CORBA.Any)
     return CosNaming.NamingContextExt.NotFoundReason
     renames CosNaming.NamingContext.Helper.From_Any;

   function To_Any
     (Item : CosNaming.NamingContextExt.NotFoundReason)
     return CORBA.Any
     renames CosNaming.NamingContext.Helper.To_Any;

   function From_Any
     (Item : CORBA.Any)
     return CosNaming.NamingContextExt.NotFound_Members
     renames CosNaming.NamingContext.Helper.From_Any;

   function To_Any
     (Item : CosNaming.NamingContextExt.NotFound_Members)
     return CORBA.Any
     renames CosNaming.NamingContext.Helper.To_Any;

   function From_Any
     (Item : CORBA.Any)
     return CosNaming.NamingContextExt.CannotProceed_Members
     renames CosNaming.NamingContext.Helper.From_Any;

   function To_Any
     (Item : CosNaming.NamingContextExt.CannotProceed_Members)
     return CORBA.Any
     renames CosNaming.NamingContext.Helper.To_Any;

   function From_Any
     (Item : CORBA.Any)
     return CosNaming.NamingContextExt.InvalidName_Members
     renames CosNaming.NamingContext.Helper.From_Any;

   function To_Any
     (Item : CosNaming.NamingContextExt.InvalidName_Members)
     return CORBA.Any
     renames CosNaming.NamingContext.Helper.To_Any;

   function From_Any
     (Item : CORBA.Any)
     return CosNaming.NamingContextExt.AlreadyBound_Members
     renames CosNaming.NamingContext.Helper.From_Any;

   function To_Any
     (Item : CosNaming.NamingContextExt.AlreadyBound_Members)
     return CORBA.Any
     renames CosNaming.NamingContext.Helper.To_Any;

   function From_Any
     (Item : CORBA.Any)
     return CosNaming.NamingContextExt.NotEmpty_Members
     renames CosNaming.NamingContext.Helper.From_Any;

   function To_Any
     (Item : CosNaming.NamingContextExt.NotEmpty_Members)
     return CORBA.Any
     renames CosNaming.NamingContext.Helper.To_Any;

   -----------------------------
   -- Deferred_Initialization --
   -----------------------------

   procedure Deferred_Initialization is
   begin
      CosNaming.NamingContextExt.Helper.Internals.Initialize_NamingContextExt;
      CosNaming.NamingContextExt.Helper.Internals.Initialize_StringName;
      CosNaming.NamingContextExt.Helper.Internals.Initialize_Address;
      CosNaming.NamingContextExt.Helper.Internals.Initialize_URLString;
      CosNaming.NamingContextExt.Helper.Internals.Initialize_InvalidAddress;
   end Deferred_Initialization;

begin
   declare
      use PolyORB.Utils.Strings;
      use PolyORB.Utils.Strings.Lists;
   begin
      PolyORB.Initialization.Register_Module
        (PolyORB.Initialization.Module_Info'
           (Name => +"CosNaming.NamingContextExt.Helper",
            Conflicts => PolyORB.Utils.Strings.Lists.Empty,
            Depends => +"any"
               & "corba"
               & "exceptions",
            Provides => PolyORB.Utils.Strings.Lists.Empty,
            Implicit => False,
            Init => Deferred_Initialization'Access,
            Shutdown => null));
   end;
end CosNaming.NamingContextExt.Helper;
