pragma Style_Checks ("NM32766");

---------------------------------------------------
--  This file has been generated automatically from
--  /work/a/ports/net/polyorb/work/polyorb-2.9.0/idls/CORBA_IDL/orb.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 CORBA.Repository_Root.Helper;
with CORBA.Repository_Root;
with Ada.Unchecked_Conversion;
with Ada.Unchecked_Deallocation;
with CORBA.Helper;
with CORBA.Object.Helper;
with CORBA.Repository_Root.Container.Helper;
with PolyORB.Utils.Strings;
with PolyORB.Utils.Strings.Lists;
with PolyORB.Initialization;

package body CORBA.Repository_Root.InterfaceDef.Helper is

   
   package body Internals is

      InterfaceDef_Initialized : PolyORB.Std.Boolean :=
        False;

      -----------------------------
      -- Initialize_InterfaceDef --
      -----------------------------

      procedure Initialize_InterfaceDef is
         Name_Ü : constant CORBA.String :=
           CORBA.To_CORBA_String
              ("InterfaceDef");
         Id_Ü : constant CORBA.String :=
           CORBA.To_CORBA_String
              ("IDL:omg.org/CORBA/InterfaceDef:1.0");
      begin
         if not InterfaceDef_Initialized
         then
            InterfaceDef_Initialized :=
              True;
            CORBA.Repository_Root.InterfaceDef.Helper.TC_InterfaceDef :=
              CORBA.TypeCode.Internals.To_CORBA_Object
                 (PolyORB.Any.TypeCode.Tcf_Object);
            CORBA.Internals.Add_Parameter
              (TC_InterfaceDef,
               CORBA.To_Any
                 (Name_Ü));
            CORBA.Internals.Add_Parameter
              (TC_InterfaceDef,
               CORBA.To_Any
                 (Id_Ü));
            CORBA.TypeCode.Internals.Disable_Reference_Counting
              (CORBA.Repository_Root.InterfaceDef.Helper.TC_InterfaceDef);
         end if;
      end Initialize_InterfaceDef;

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

      function Get_Aggregate_Element
        (Acc : not null access Content_Ü_FullInterfaceDescription;
         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);
      begin
         Mech.all :=
           PolyORB.Any.By_Reference;
         case Index is
            when 0 =>
               return CORBA.Wrap
                 (CORBA.String
                    (Acc.V.name)'Unrestricted_Access);
            when 1 =>
               return CORBA.Wrap
                 (CORBA.String
                    (Acc.V.id)'Unrestricted_Access);
            when 2 =>
               return CORBA.Wrap
                 (CORBA.String
                    (Acc.V.defined_in)'Unrestricted_Access);
            when 3 =>
               return CORBA.Wrap
                 (CORBA.String
                    (Acc.V.version)'Unrestricted_Access);
            when 4 =>
               return CORBA.Repository_Root.Helper.Internals.Wrap
                 (CORBA.Repository_Root.IDL_SEQUENCE_CORBA_OperationDescription.Sequence
                    (Acc.V.operations)'Unrestricted_Access);
            when 5 =>
               return CORBA.Repository_Root.Helper.Internals.Wrap
                 (CORBA.Repository_Root.IDL_SEQUENCE_CORBA_AttributeDescription.Sequence
                    (Acc.V.attributes)'Unrestricted_Access);
            when 6 =>
               return CORBA.Repository_Root.Helper.Internals.Wrap
                 (CORBA.Repository_Root.IDL_SEQUENCE_CORBA_RepositoryId.Sequence
                    (Acc.V.base_interfaces)'Unrestricted_Access);
            when 7 =>
               return CORBA.Wrap
                 (Acc.V.IDL_type'Unrestricted_Access);
            when 8 =>
               return CORBA.Wrap
                 (Acc.V.is_abstract'Unrestricted_Access);
            pragma Warnings (Off);
            when others =>
               raise Constraint_Error;
            pragma Warnings (On);

         end case;
      end Get_Aggregate_Element;

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

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

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

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

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

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

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

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

      function Clone
        (Acc : Content_Ü_FullInterfaceDescription;
         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_Ü_FullInterfaceDescription)
            then
               return null;
            end if;
            Target :=
              Into;
            Content_Ü_FullInterfaceDescription
              (Target.all).V.all :=
              Acc.V.all;
         else
            Target :=
              new Content_Ü_FullInterfaceDescription;
            Content_Ü_FullInterfaceDescription
              (Target.all).V :=
              new CORBA.Repository_Root.InterfaceDef.FullInterfaceDescription'
                 (Acc.V.all);
         end if;
         return Target;
      end Clone;

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

      procedure Finalize_Value
        (Acc : in out Content_Ü_FullInterfaceDescription)
      is
         procedure Free
           is new Ada.Unchecked_Deallocation
              (CORBA.Repository_Root.InterfaceDef.FullInterfaceDescription,
               Ptr_Ü_FullInterfaceDescription);

      begin
         Free
           (Acc.V);
      end Finalize_Value;

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

      function Wrap
        (X : access CORBA.Repository_Root.InterfaceDef.FullInterfaceDescription)
        return PolyORB.Any.Content'Class
      is
      begin
         return Content_Ü_FullInterfaceDescription'
           (PolyORB.Any.Aggregate_Content with
            V => Ptr_Ü_FullInterfaceDescription
              (X));
      end Wrap;

      FullInterfaceDescription_Initialized : PolyORB.Std.Boolean :=
        False;

      -----------------------------------------
      -- Initialize_FullInterfaceDescription --
      -----------------------------------------

      procedure Initialize_FullInterfaceDescription is
         Name_Ü : constant CORBA.String :=
           CORBA.To_CORBA_String
              ("FullInterfaceDescription");
         Id_Ü : constant CORBA.String :=
           CORBA.To_CORBA_String
              ("IDL:omg.org/CORBA/InterfaceDef/FullInterfaceDescription:1.0");
         Argument_Name_Ü_name : constant CORBA.String :=
           CORBA.To_CORBA_String
              ("name");
         Argument_Name_Ü_id : constant CORBA.String :=
           CORBA.To_CORBA_String
              ("id");
         Argument_Name_Ü_defined_in : constant CORBA.String :=
           CORBA.To_CORBA_String
              ("defined_in");
         Argument_Name_Ü_version : constant CORBA.String :=
           CORBA.To_CORBA_String
              ("version");
         Argument_Name_Ü_operations : constant CORBA.String :=
           CORBA.To_CORBA_String
              ("operations");
         Argument_Name_Ü_attributes : constant CORBA.String :=
           CORBA.To_CORBA_String
              ("attributes");
         Argument_Name_Ü_base_interfaces : constant CORBA.String :=
           CORBA.To_CORBA_String
              ("base_interfaces");
         Argument_Name_Ü_IDL_type : constant CORBA.String :=
           CORBA.To_CORBA_String
              ("IDL_type");
         Argument_Name_Ü_is_abstract : constant CORBA.String :=
           CORBA.To_CORBA_String
              ("is_abstract");
      begin
         if not FullInterfaceDescription_Initialized
         then
            FullInterfaceDescription_Initialized :=
              True;
            CORBA.Repository_Root.InterfaceDef.Helper.TC_FullInterfaceDescription :=
              CORBA.TypeCode.Internals.To_CORBA_Object
                 (PolyORB.Any.TypeCode.Tcf_Struct);
            CORBA.Internals.Add_Parameter
              (TC_FullInterfaceDescription,
               CORBA.To_Any
                 (Name_Ü));
            CORBA.Internals.Add_Parameter
              (TC_FullInterfaceDescription,
               CORBA.To_Any
                 (Id_Ü));
            CORBA.Internals.Add_Parameter
              (TC_FullInterfaceDescription,
               CORBA.To_Any
                 (CORBA.Helper.TC_Identifier));
            CORBA.Internals.Add_Parameter
              (TC_FullInterfaceDescription,
               CORBA.To_Any
                 (Argument_Name_Ü_name));
            CORBA.Internals.Add_Parameter
              (TC_FullInterfaceDescription,
               CORBA.To_Any
                 (CORBA.Helper.TC_RepositoryId));
            CORBA.Internals.Add_Parameter
              (TC_FullInterfaceDescription,
               CORBA.To_Any
                 (Argument_Name_Ü_id));
            CORBA.Internals.Add_Parameter
              (TC_FullInterfaceDescription,
               CORBA.To_Any
                 (CORBA.Helper.TC_RepositoryId));
            CORBA.Internals.Add_Parameter
              (TC_FullInterfaceDescription,
               CORBA.To_Any
                 (Argument_Name_Ü_defined_in));
            CORBA.Repository_Root.Helper.Internals.Initialize_VersionSpec;
            CORBA.Internals.Add_Parameter
              (TC_FullInterfaceDescription,
               CORBA.To_Any
                 (CORBA.Repository_Root.Helper.TC_VersionSpec));
            CORBA.Internals.Add_Parameter
              (TC_FullInterfaceDescription,
               CORBA.To_Any
                 (Argument_Name_Ü_version));
            CORBA.Repository_Root.Helper.Internals.Initialize_OpDescriptionSeq;
            CORBA.Internals.Add_Parameter
              (TC_FullInterfaceDescription,
               CORBA.To_Any
                 (CORBA.Repository_Root.Helper.TC_OpDescriptionSeq));
            CORBA.Internals.Add_Parameter
              (TC_FullInterfaceDescription,
               CORBA.To_Any
                 (Argument_Name_Ü_operations));
            CORBA.Repository_Root.Helper.Internals.Initialize_AttrDescriptionSeq;
            CORBA.Internals.Add_Parameter
              (TC_FullInterfaceDescription,
               CORBA.To_Any
                 (CORBA.Repository_Root.Helper.TC_AttrDescriptionSeq));
            CORBA.Internals.Add_Parameter
              (TC_FullInterfaceDescription,
               CORBA.To_Any
                 (Argument_Name_Ü_attributes));
            CORBA.Repository_Root.Helper.Internals.Initialize_RepositoryIdSeq;
            CORBA.Internals.Add_Parameter
              (TC_FullInterfaceDescription,
               CORBA.To_Any
                 (CORBA.Repository_Root.Helper.TC_RepositoryIdSeq));
            CORBA.Internals.Add_Parameter
              (TC_FullInterfaceDescription,
               CORBA.To_Any
                 (Argument_Name_Ü_base_interfaces));
            CORBA.Internals.Add_Parameter
              (TC_FullInterfaceDescription,
               CORBA.To_Any
                 (CORBA.TC_TypeCode));
            CORBA.Internals.Add_Parameter
              (TC_FullInterfaceDescription,
               CORBA.To_Any
                 (Argument_Name_Ü_IDL_type));
            CORBA.Internals.Add_Parameter
              (TC_FullInterfaceDescription,
               CORBA.To_Any
                 (CORBA.TC_Boolean));
            CORBA.Internals.Add_Parameter
              (TC_FullInterfaceDescription,
               CORBA.To_Any
                 (Argument_Name_Ü_is_abstract));
            CORBA.TypeCode.Internals.Disable_Reference_Counting
              (CORBA.Repository_Root.InterfaceDef.Helper.TC_FullInterfaceDescription);
         end if;
      end Initialize_FullInterfaceDescription;

   end Internals;

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

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

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

   function To_Any
     (Item : CORBA.Repository_Root.InterfaceDef.Ref)
     return CORBA.Any
   is
      A : CORBA.Any :=
        CORBA.Object.Helper.To_Any
           (CORBA.Object.Ref
              (Item));
   begin
      CORBA.Internals.Set_Type
        (A,
         TC_InterfaceDef);
      return A;
   end To_Any;

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

   function Unchecked_To_Ref
     (The_Ref : CORBA.Object.Ref'Class)
     return CORBA.Repository_Root.InterfaceDef.Ref
   is
      Result : CORBA.Repository_Root.InterfaceDef.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 CORBA.Repository_Root.InterfaceDef.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 CORBA.Repository_Root.InterfaceDef.FullInterfaceDescription
   is
   begin
      return (name => CORBA.Helper.From_Any
        (CORBA.Internals.Get_Aggregate_Element
           (Item,
            CORBA.Helper.TC_Identifier,
            0)),
      id => CORBA.Helper.From_Any
        (CORBA.Internals.Get_Aggregate_Element
           (Item,
            CORBA.Helper.TC_RepositoryId,
            1)),
      defined_in => CORBA.Helper.From_Any
        (CORBA.Internals.Get_Aggregate_Element
           (Item,
            CORBA.Helper.TC_RepositoryId,
            2)),
      version => CORBA.Repository_Root.Helper.From_Any
        (CORBA.Internals.Get_Aggregate_Element
           (Item,
            CORBA.Repository_Root.Helper.TC_VersionSpec,
            3)),
      operations => CORBA.Repository_Root.Helper.From_Any
        (CORBA.Internals.Get_Aggregate_Element
           (Item,
            CORBA.Repository_Root.Helper.TC_OpDescriptionSeq,
            4)),
      attributes => CORBA.Repository_Root.Helper.From_Any
        (CORBA.Internals.Get_Aggregate_Element
           (Item,
            CORBA.Repository_Root.Helper.TC_AttrDescriptionSeq,
            5)),
      base_interfaces => CORBA.Repository_Root.Helper.From_Any
        (CORBA.Internals.Get_Aggregate_Element
           (Item,
            CORBA.Repository_Root.Helper.TC_RepositoryIdSeq,
            6)),
      IDL_type => CORBA.From_Any
        (CORBA.Internals.Get_Aggregate_Element
           (Item,
            CORBA.TC_TypeCode,
            7)),
      is_abstract => CORBA.From_Any
        (CORBA.Internals.Get_Aggregate_Element
           (Item,
            CORBA.TC_Boolean,
            8)));
   end From_Any;

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

   function To_Any
     (Item : CORBA.Repository_Root.InterfaceDef.FullInterfaceDescription)
     return CORBA.Any
   is
      Result : CORBA.Any :=
        CORBA.Internals.Get_Empty_Any_Aggregate
           (TC_FullInterfaceDescription);
   begin
      CORBA.Internals.Add_Aggregate_Element
        (Result,
         CORBA.Helper.To_Any
           (Item.name));
      CORBA.Internals.Add_Aggregate_Element
        (Result,
         CORBA.Helper.To_Any
           (Item.id));
      CORBA.Internals.Add_Aggregate_Element
        (Result,
         CORBA.Helper.To_Any
           (Item.defined_in));
      CORBA.Internals.Add_Aggregate_Element
        (Result,
         CORBA.Repository_Root.Helper.To_Any
           (Item.version));
      CORBA.Internals.Add_Aggregate_Element
        (Result,
         CORBA.Repository_Root.Helper.To_Any
           (Item.operations));
      CORBA.Internals.Add_Aggregate_Element
        (Result,
         CORBA.Repository_Root.Helper.To_Any
           (Item.attributes));
      CORBA.Internals.Add_Aggregate_Element
        (Result,
         CORBA.Repository_Root.Helper.To_Any
           (Item.base_interfaces));
      CORBA.Internals.Add_Aggregate_Element
        (Result,
         CORBA.To_Any
           (Item.IDL_type));
      CORBA.Internals.Add_Aggregate_Element
        (Result,
         CORBA.To_Any
           (Item.is_abstract));
      return Result;
   end To_Any;

   function From_Any
     (Item : CORBA.Any)
     return CORBA.Repository_Root.InterfaceDef.Description
     renames CORBA.Repository_Root.Container.Helper.From_Any;

   function To_Any
     (Item : CORBA.Repository_Root.InterfaceDef.Description)
     return CORBA.Any
     renames CORBA.Repository_Root.Container.Helper.To_Any;

   function From_Any
     (Item : CORBA.Any)
     return CORBA.Repository_Root.InterfaceDef.DescriptionSeq
     renames CORBA.Repository_Root.Container.Helper.From_Any;

   function To_Any
     (Item : CORBA.Repository_Root.InterfaceDef.DescriptionSeq)
     return CORBA.Any
     renames CORBA.Repository_Root.Container.Helper.To_Any;

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

   procedure Deferred_Initialization is
   begin
      CORBA.Repository_Root.InterfaceDef.Helper.Internals.Initialize_InterfaceDef;
      CORBA.Repository_Root.InterfaceDef.Helper.Internals.Initialize_FullInterfaceDescription;
   end Deferred_Initialization;

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