pragma Style_Checks ("NM32766");

---------------------------------------------------
--  This file has been generated automatically from
--  /wrkdirs/usr/ports/net/polyorb/work/polyorb-2.9.0/idls/cos/naming/CosNaming.idl
--  by IAC (IDL to Ada Compiler) 2.9.0 (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 Ada.Unchecked_Conversion;
with Ada.Unchecked_Deallocation;
with PolyORB.Exceptions;
with CosNaming.Helper;
with CORBA.Object.Helper;
with PolyORB.Utils.Strings;
with PolyORB.Utils.Strings.Lists;
with PolyORB.Initialization;

package body CosNaming.NamingContext.Helper is

   
   package body Internals is

      NamingContext_Initialized : PolyORB.Std.Boolean :=
        False;

      ------------------------------
      -- Initialize_NamingContext --
      ------------------------------

      procedure Initialize_NamingContext is
         Name_Ü : constant CORBA.String :=
           CORBA.To_CORBA_String
              ("NamingContext");
         Id_Ü : constant CORBA.String :=
           CORBA.To_CORBA_String
              ("IDL:omg.org/CosNaming/NamingContext:1.0");
      begin
         if not NamingContext_Initialized
         then
            NamingContext_Initialized :=
              True;
            CosNaming.NamingContext.Helper.TC_NamingContext :=
              CORBA.TypeCode.Internals.To_CORBA_Object
                 (PolyORB.Any.TypeCode.Tcf_Object);
            CORBA.Internals.Add_Parameter
              (TC_NamingContext,
               CORBA.To_Any
                 (Name_Ü));
            CORBA.Internals.Add_Parameter
              (TC_NamingContext,
               CORBA.To_Any
                 (Id_Ü));
            CORBA.TypeCode.Internals.Disable_Reference_Counting
              (CosNaming.NamingContext.Helper.TC_NamingContext);
         end if;
      end Initialize_NamingContext;

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

      function From_Any
        (C : PolyORB.Any.Any_Container'Class)
        return CosNaming.NamingContext.NotFoundReason
      is
      begin
         return CosNaming.NamingContext.NotFoundReason'Val
           (PolyORB.Types.Unsigned_Long'
              (PolyORB.Any.Get_Aggregate_Element
                 (C,
                  0)));
      end From_Any;

      ---------------------------
      -- Get_Aggregate_Element --
      ---------------------------

      function Get_Aggregate_Element
        (Acc : not null access Content_Ü_NotFoundReason;
         Tc : PolyORB.Any.TypeCode.Object_Ptr;
         Index : PolyORB.Types.Unsigned_Long;
         Mech : not null access PolyORB.Any.Mechanism)
        return PolyORB.Any.Content'Class
      is
         use type PolyORB.Types.Unsigned_Long;
         use type PolyORB.Any.Mechanism;
         pragma Suppress (Validity_Check);
         pragma Unreferenced (Tc, Index);
      begin
         Acc.Repr_Cache :=
           CosNaming.NamingContext.NotFoundReason'Pos
              (Acc.V.all);
         Mech.all :=
           PolyORB.Any.By_Value;
         return PolyORB.Any.Wrap
           (Acc.Repr_Cache'Unrestricted_Access);
      end Get_Aggregate_Element;

      ---------------------------
      -- Set_Aggregate_Element --
      ---------------------------

      procedure Set_Aggregate_Element
        (Acc : in out Content_Ü_NotFoundReason;
         Tc : PolyORB.Any.TypeCode.Object_Ptr;
         Index : PolyORB.Types.Unsigned_Long;
         From_C : in out PolyORB.Any.Any_Container'Class)
      is
         use type PolyORB.Types.Unsigned_Long;
         pragma Assert ((Index
            = 0));
         pragma Unreferenced (Tc);
      begin
         Acc.V.all :=
           CosNaming.NamingContext.NotFoundReason'Val
              (PolyORB.Types.Unsigned_Long'
                 (PolyORB.Any.From_Any
                    (From_C)));
      end Set_Aggregate_Element;

      -------------------------
      -- Get_Aggregate_Count --
      -------------------------

      function Get_Aggregate_Count
        (Acc : Content_Ü_NotFoundReason)
        return PolyORB.Types.Unsigned_Long
      is
         pragma Unreferenced (Acc);
      begin
         return 1;
      end Get_Aggregate_Count;

      -------------------------
      -- Set_Aggregate_Count --
      -------------------------

      procedure Set_Aggregate_Count
        (Acc : in out Content_Ü_NotFoundReason;
         Count : PolyORB.Types.Unsigned_Long)
      is
      begin
         null;
      end Set_Aggregate_Count;

      ---------------------
      -- Unchecked_Get_V --
      ---------------------

      function Unchecked_Get_V
        (Acc : not null access Content_Ü_NotFoundReason)
        return PolyORB.Types.Address
      is
         function To_Address
           is new Ada.Unchecked_Conversion
              (Ptr_Ü_NotFoundReason,
               PolyORB.Types.Address);

      begin
         return To_Address
           (Acc.V);
      end Unchecked_Get_V;

      -----------
      -- Clone --
      -----------

      function Clone
        (Acc : Content_Ü_NotFoundReason;
         Into : PolyORB.Any.Content_Ptr := null)
        return PolyORB.Any.Content_Ptr
      is
         use type PolyORB.Any.Content_Ptr;
         Target : PolyORB.Any.Content_Ptr;
      begin
         if (Into
            /= null)
         then
            if (Into.all
               not in Content_Ü_NotFoundReason)
            then
               return null;
            end if;
            Target :=
              Into;
            Content_Ü_NotFoundReason
              (Target.all).V.all :=
              Acc.V.all;
         else
            Target :=
              new Content_Ü_NotFoundReason;
            Content_Ü_NotFoundReason
              (Target.all).V :=
              new CosNaming.NamingContext.NotFoundReason'
                 (Acc.V.all);
         end if;
         Content_Ü_NotFoundReason
           (Target.all).Repr_Cache :=
           Acc.Repr_Cache;
         return Target;
      end Clone;

      --------------------
      -- Finalize_Value --
      --------------------

      procedure Finalize_Value
        (Acc : in out Content_Ü_NotFoundReason)
      is
         procedure Free
           is new Ada.Unchecked_Deallocation
              (CosNaming.NamingContext.NotFoundReason,
               Ptr_Ü_NotFoundReason);

      begin
         Free
           (Acc.V);
      end Finalize_Value;

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

      function Wrap
        (X : access CosNaming.NamingContext.NotFoundReason)
        return PolyORB.Any.Content'Class
      is
      begin
         return Content_Ü_NotFoundReason'
           (PolyORB.Any.Aggregate_Content with
            V => Ptr_Ü_NotFoundReason
              (X),
            Repr_Cache => 0);
      end Wrap;

      NotFoundReason_Initialized : PolyORB.Std.Boolean :=
        False;

      -------------------------------
      -- Initialize_NotFoundReason --
      -------------------------------

      procedure Initialize_NotFoundReason is
         Name_Ü : constant CORBA.String :=
           CORBA.To_CORBA_String
              ("NotFoundReason");
         Id_Ü : constant CORBA.String :=
           CORBA.To_CORBA_String
              ("IDL:omg.org/CosNaming/NamingContext/NotFoundReason:1.0");
         missing_node_Name_Ü : constant CORBA.String :=
           CORBA.To_CORBA_String
              ("missing_node");
         not_context_Name_Ü : constant CORBA.String :=
           CORBA.To_CORBA_String
              ("not_context");
         not_object_Name_Ü : constant CORBA.String :=
           CORBA.To_CORBA_String
              ("not_object");
      begin
         if not NotFoundReason_Initialized
         then
            NotFoundReason_Initialized :=
              True;
            CosNaming.NamingContext.Helper.TC_NotFoundReason :=
              CORBA.TypeCode.Internals.To_CORBA_Object
                 (PolyORB.Any.TypeCode.Tcf_Enum);
            CORBA.Internals.Add_Parameter
              (TC_NotFoundReason,
               CORBA.To_Any
                 (Name_Ü));
            CORBA.Internals.Add_Parameter
              (TC_NotFoundReason,
               CORBA.To_Any
                 (Id_Ü));
            CORBA.Internals.Add_Parameter
              (TC_NotFoundReason,
               CORBA.To_Any
                 (missing_node_Name_Ü));
            CORBA.Internals.Add_Parameter
              (TC_NotFoundReason,
               CORBA.To_Any
                 (not_context_Name_Ü));
            CORBA.Internals.Add_Parameter
              (TC_NotFoundReason,
               CORBA.To_Any
                 (not_object_Name_Ü));
            CORBA.TypeCode.Internals.Disable_Reference_Counting
              (CosNaming.NamingContext.Helper.TC_NotFoundReason);
         end if;
      end Initialize_NotFoundReason;

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

      pragma No_Return (Raise_NotFound_From_Any);

      -----------------------------
      -- Raise_NotFound_From_Any --
      -----------------------------

      procedure Raise_NotFound_From_Any
        (Item : PolyORB.Any.Any;
         Message : PolyORB.Std.String)
      is
         Members : constant CosNaming.NamingContext.NotFound_Members :=
           CosNaming.NamingContext.Helper.From_Any
              (CORBA.Any
                 (Item));
      begin
         PolyORB.Exceptions.User_Raise_Exception
           (NotFound'Identity,
            Members,
            Message);
      end Raise_NotFound_From_Any;

      NotFound_Initialized : PolyORB.Std.Boolean :=
        False;

      -------------------------
      -- Initialize_NotFound --
      -------------------------

      procedure Initialize_NotFound is
         Name_Ü : constant CORBA.String :=
           CORBA.To_CORBA_String
              ("NotFound_Members");
         Id_Ü : constant CORBA.String :=
           CORBA.To_CORBA_String
              ("IDL:omg.org/CosNaming/NamingContext/NotFound:1.0");
         Arg_Name_why : constant CORBA.String :=
           CORBA.To_CORBA_String
              ("why");
         Arg_Name_rest_of_name : constant CORBA.String :=
           CORBA.To_CORBA_String
              ("rest_of_name");
      begin
         if not NotFound_Initialized
         then
            NotFound_Initialized :=
              True;
            CosNaming.NamingContext.Helper.TC_NotFound :=
              CORBA.TypeCode.Internals.To_CORBA_Object
                 (PolyORB.Any.TypeCode.Tcf_Except);
            CORBA.Internals.Add_Parameter
              (TC_NotFound,
               CORBA.To_Any
                 (Name_Ü));
            CORBA.Internals.Add_Parameter
              (TC_NotFound,
               CORBA.To_Any
                 (Id_Ü));
            CosNaming.NamingContext.Helper.Internals.Initialize_NotFoundReason;
            CORBA.Internals.Add_Parameter
              (TC_NotFound,
               CORBA.To_Any
                 (CosNaming.NamingContext.Helper.TC_NotFoundReason));
            CORBA.Internals.Add_Parameter
              (TC_NotFound,
               CORBA.To_Any
                 (Arg_Name_why));
            CosNaming.Helper.Internals.Initialize_Name;
            CORBA.Internals.Add_Parameter
              (TC_NotFound,
               CORBA.To_Any
                 (CosNaming.Helper.TC_Name));
            CORBA.Internals.Add_Parameter
              (TC_NotFound,
               CORBA.To_Any
                 (Arg_Name_rest_of_name));
            PolyORB.Exceptions.Register_Exception
              (CORBA.TypeCode.Internals.To_PolyORB_Object
                 (TC_NotFound),
               Raise_NotFound_From_Any'Access);
            CORBA.TypeCode.Internals.Disable_Reference_Counting
              (CosNaming.NamingContext.Helper.TC_NotFound);
         end if;
      end Initialize_NotFound;

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

      pragma No_Return (Raise_CannotProceed_From_Any);

      ----------------------------------
      -- Raise_CannotProceed_From_Any --
      ----------------------------------

      procedure Raise_CannotProceed_From_Any
        (Item : PolyORB.Any.Any;
         Message : PolyORB.Std.String)
      is
         Members : constant CosNaming.NamingContext.CannotProceed_Members :=
           CosNaming.NamingContext.Helper.From_Any
              (CORBA.Any
                 (Item));
      begin
         PolyORB.Exceptions.User_Raise_Exception
           (CannotProceed'Identity,
            Members,
            Message);
      end Raise_CannotProceed_From_Any;

      CannotProceed_Initialized : PolyORB.Std.Boolean :=
        False;

      ------------------------------
      -- Initialize_CannotProceed --
      ------------------------------

      procedure Initialize_CannotProceed is
         Name_Ü : constant CORBA.String :=
           CORBA.To_CORBA_String
              ("CannotProceed_Members");
         Id_Ü : constant CORBA.String :=
           CORBA.To_CORBA_String
              ("IDL:omg.org/CosNaming/NamingContext/CannotProceed:1.0");
         Arg_Name_cxt : constant CORBA.String :=
           CORBA.To_CORBA_String
              ("cxt");
         Arg_Name_rest_of_name : constant CORBA.String :=
           CORBA.To_CORBA_String
              ("rest_of_name");
      begin
         if not CannotProceed_Initialized
         then
            CannotProceed_Initialized :=
              True;
            CosNaming.NamingContext.Helper.TC_CannotProceed :=
              CORBA.TypeCode.Internals.To_CORBA_Object
                 (PolyORB.Any.TypeCode.Tcf_Except);
            CORBA.Internals.Add_Parameter
              (TC_CannotProceed,
               CORBA.To_Any
                 (Name_Ü));
            CORBA.Internals.Add_Parameter
              (TC_CannotProceed,
               CORBA.To_Any
                 (Id_Ü));
            CosNaming.NamingContext.Helper.Internals.Initialize_NamingContext;
            CORBA.Internals.Add_Parameter
              (TC_CannotProceed,
               CORBA.To_Any
                 (CosNaming.NamingContext.Helper.TC_NamingContext));
            CORBA.Internals.Add_Parameter
              (TC_CannotProceed,
               CORBA.To_Any
                 (Arg_Name_cxt));
            CosNaming.Helper.Internals.Initialize_Name;
            CORBA.Internals.Add_Parameter
              (TC_CannotProceed,
               CORBA.To_Any
                 (CosNaming.Helper.TC_Name));
            CORBA.Internals.Add_Parameter
              (TC_CannotProceed,
               CORBA.To_Any
                 (Arg_Name_rest_of_name));
            PolyORB.Exceptions.Register_Exception
              (CORBA.TypeCode.Internals.To_PolyORB_Object
                 (TC_CannotProceed),
               Raise_CannotProceed_From_Any'Access);
            CORBA.TypeCode.Internals.Disable_Reference_Counting
              (CosNaming.NamingContext.Helper.TC_CannotProceed);
         end if;
      end Initialize_CannotProceed;

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

      pragma No_Return (Raise_InvalidName_From_Any);

      --------------------------------
      -- Raise_InvalidName_From_Any --
      --------------------------------

      procedure Raise_InvalidName_From_Any
        (Item : PolyORB.Any.Any;
         Message : PolyORB.Std.String)
      is
         Members : constant CosNaming.NamingContext.InvalidName_Members :=
           CosNaming.NamingContext.Helper.From_Any
              (CORBA.Any
                 (Item));
      begin
         PolyORB.Exceptions.User_Raise_Exception
           (InvalidName'Identity,
            Members,
            Message);
      end Raise_InvalidName_From_Any;

      InvalidName_Initialized : PolyORB.Std.Boolean :=
        False;

      ----------------------------
      -- Initialize_InvalidName --
      ----------------------------

      procedure Initialize_InvalidName is
         Name_Ü : constant CORBA.String :=
           CORBA.To_CORBA_String
              ("InvalidName_Members");
         Id_Ü : constant CORBA.String :=
           CORBA.To_CORBA_String
              ("IDL:omg.org/CosNaming/NamingContext/InvalidName:1.0");
      begin
         if not InvalidName_Initialized
         then
            InvalidName_Initialized :=
              True;
            CosNaming.NamingContext.Helper.TC_InvalidName :=
              CORBA.TypeCode.Internals.To_CORBA_Object
                 (PolyORB.Any.TypeCode.Tcf_Except);
            CORBA.Internals.Add_Parameter
              (TC_InvalidName,
               CORBA.To_Any
                 (Name_Ü));
            CORBA.Internals.Add_Parameter
              (TC_InvalidName,
               CORBA.To_Any
                 (Id_Ü));
            PolyORB.Exceptions.Register_Exception
              (CORBA.TypeCode.Internals.To_PolyORB_Object
                 (TC_InvalidName),
               Raise_InvalidName_From_Any'Access);
            CORBA.TypeCode.Internals.Disable_Reference_Counting
              (CosNaming.NamingContext.Helper.TC_InvalidName);
         end if;
      end Initialize_InvalidName;

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

      pragma No_Return (Raise_AlreadyBound_From_Any);

      ---------------------------------
      -- Raise_AlreadyBound_From_Any --
      ---------------------------------

      procedure Raise_AlreadyBound_From_Any
        (Item : PolyORB.Any.Any;
         Message : PolyORB.Std.String)
      is
         Members : constant CosNaming.NamingContext.AlreadyBound_Members :=
           CosNaming.NamingContext.Helper.From_Any
              (CORBA.Any
                 (Item));
      begin
         PolyORB.Exceptions.User_Raise_Exception
           (AlreadyBound'Identity,
            Members,
            Message);
      end Raise_AlreadyBound_From_Any;

      AlreadyBound_Initialized : PolyORB.Std.Boolean :=
        False;

      -----------------------------
      -- Initialize_AlreadyBound --
      -----------------------------

      procedure Initialize_AlreadyBound is
         Name_Ü : constant CORBA.String :=
           CORBA.To_CORBA_String
              ("AlreadyBound_Members");
         Id_Ü : constant CORBA.String :=
           CORBA.To_CORBA_String
              ("IDL:omg.org/CosNaming/NamingContext/AlreadyBound:1.0");
      begin
         if not AlreadyBound_Initialized
         then
            AlreadyBound_Initialized :=
              True;
            CosNaming.NamingContext.Helper.TC_AlreadyBound :=
              CORBA.TypeCode.Internals.To_CORBA_Object
                 (PolyORB.Any.TypeCode.Tcf_Except);
            CORBA.Internals.Add_Parameter
              (TC_AlreadyBound,
               CORBA.To_Any
                 (Name_Ü));
            CORBA.Internals.Add_Parameter
              (TC_AlreadyBound,
               CORBA.To_Any
                 (Id_Ü));
            PolyORB.Exceptions.Register_Exception
              (CORBA.TypeCode.Internals.To_PolyORB_Object
                 (TC_AlreadyBound),
               Raise_AlreadyBound_From_Any'Access);
            CORBA.TypeCode.Internals.Disable_Reference_Counting
              (CosNaming.NamingContext.Helper.TC_AlreadyBound);
         end if;
      end Initialize_AlreadyBound;

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

      pragma No_Return (Raise_NotEmpty_From_Any);

      -----------------------------
      -- Raise_NotEmpty_From_Any --
      -----------------------------

      procedure Raise_NotEmpty_From_Any
        (Item : PolyORB.Any.Any;
         Message : PolyORB.Std.String)
      is
         Members : constant CosNaming.NamingContext.NotEmpty_Members :=
           CosNaming.NamingContext.Helper.From_Any
              (CORBA.Any
                 (Item));
      begin
         PolyORB.Exceptions.User_Raise_Exception
           (NotEmpty'Identity,
            Members,
            Message);
      end Raise_NotEmpty_From_Any;

      NotEmpty_Initialized : PolyORB.Std.Boolean :=
        False;

      -------------------------
      -- Initialize_NotEmpty --
      -------------------------

      procedure Initialize_NotEmpty is
         Name_Ü : constant CORBA.String :=
           CORBA.To_CORBA_String
              ("NotEmpty_Members");
         Id_Ü : constant CORBA.String :=
           CORBA.To_CORBA_String
              ("IDL:omg.org/CosNaming/NamingContext/NotEmpty:1.0");
      begin
         if not NotEmpty_Initialized
         then
            NotEmpty_Initialized :=
              True;
            CosNaming.NamingContext.Helper.TC_NotEmpty :=
              CORBA.TypeCode.Internals.To_CORBA_Object
                 (PolyORB.Any.TypeCode.Tcf_Except);
            CORBA.Internals.Add_Parameter
              (TC_NotEmpty,
               CORBA.To_Any
                 (Name_Ü));
            CORBA.Internals.Add_Parameter
              (TC_NotEmpty,
               CORBA.To_Any
                 (Id_Ü));
            PolyORB.Exceptions.Register_Exception
              (CORBA.TypeCode.Internals.To_PolyORB_Object
                 (TC_NotEmpty),
               Raise_NotEmpty_From_Any'Access);
            CORBA.TypeCode.Internals.Disable_Reference_Counting
              (CosNaming.NamingContext.Helper.TC_NotEmpty);
         end if;
      end Initialize_NotEmpty;

   end Internals;

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

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

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

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

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

   function Unchecked_To_Ref
     (The_Ref : CORBA.Object.Ref'Class)
     return CosNaming.NamingContext.Ref
   is
      Result : CosNaming.NamingContext.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.NamingContext.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.NamingContext.NotFoundReason
   is
   begin
      return CosNaming.NamingContext.Helper.Internals.From_Any
        (CORBA.Get_Container
           (Item).all);
   end From_Any;

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

   function To_Any
     (Item : CosNaming.NamingContext.NotFoundReason)
     return CORBA.Any
   is
      Result : CORBA.Any :=
        CORBA.Internals.Get_Empty_Any_Aggregate
           (TC_NotFoundReason);
   begin
      CORBA.Internals.Add_Aggregate_Element
        (Result,
         CORBA.To_Any
           (CORBA.Unsigned_Long
              (CosNaming.NamingContext.NotFoundReason'Pos
                 (Item))));
      return Result;
   end To_Any;

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

   function From_Any
     (Item : CORBA.Any)
     return CosNaming.NamingContext.NotFound_Members
   is
   begin
      return (why => CosNaming.NamingContext.Helper.From_Any
        (CORBA.Internals.Get_Aggregate_Element
           (Item,
            CosNaming.NamingContext.Helper.TC_NotFoundReason,
            0)),
      rest_of_name => CosNaming.Helper.From_Any
        (CORBA.Internals.Get_Aggregate_Element
           (Item,
            CosNaming.Helper.TC_Name,
            1)));
   end From_Any;

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

   function To_Any
     (Item : CosNaming.NamingContext.NotFound_Members)
     return CORBA.Any
   is
      Result_Ü : CORBA.Any :=
        CORBA.Internals.Get_Empty_Any_Aggregate
           (CosNaming.NamingContext.Helper.TC_NotFound);
   begin
      CORBA.Internals.Add_Aggregate_Element
        (Result_Ü,
         CosNaming.NamingContext.Helper.To_Any
           (Item.why));
      CORBA.Internals.Add_Aggregate_Element
        (Result_Ü,
         CosNaming.Helper.To_Any
           (Item.rest_of_name));
      return Result_Ü;
   end To_Any;

   --------------------
   -- Raise_NotFound --
   --------------------

   procedure Raise_NotFound
     (Members : CosNaming.NamingContext.NotFound_Members)
   is
   begin
      PolyORB.Exceptions.User_Raise_Exception
        (NotFound'Identity,
         Members);
   end Raise_NotFound;

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

   function From_Any
     (Item : CORBA.Any)
     return CosNaming.NamingContext.CannotProceed_Members
   is
   begin
      return (cxt => CosNaming.NamingContext.Helper.From_Any
        (CORBA.Internals.Get_Aggregate_Element
           (Item,
            CosNaming.NamingContext.Helper.TC_NamingContext,
            0)),
      rest_of_name => CosNaming.Helper.From_Any
        (CORBA.Internals.Get_Aggregate_Element
           (Item,
            CosNaming.Helper.TC_Name,
            1)));
   end From_Any;

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

   function To_Any
     (Item : CosNaming.NamingContext.CannotProceed_Members)
     return CORBA.Any
   is
      Result_Ü : CORBA.Any :=
        CORBA.Internals.Get_Empty_Any_Aggregate
           (CosNaming.NamingContext.Helper.TC_CannotProceed);
   begin
      CORBA.Internals.Add_Aggregate_Element
        (Result_Ü,
         CosNaming.NamingContext.Helper.To_Any
           (Item.cxt));
      CORBA.Internals.Add_Aggregate_Element
        (Result_Ü,
         CosNaming.Helper.To_Any
           (Item.rest_of_name));
      return Result_Ü;
   end To_Any;

   -------------------------
   -- Raise_CannotProceed --
   -------------------------

   procedure Raise_CannotProceed
     (Members : CosNaming.NamingContext.CannotProceed_Members)
   is
   begin
      PolyORB.Exceptions.User_Raise_Exception
        (CannotProceed'Identity,
         Members);
   end Raise_CannotProceed;

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

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

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

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

   -----------------------
   -- Raise_InvalidName --
   -----------------------

   procedure Raise_InvalidName
     (Members : CosNaming.NamingContext.InvalidName_Members)
   is
   begin
      PolyORB.Exceptions.User_Raise_Exception
        (InvalidName'Identity,
         Members);
   end Raise_InvalidName;

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

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

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

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

   ------------------------
   -- Raise_AlreadyBound --
   ------------------------

   procedure Raise_AlreadyBound
     (Members : CosNaming.NamingContext.AlreadyBound_Members)
   is
   begin
      PolyORB.Exceptions.User_Raise_Exception
        (AlreadyBound'Identity,
         Members);
   end Raise_AlreadyBound;

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

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

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

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

   --------------------
   -- Raise_NotEmpty --
   --------------------

   procedure Raise_NotEmpty
     (Members : CosNaming.NamingContext.NotEmpty_Members)
   is
   begin
      PolyORB.Exceptions.User_Raise_Exception
        (NotEmpty'Identity,
         Members);
   end Raise_NotEmpty;

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

   procedure Deferred_Initialization is
   begin
      CosNaming.NamingContext.Helper.Internals.Initialize_NamingContext;
      CosNaming.NamingContext.Helper.Internals.Initialize_NotFoundReason;
      CosNaming.NamingContext.Helper.Internals.Initialize_NotFound;
      CosNaming.NamingContext.Helper.Internals.Initialize_CannotProceed;
      CosNaming.NamingContext.Helper.Internals.Initialize_InvalidName;
      CosNaming.NamingContext.Helper.Internals.Initialize_AlreadyBound;
      CosNaming.NamingContext.Helper.Internals.Initialize_NotEmpty;
   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.NamingContext.Helper",
            Conflicts => PolyORB.Utils.Strings.Lists.Empty,
            Depends => +"any"
               & "exceptions",
            Provides => PolyORB.Utils.Strings.Lists.Empty,
            Implicit => False,
            Init => Deferred_Initialization'Access,
            Shutdown => null));
   end;
end CosNaming.NamingContext.Helper;
