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/CORBA_IDL/orb.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 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.ValueDef.Helper is

   
   package body Internals is

      ValueDef_Initialized : PolyORB.Std.Boolean :=
        False;

      -------------------------
      -- Initialize_ValueDef --
      -------------------------

      procedure Initialize_ValueDef is
         Name_Ü : constant CORBA.String :=
           CORBA.To_CORBA_String
              ("ValueDef");
         Id_Ü : constant CORBA.String :=
           CORBA.To_CORBA_String
              ("IDL:omg.org/CORBA/ValueDef:1.0");
      begin
         if not ValueDef_Initialized
         then
            ValueDef_Initialized :=
              True;
            CORBA.Repository_Root.ValueDef.Helper.TC_ValueDef :=
              CORBA.TypeCode.Internals.To_CORBA_Object
                 (PolyORB.Any.TypeCode.Tcf_Object);
            CORBA.Internals.Add_Parameter
              (TC_ValueDef,
               CORBA.To_Any
                 (Name_Ü));
            CORBA.Internals.Add_Parameter
              (TC_ValueDef,
               CORBA.To_Any
                 (Id_Ü));
            CORBA.TypeCode.Internals.Disable_Ref_Counting
              (TC_ValueDef);
            CORBA.TypeCode.Internals.Freeze
              (TC_ValueDef);
         end if;
      end Initialize_ValueDef;

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

      function Get_Aggregate_Element
        (Acc : not null access Content_Ü_FullValueDescription;
         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.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
                 (Acc.V.is_abstract'Unrestricted_Access);
            when 3 =>
               return CORBA.Wrap
                 (Acc.V.is_custom'Unrestricted_Access);
            when 4 =>
               return CORBA.Wrap
                 (CORBA.String
                    (Acc.V.defined_in)'Unrestricted_Access);
            when 5 =>
               return CORBA.Wrap
                 (CORBA.String
                    (Acc.V.version)'Unrestricted_Access);
            when 6 =>
               return CORBA.Repository_Root.Helper.Internals.Wrap
                 (CORBA.Repository_Root.IDL_SEQUENCE_CORBA_OperationDescription.Sequence
                    (Acc.V.operations)'Unrestricted_Access);
            when 7 =>
               return CORBA.Repository_Root.Helper.Internals.Wrap
                 (CORBA.Repository_Root.IDL_SEQUENCE_CORBA_AttributeDescription.Sequence
                    (Acc.V.attributes)'Unrestricted_Access);
            when 8 =>
               return CORBA.Repository_Root.Helper.Internals.Wrap
                 (CORBA.Repository_Root.IDL_SEQUENCE_CORBA_ValueMember.Sequence
                    (Acc.V.members)'Unrestricted_Access);
            when 9 =>
               return CORBA.Repository_Root.Helper.Internals.Wrap
                 (CORBA.Repository_Root.IDL_SEQUENCE_CORBA_Initializer.Sequence
                    (Acc.V.initializers)'Unrestricted_Access);
            when 10 =>
               return CORBA.Repository_Root.Helper.Internals.Wrap
                 (CORBA.Repository_Root.IDL_SEQUENCE_CORBA_RepositoryId.Sequence
                    (Acc.V.supported_interfaces)'Unrestricted_Access);
            when 11 =>
               return CORBA.Repository_Root.Helper.Internals.Wrap
                 (CORBA.Repository_Root.IDL_SEQUENCE_CORBA_RepositoryId.Sequence
                    (Acc.V.abstract_base_values)'Unrestricted_Access);
            when 12 =>
               return CORBA.Wrap
                 (Acc.V.is_truncatable'Unrestricted_Access);
            when 13 =>
               return CORBA.Wrap
                 (CORBA.String
                    (Acc.V.base_value)'Unrestricted_Access);
            when 14 =>
               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_Ü_FullValueDescription)
        return PolyORB.Types.Unsigned_Long
      is
         pragma Unreferenced (Acc);
      begin
         return 15;
      end Get_Aggregate_Count;

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

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

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

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

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

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

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

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

      procedure Finalize_Value
        (Acc : in out Content_Ü_FullValueDescription)
      is
         procedure Free
           is new Ada.Unchecked_Deallocation
              (CORBA.Repository_Root.ValueDef.FullValueDescription,
               Ptr_Ü_FullValueDescription);

      begin
         Free
           (Acc.V);
      end Finalize_Value;

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

      function Wrap
        (X : access CORBA.Repository_Root.ValueDef.FullValueDescription)
        return PolyORB.Any.Content'Class
      is
      begin
         return Content_Ü_FullValueDescription'
           (PolyORB.Any.Aggregate_Content with
            V => Ptr_Ü_FullValueDescription'
              (X.all'Unchecked_Access));
      end Wrap;

      FullValueDescription_Initialized : PolyORB.Std.Boolean :=
        False;

      -------------------------------------
      -- Initialize_FullValueDescription --
      -------------------------------------

      procedure Initialize_FullValueDescription is
         Name_Ü : constant CORBA.String :=
           CORBA.To_CORBA_String
              ("FullValueDescription");
         Id_Ü : constant CORBA.String :=
           CORBA.To_CORBA_String
              ("IDL:omg.org/CORBA/ValueDef/FullValueDescription: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_Ü_is_abstract : constant CORBA.String :=
           CORBA.To_CORBA_String
              ("is_abstract");
         Argument_Name_Ü_is_custom : constant CORBA.String :=
           CORBA.To_CORBA_String
              ("is_custom");
         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_Ü_members : constant CORBA.String :=
           CORBA.To_CORBA_String
              ("members");
         Argument_Name_Ü_initializers : constant CORBA.String :=
           CORBA.To_CORBA_String
              ("initializers");
         Argument_Name_Ü_supported_interfaces : constant CORBA.String :=
           CORBA.To_CORBA_String
              ("supported_interfaces");
         Argument_Name_Ü_abstract_base_values : constant CORBA.String :=
           CORBA.To_CORBA_String
              ("abstract_base_values");
         Argument_Name_Ü_is_truncatable : constant CORBA.String :=
           CORBA.To_CORBA_String
              ("is_truncatable");
         Argument_Name_Ü_base_value : constant CORBA.String :=
           CORBA.To_CORBA_String
              ("base_value");
         Argument_Name_Ü_IDL_type : constant CORBA.String :=
           CORBA.To_CORBA_String
              ("IDL_type");
      begin
         if not FullValueDescription_Initialized
         then
            FullValueDescription_Initialized :=
              True;
            CORBA.Repository_Root.ValueDef.Helper.TC_FullValueDescription :=
              CORBA.TypeCode.Internals.To_CORBA_Object
                 (PolyORB.Any.TypeCode.Tcf_Struct);
            CORBA.Internals.Add_Parameter
              (TC_FullValueDescription,
               CORBA.To_Any
                 (Name_Ü));
            CORBA.Internals.Add_Parameter
              (TC_FullValueDescription,
               CORBA.To_Any
                 (Id_Ü));
            CORBA.Internals.Add_Parameter
              (TC_FullValueDescription,
               CORBA.To_Any
                 (CORBA.Helper.TC_Identifier));
            CORBA.Internals.Add_Parameter
              (TC_FullValueDescription,
               CORBA.To_Any
                 (Argument_Name_Ü_name));
            CORBA.Internals.Add_Parameter
              (TC_FullValueDescription,
               CORBA.To_Any
                 (CORBA.Helper.TC_RepositoryId));
            CORBA.Internals.Add_Parameter
              (TC_FullValueDescription,
               CORBA.To_Any
                 (Argument_Name_Ü_id));
            CORBA.Internals.Add_Parameter
              (TC_FullValueDescription,
               CORBA.To_Any
                 (CORBA.TC_Boolean));
            CORBA.Internals.Add_Parameter
              (TC_FullValueDescription,
               CORBA.To_Any
                 (Argument_Name_Ü_is_abstract));
            CORBA.Internals.Add_Parameter
              (TC_FullValueDescription,
               CORBA.To_Any
                 (CORBA.TC_Boolean));
            CORBA.Internals.Add_Parameter
              (TC_FullValueDescription,
               CORBA.To_Any
                 (Argument_Name_Ü_is_custom));
            CORBA.Internals.Add_Parameter
              (TC_FullValueDescription,
               CORBA.To_Any
                 (CORBA.Helper.TC_RepositoryId));
            CORBA.Internals.Add_Parameter
              (TC_FullValueDescription,
               CORBA.To_Any
                 (Argument_Name_Ü_defined_in));
            CORBA.Repository_Root.Helper.Internals.Initialize_VersionSpec;
            CORBA.Internals.Add_Parameter
              (TC_FullValueDescription,
               CORBA.To_Any
                 (CORBA.Repository_Root.Helper.TC_VersionSpec));
            CORBA.Internals.Add_Parameter
              (TC_FullValueDescription,
               CORBA.To_Any
                 (Argument_Name_Ü_version));
            CORBA.Repository_Root.Helper.Internals.Initialize_OpDescriptionSeq;
            CORBA.Internals.Add_Parameter
              (TC_FullValueDescription,
               CORBA.To_Any
                 (CORBA.Repository_Root.Helper.TC_OpDescriptionSeq));
            CORBA.Internals.Add_Parameter
              (TC_FullValueDescription,
               CORBA.To_Any
                 (Argument_Name_Ü_operations));
            CORBA.Repository_Root.Helper.Internals.Initialize_AttrDescriptionSeq;
            CORBA.Internals.Add_Parameter
              (TC_FullValueDescription,
               CORBA.To_Any
                 (CORBA.Repository_Root.Helper.TC_AttrDescriptionSeq));
            CORBA.Internals.Add_Parameter
              (TC_FullValueDescription,
               CORBA.To_Any
                 (Argument_Name_Ü_attributes));
            CORBA.Repository_Root.Helper.Internals.Initialize_ValueMemberSeq;
            CORBA.Internals.Add_Parameter
              (TC_FullValueDescription,
               CORBA.To_Any
                 (CORBA.Repository_Root.Helper.TC_ValueMemberSeq));
            CORBA.Internals.Add_Parameter
              (TC_FullValueDescription,
               CORBA.To_Any
                 (Argument_Name_Ü_members));
            CORBA.Repository_Root.Helper.Internals.Initialize_InitializerSeq;
            CORBA.Internals.Add_Parameter
              (TC_FullValueDescription,
               CORBA.To_Any
                 (CORBA.Repository_Root.Helper.TC_InitializerSeq));
            CORBA.Internals.Add_Parameter
              (TC_FullValueDescription,
               CORBA.To_Any
                 (Argument_Name_Ü_initializers));
            CORBA.Repository_Root.Helper.Internals.Initialize_RepositoryIdSeq;
            CORBA.Internals.Add_Parameter
              (TC_FullValueDescription,
               CORBA.To_Any
                 (CORBA.Repository_Root.Helper.TC_RepositoryIdSeq));
            CORBA.Internals.Add_Parameter
              (TC_FullValueDescription,
               CORBA.To_Any
                 (Argument_Name_Ü_supported_interfaces));
            CORBA.Repository_Root.Helper.Internals.Initialize_RepositoryIdSeq;
            CORBA.Internals.Add_Parameter
              (TC_FullValueDescription,
               CORBA.To_Any
                 (CORBA.Repository_Root.Helper.TC_RepositoryIdSeq));
            CORBA.Internals.Add_Parameter
              (TC_FullValueDescription,
               CORBA.To_Any
                 (Argument_Name_Ü_abstract_base_values));
            CORBA.Internals.Add_Parameter
              (TC_FullValueDescription,
               CORBA.To_Any
                 (CORBA.TC_Boolean));
            CORBA.Internals.Add_Parameter
              (TC_FullValueDescription,
               CORBA.To_Any
                 (Argument_Name_Ü_is_truncatable));
            CORBA.Internals.Add_Parameter
              (TC_FullValueDescription,
               CORBA.To_Any
                 (CORBA.Helper.TC_RepositoryId));
            CORBA.Internals.Add_Parameter
              (TC_FullValueDescription,
               CORBA.To_Any
                 (Argument_Name_Ü_base_value));
            CORBA.Internals.Add_Parameter
              (TC_FullValueDescription,
               CORBA.To_Any
                 (CORBA.TC_TypeCode));
            CORBA.Internals.Add_Parameter
              (TC_FullValueDescription,
               CORBA.To_Any
                 (Argument_Name_Ü_IDL_type));
            CORBA.TypeCode.Internals.Disable_Ref_Counting
              (TC_FullValueDescription);
            CORBA.TypeCode.Internals.Freeze
              (TC_FullValueDescription);
         end if;
      end Initialize_FullValueDescription;

   end Internals;

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

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

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

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

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

   function Unchecked_To_Ref
     (The_Ref : CORBA.Object.Ref'Class)
     return CORBA.Repository_Root.ValueDef.Ref
   is
      Result : CORBA.Repository_Root.ValueDef.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.ValueDef.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.ValueDef.FullValueDescription
   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)),
      is_abstract => CORBA.From_Any
        (CORBA.Internals.Get_Aggregate_Element
           (Item,
            CORBA.TC_Boolean,
            2)),
      is_custom => CORBA.From_Any
        (CORBA.Internals.Get_Aggregate_Element
           (Item,
            CORBA.TC_Boolean,
            3)),
      defined_in => CORBA.Helper.From_Any
        (CORBA.Internals.Get_Aggregate_Element
           (Item,
            CORBA.Helper.TC_RepositoryId,
            4)),
      version => CORBA.Repository_Root.Helper.From_Any
        (CORBA.Internals.Get_Aggregate_Element
           (Item,
            CORBA.Repository_Root.Helper.TC_VersionSpec,
            5)),
      operations => CORBA.Repository_Root.Helper.From_Any
        (CORBA.Internals.Get_Aggregate_Element
           (Item,
            CORBA.Repository_Root.Helper.TC_OpDescriptionSeq,
            6)),
      attributes => CORBA.Repository_Root.Helper.From_Any
        (CORBA.Internals.Get_Aggregate_Element
           (Item,
            CORBA.Repository_Root.Helper.TC_AttrDescriptionSeq,
            7)),
      members => CORBA.Repository_Root.Helper.From_Any
        (CORBA.Internals.Get_Aggregate_Element
           (Item,
            CORBA.Repository_Root.Helper.TC_ValueMemberSeq,
            8)),
      initializers => CORBA.Repository_Root.Helper.From_Any
        (CORBA.Internals.Get_Aggregate_Element
           (Item,
            CORBA.Repository_Root.Helper.TC_InitializerSeq,
            9)),
      supported_interfaces => CORBA.Repository_Root.Helper.From_Any
        (CORBA.Internals.Get_Aggregate_Element
           (Item,
            CORBA.Repository_Root.Helper.TC_RepositoryIdSeq,
            10)),
      abstract_base_values => CORBA.Repository_Root.Helper.From_Any
        (CORBA.Internals.Get_Aggregate_Element
           (Item,
            CORBA.Repository_Root.Helper.TC_RepositoryIdSeq,
            11)),
      is_truncatable => CORBA.From_Any
        (CORBA.Internals.Get_Aggregate_Element
           (Item,
            CORBA.TC_Boolean,
            12)),
      base_value => CORBA.Helper.From_Any
        (CORBA.Internals.Get_Aggregate_Element
           (Item,
            CORBA.Helper.TC_RepositoryId,
            13)),
      IDL_type => CORBA.From_Any
        (CORBA.Internals.Get_Aggregate_Element
           (Item,
            CORBA.TC_TypeCode,
            14)));
   end From_Any;

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

   function To_Any
     (Item : CORBA.Repository_Root.ValueDef.FullValueDescription)
     return CORBA.Any
   is
      Result : constant CORBA.Any :=
        CORBA.Internals.Get_Empty_Any
           (TC_FullValueDescription);
   begin
      PolyORB.Any.Set_Value
        (CORBA.Get_Container
           (Result).all,
         new PolyORB.Any.Content'Class'
           (CORBA.Repository_Root.ValueDef.Helper.Internals.Wrap
              (new CORBA.Repository_Root.ValueDef.FullValueDescription'
                 (Item))),
         False);
      return Result;
   end To_Any;

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

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

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

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

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

   procedure Deferred_Initialization is
   begin
      CORBA.Repository_Root.ValueDef.Helper.Internals.Initialize_ValueDef;
      CORBA.Repository_Root.ValueDef.Helper.Internals.Initialize_FullValueDescription;
   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.ValueDef.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.ValueDef.Helper;
