pragma Style_Checks ("NM32766");

---------------------------------------------------
--  This file has been generated automatically from
--  /wrkdirs/usr/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 PolyORB.Utils.Strings;
with PolyORB.Utils.Strings.Lists;
with PolyORB.Initialization;

package body CORBA.Repository_Root.InterfaceAttrExtension.Helper is

   
   package body Internals is

      InterfaceAttrExtension_Initialized : PolyORB.Std.Boolean :=
        False;

      ---------------------------------------
      -- Initialize_InterfaceAttrExtension --
      ---------------------------------------

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

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

      function Get_Aggregate_Element
        (Acc : not null access Content_Ü_ExtFullInterfaceDescription;
         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_ExtAttributeDescription.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);
            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_Ü_ExtFullInterfaceDescription)
        return PolyORB.Types.Unsigned_Long
      is
         pragma Unreferenced (Acc);
      begin
         return 8;
      end Get_Aggregate_Count;

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

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

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

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

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

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

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

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

      procedure Finalize_Value
        (Acc : in out Content_Ü_ExtFullInterfaceDescription)
      is
         procedure Free
           is new Ada.Unchecked_Deallocation
              (CORBA.Repository_Root.InterfaceAttrExtension.ExtFullInterfaceDescription,
               Ptr_Ü_ExtFullInterfaceDescription);

      begin
         Free
           (Acc.V);
      end Finalize_Value;

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

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

      ExtFullInterfaceDescription_Initialized : PolyORB.Std.Boolean :=
        False;

      --------------------------------------------
      -- Initialize_ExtFullInterfaceDescription --
      --------------------------------------------

      procedure Initialize_ExtFullInterfaceDescription is
         Name_Ü : constant CORBA.String :=
           CORBA.To_CORBA_String
              ("ExtFullInterfaceDescription");
         Id_Ü : constant CORBA.String :=
           CORBA.To_CORBA_String
              ("IDL:omg.org/CORBA/InterfaceAttrExtension/ExtFullInterfaceDescription: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");
      begin
         if not ExtFullInterfaceDescription_Initialized
         then
            ExtFullInterfaceDescription_Initialized :=
              True;
            CORBA.Repository_Root.InterfaceAttrExtension.Helper.TC_ExtFullInterfaceDescription :=
              CORBA.TypeCode.Internals.To_CORBA_Object
                 (PolyORB.Any.TypeCode.Tcf_Struct);
            CORBA.Internals.Add_Parameter
              (TC_ExtFullInterfaceDescription,
               CORBA.To_Any
                 (Name_Ü));
            CORBA.Internals.Add_Parameter
              (TC_ExtFullInterfaceDescription,
               CORBA.To_Any
                 (Id_Ü));
            CORBA.Internals.Add_Parameter
              (TC_ExtFullInterfaceDescription,
               CORBA.To_Any
                 (CORBA.Helper.TC_Identifier));
            CORBA.Internals.Add_Parameter
              (TC_ExtFullInterfaceDescription,
               CORBA.To_Any
                 (Argument_Name_Ü_name));
            CORBA.Internals.Add_Parameter
              (TC_ExtFullInterfaceDescription,
               CORBA.To_Any
                 (CORBA.Helper.TC_RepositoryId));
            CORBA.Internals.Add_Parameter
              (TC_ExtFullInterfaceDescription,
               CORBA.To_Any
                 (Argument_Name_Ü_id));
            CORBA.Internals.Add_Parameter
              (TC_ExtFullInterfaceDescription,
               CORBA.To_Any
                 (CORBA.Helper.TC_RepositoryId));
            CORBA.Internals.Add_Parameter
              (TC_ExtFullInterfaceDescription,
               CORBA.To_Any
                 (Argument_Name_Ü_defined_in));
            CORBA.Repository_Root.Helper.Internals.Initialize_VersionSpec;
            CORBA.Internals.Add_Parameter
              (TC_ExtFullInterfaceDescription,
               CORBA.To_Any
                 (CORBA.Repository_Root.Helper.TC_VersionSpec));
            CORBA.Internals.Add_Parameter
              (TC_ExtFullInterfaceDescription,
               CORBA.To_Any
                 (Argument_Name_Ü_version));
            CORBA.Repository_Root.Helper.Internals.Initialize_OpDescriptionSeq;
            CORBA.Internals.Add_Parameter
              (TC_ExtFullInterfaceDescription,
               CORBA.To_Any
                 (CORBA.Repository_Root.Helper.TC_OpDescriptionSeq));
            CORBA.Internals.Add_Parameter
              (TC_ExtFullInterfaceDescription,
               CORBA.To_Any
                 (Argument_Name_Ü_operations));
            CORBA.Repository_Root.Helper.Internals.Initialize_ExtAttrDescriptionSeq;
            CORBA.Internals.Add_Parameter
              (TC_ExtFullInterfaceDescription,
               CORBA.To_Any
                 (CORBA.Repository_Root.Helper.TC_ExtAttrDescriptionSeq));
            CORBA.Internals.Add_Parameter
              (TC_ExtFullInterfaceDescription,
               CORBA.To_Any
                 (Argument_Name_Ü_attributes));
            CORBA.Repository_Root.Helper.Internals.Initialize_RepositoryIdSeq;
            CORBA.Internals.Add_Parameter
              (TC_ExtFullInterfaceDescription,
               CORBA.To_Any
                 (CORBA.Repository_Root.Helper.TC_RepositoryIdSeq));
            CORBA.Internals.Add_Parameter
              (TC_ExtFullInterfaceDescription,
               CORBA.To_Any
                 (Argument_Name_Ü_base_interfaces));
            CORBA.Internals.Add_Parameter
              (TC_ExtFullInterfaceDescription,
               CORBA.To_Any
                 (CORBA.TC_TypeCode));
            CORBA.Internals.Add_Parameter
              (TC_ExtFullInterfaceDescription,
               CORBA.To_Any
                 (Argument_Name_Ü_IDL_type));
            CORBA.TypeCode.Internals.Disable_Reference_Counting
              (CORBA.Repository_Root.InterfaceAttrExtension.Helper.TC_ExtFullInterfaceDescription);
         end if;
      end Initialize_ExtFullInterfaceDescription;

   end Internals;

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

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

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

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

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

   function Unchecked_To_Ref
     (The_Ref : CORBA.Object.Ref'Class)
     return CORBA.Repository_Root.InterfaceAttrExtension.Ref
   is
      Result : CORBA.Repository_Root.InterfaceAttrExtension.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.InterfaceAttrExtension.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.InterfaceAttrExtension.ExtFullInterfaceDescription
   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_ExtAttrDescriptionSeq,
            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)));
   end From_Any;

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

   function To_Any
     (Item : CORBA.Repository_Root.InterfaceAttrExtension.ExtFullInterfaceDescription)
     return CORBA.Any
   is
      Result : CORBA.Any :=
        CORBA.Internals.Get_Empty_Any_Aggregate
           (TC_ExtFullInterfaceDescription);
   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));
      return Result;
   end To_Any;

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

   procedure Deferred_Initialization is
   begin
      CORBA.Repository_Root.InterfaceAttrExtension.Helper.Internals.Initialize_InterfaceAttrExtension;
      CORBA.Repository_Root.InterfaceAttrExtension.Helper.Internals.Initialize_ExtFullInterfaceDescription;
   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.InterfaceAttrExtension.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.InterfaceAttrExtension.Helper;
