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

---------------------------------------------------
--  This file has been generated automatically from
--  /pbulk/work/net/ada-polyorb/work/PolyORB-25.0/idls/cos/time/CosTime.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 Ada.Unchecked_Conversion;
with Ada.Unchecked_Deallocation;
with PolyORB.Std;
with PolyORB.Exceptions;
with CORBA.Object.Helper;
with PolyORB.Utils.Strings;
with PolyORB.Utils.Strings.Lists;
with PolyORB.Initialization;

package body CosTime.Helper is

   
   package body Internals is

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

      function From_Any
        (C : PolyORB.Any.Any_Container'Class)
        return CosTime.TimeComparison
      is
      begin
         return CosTime.TimeComparison'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_Ü_TimeComparison;
         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, Index);
      begin
         Acc.Repr_Cache :=
           CosTime.TimeComparison'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_Ü_TimeComparison;
         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 :=
           CosTime.TimeComparison'Val
              (PolyORB.Types.Unsigned_Long'
                 (PolyORB.Any.From_Any
                    (From_C)));
      end Set_Aggregate_Element;

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

      function Get_Aggregate_Count
        (Acc : Content_Ü_TimeComparison)
        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_Ü_TimeComparison;
         Count : PolyORB.Types.Unsigned_Long)
      is
      begin
         null;
      end Set_Aggregate_Count;

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

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

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

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

      function Clone
        (Acc : Content_Ü_TimeComparison;
         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_Ü_TimeComparison)
            then
               return null;
            end if;
            Target :=
              Into;
            Content_Ü_TimeComparison
              (Target.all).V.all :=
              Acc.V.all;
         else
            Target :=
              new Content_Ü_TimeComparison;
            Content_Ü_TimeComparison
              (Target.all).V :=
              new CosTime.TimeComparison'
                 (Acc.V.all);
         end if;
         Content_Ü_TimeComparison
           (Target.all).Repr_Cache :=
           Acc.Repr_Cache;
         return Target;
      end Clone;

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

      procedure Finalize_Value
        (Acc : in out Content_Ü_TimeComparison)
      is
         procedure Free
           is new Ada.Unchecked_Deallocation
              (CosTime.TimeComparison,
               Ptr_Ü_TimeComparison);

      begin
         Free
           (Acc.V);
      end Finalize_Value;

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

      function Wrap
        (X : access CosTime.TimeComparison)
        return PolyORB.Any.Content'Class
      is
      begin
         return Content_Ü_TimeComparison'
           (PolyORB.Any.Aggregate_Content with
            V => Ptr_Ü_TimeComparison'
              (X.all'Unchecked_Access),
            Repr_Cache => 0);
      end Wrap;

      TimeComparison_Initialized : PolyORB.Std.Boolean :=
        False;

      -------------------------------
      -- Initialize_TimeComparison --
      -------------------------------

      procedure Initialize_TimeComparison is
         Name_Ü : constant CORBA.String :=
           CORBA.To_CORBA_String
              ("TimeComparison");
         Id_Ü : constant CORBA.String :=
           CORBA.To_CORBA_String
              ("IDL:omg.org/CosTime/TimeComparison:1.0");
         TCEqualTo_Name_Ü : constant CORBA.String :=
           CORBA.To_CORBA_String
              ("TCEqualTo");
         TCLessThan_Name_Ü : constant CORBA.String :=
           CORBA.To_CORBA_String
              ("TCLessThan");
         TCGreaterThan_Name_Ü : constant CORBA.String :=
           CORBA.To_CORBA_String
              ("TCGreaterThan");
         TCIndeterminate_Name_Ü : constant CORBA.String :=
           CORBA.To_CORBA_String
              ("TCIndeterminate");
      begin
         if not TimeComparison_Initialized
         then
            TimeComparison_Initialized :=
              True;
            CosTime.Helper.TC_TimeComparison :=
              CORBA.TypeCode.Internals.To_CORBA_Object
                 (PolyORB.Any.TypeCode.Tcf_Enum);
            CORBA.Internals.Add_Parameter
              (TC_TimeComparison,
               CORBA.To_Any
                 (Name_Ü));
            CORBA.Internals.Add_Parameter
              (TC_TimeComparison,
               CORBA.To_Any
                 (Id_Ü));
            CORBA.Internals.Add_Parameter
              (TC_TimeComparison,
               CORBA.To_Any
                 (TCEqualTo_Name_Ü));
            CORBA.Internals.Add_Parameter
              (TC_TimeComparison,
               CORBA.To_Any
                 (TCLessThan_Name_Ü));
            CORBA.Internals.Add_Parameter
              (TC_TimeComparison,
               CORBA.To_Any
                 (TCGreaterThan_Name_Ü));
            CORBA.Internals.Add_Parameter
              (TC_TimeComparison,
               CORBA.To_Any
                 (TCIndeterminate_Name_Ü));
            CORBA.TypeCode.Internals.Disable_Ref_Counting
              (TC_TimeComparison);
            CORBA.TypeCode.Internals.Freeze
              (TC_TimeComparison);
         end if;
      end Initialize_TimeComparison;

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

      function From_Any
        (C : PolyORB.Any.Any_Container'Class)
        return CosTime.ComparisonType
      is
      begin
         return CosTime.ComparisonType'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_Ü_ComparisonType;
         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, Index);
      begin
         Acc.Repr_Cache :=
           CosTime.ComparisonType'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_Ü_ComparisonType;
         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 :=
           CosTime.ComparisonType'Val
              (PolyORB.Types.Unsigned_Long'
                 (PolyORB.Any.From_Any
                    (From_C)));
      end Set_Aggregate_Element;

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

      function Get_Aggregate_Count
        (Acc : Content_Ü_ComparisonType)
        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_Ü_ComparisonType;
         Count : PolyORB.Types.Unsigned_Long)
      is
      begin
         null;
      end Set_Aggregate_Count;

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

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

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

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

      function Clone
        (Acc : Content_Ü_ComparisonType;
         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_Ü_ComparisonType)
            then
               return null;
            end if;
            Target :=
              Into;
            Content_Ü_ComparisonType
              (Target.all).V.all :=
              Acc.V.all;
         else
            Target :=
              new Content_Ü_ComparisonType;
            Content_Ü_ComparisonType
              (Target.all).V :=
              new CosTime.ComparisonType'
                 (Acc.V.all);
         end if;
         Content_Ü_ComparisonType
           (Target.all).Repr_Cache :=
           Acc.Repr_Cache;
         return Target;
      end Clone;

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

      procedure Finalize_Value
        (Acc : in out Content_Ü_ComparisonType)
      is
         procedure Free
           is new Ada.Unchecked_Deallocation
              (CosTime.ComparisonType,
               Ptr_Ü_ComparisonType);

      begin
         Free
           (Acc.V);
      end Finalize_Value;

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

      function Wrap
        (X : access CosTime.ComparisonType)
        return PolyORB.Any.Content'Class
      is
      begin
         return Content_Ü_ComparisonType'
           (PolyORB.Any.Aggregate_Content with
            V => Ptr_Ü_ComparisonType'
              (X.all'Unchecked_Access),
            Repr_Cache => 0);
      end Wrap;

      ComparisonType_Initialized : PolyORB.Std.Boolean :=
        False;

      -------------------------------
      -- Initialize_ComparisonType --
      -------------------------------

      procedure Initialize_ComparisonType is
         Name_Ü : constant CORBA.String :=
           CORBA.To_CORBA_String
              ("ComparisonType");
         Id_Ü : constant CORBA.String :=
           CORBA.To_CORBA_String
              ("IDL:omg.org/CosTime/ComparisonType:1.0");
         IntervalC_Name_Ü : constant CORBA.String :=
           CORBA.To_CORBA_String
              ("IntervalC");
         MidC_Name_Ü : constant CORBA.String :=
           CORBA.To_CORBA_String
              ("MidC");
      begin
         if not ComparisonType_Initialized
         then
            ComparisonType_Initialized :=
              True;
            CosTime.Helper.TC_ComparisonType :=
              CORBA.TypeCode.Internals.To_CORBA_Object
                 (PolyORB.Any.TypeCode.Tcf_Enum);
            CORBA.Internals.Add_Parameter
              (TC_ComparisonType,
               CORBA.To_Any
                 (Name_Ü));
            CORBA.Internals.Add_Parameter
              (TC_ComparisonType,
               CORBA.To_Any
                 (Id_Ü));
            CORBA.Internals.Add_Parameter
              (TC_ComparisonType,
               CORBA.To_Any
                 (IntervalC_Name_Ü));
            CORBA.Internals.Add_Parameter
              (TC_ComparisonType,
               CORBA.To_Any
                 (MidC_Name_Ü));
            CORBA.TypeCode.Internals.Disable_Ref_Counting
              (TC_ComparisonType);
            CORBA.TypeCode.Internals.Freeze
              (TC_ComparisonType);
         end if;
      end Initialize_ComparisonType;

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

      function From_Any
        (C : PolyORB.Any.Any_Container'Class)
        return CosTime.OverlapType
      is
      begin
         return CosTime.OverlapType'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_Ü_OverlapType;
         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, Index);
      begin
         Acc.Repr_Cache :=
           CosTime.OverlapType'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_Ü_OverlapType;
         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 :=
           CosTime.OverlapType'Val
              (PolyORB.Types.Unsigned_Long'
                 (PolyORB.Any.From_Any
                    (From_C)));
      end Set_Aggregate_Element;

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

      function Get_Aggregate_Count
        (Acc : Content_Ü_OverlapType)
        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_Ü_OverlapType;
         Count : PolyORB.Types.Unsigned_Long)
      is
      begin
         null;
      end Set_Aggregate_Count;

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

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

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

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

      function Clone
        (Acc : Content_Ü_OverlapType;
         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_Ü_OverlapType)
            then
               return null;
            end if;
            Target :=
              Into;
            Content_Ü_OverlapType
              (Target.all).V.all :=
              Acc.V.all;
         else
            Target :=
              new Content_Ü_OverlapType;
            Content_Ü_OverlapType
              (Target.all).V :=
              new CosTime.OverlapType'
                 (Acc.V.all);
         end if;
         Content_Ü_OverlapType
           (Target.all).Repr_Cache :=
           Acc.Repr_Cache;
         return Target;
      end Clone;

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

      procedure Finalize_Value
        (Acc : in out Content_Ü_OverlapType)
      is
         procedure Free
           is new Ada.Unchecked_Deallocation
              (CosTime.OverlapType,
               Ptr_Ü_OverlapType);

      begin
         Free
           (Acc.V);
      end Finalize_Value;

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

      function Wrap
        (X : access CosTime.OverlapType)
        return PolyORB.Any.Content'Class
      is
      begin
         return Content_Ü_OverlapType'
           (PolyORB.Any.Aggregate_Content with
            V => Ptr_Ü_OverlapType'
              (X.all'Unchecked_Access),
            Repr_Cache => 0);
      end Wrap;

      OverlapType_Initialized : PolyORB.Std.Boolean :=
        False;

      ----------------------------
      -- Initialize_OverlapType --
      ----------------------------

      procedure Initialize_OverlapType is
         Name_Ü : constant CORBA.String :=
           CORBA.To_CORBA_String
              ("OverlapType");
         Id_Ü : constant CORBA.String :=
           CORBA.To_CORBA_String
              ("IDL:omg.org/CosTime/OverlapType:1.0");
         OTContainer_Name_Ü : constant CORBA.String :=
           CORBA.To_CORBA_String
              ("OTContainer");
         OTContained_Name_Ü : constant CORBA.String :=
           CORBA.To_CORBA_String
              ("OTContained");
         OTOverlap_Name_Ü : constant CORBA.String :=
           CORBA.To_CORBA_String
              ("OTOverlap");
         OTNoOverlap_Name_Ü : constant CORBA.String :=
           CORBA.To_CORBA_String
              ("OTNoOverlap");
      begin
         if not OverlapType_Initialized
         then
            OverlapType_Initialized :=
              True;
            CosTime.Helper.TC_OverlapType :=
              CORBA.TypeCode.Internals.To_CORBA_Object
                 (PolyORB.Any.TypeCode.Tcf_Enum);
            CORBA.Internals.Add_Parameter
              (TC_OverlapType,
               CORBA.To_Any
                 (Name_Ü));
            CORBA.Internals.Add_Parameter
              (TC_OverlapType,
               CORBA.To_Any
                 (Id_Ü));
            CORBA.Internals.Add_Parameter
              (TC_OverlapType,
               CORBA.To_Any
                 (OTContainer_Name_Ü));
            CORBA.Internals.Add_Parameter
              (TC_OverlapType,
               CORBA.To_Any
                 (OTContained_Name_Ü));
            CORBA.Internals.Add_Parameter
              (TC_OverlapType,
               CORBA.To_Any
                 (OTOverlap_Name_Ü));
            CORBA.Internals.Add_Parameter
              (TC_OverlapType,
               CORBA.To_Any
                 (OTNoOverlap_Name_Ü));
            CORBA.TypeCode.Internals.Disable_Ref_Counting
              (TC_OverlapType);
            CORBA.TypeCode.Internals.Freeze
              (TC_OverlapType);
         end if;
      end Initialize_OverlapType;

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

      pragma No_Return (Raise_TimeUnavailable_From_Any);

      ------------------------------------
      -- Raise_TimeUnavailable_From_Any --
      ------------------------------------

      procedure Raise_TimeUnavailable_From_Any
        (Item : PolyORB.Any.Any;
         Message : PolyORB.Std.String)
      is
         Members : constant CosTime.TimeUnavailable_Members :=
           CosTime.Helper.From_Any
              (CORBA.Any
                 (Item));
      begin
         PolyORB.Exceptions.User_Raise_Exception
           (TimeUnavailable'Identity,
            Members,
            Message);
      end Raise_TimeUnavailable_From_Any;

      TimeUnavailable_Initialized : PolyORB.Std.Boolean :=
        False;

      --------------------------------
      -- Initialize_TimeUnavailable --
      --------------------------------

      procedure Initialize_TimeUnavailable is
         Name_Ü : constant CORBA.String :=
           CORBA.To_CORBA_String
              ("TimeUnavailable_Members");
         Id_Ü : constant CORBA.String :=
           CORBA.To_CORBA_String
              ("IDL:omg.org/CosTime/TimeUnavailable:1.0");
      begin
         if not TimeUnavailable_Initialized
         then
            TimeUnavailable_Initialized :=
              True;
            CosTime.Helper.TC_TimeUnavailable :=
              CORBA.TypeCode.Internals.To_CORBA_Object
                 (PolyORB.Any.TypeCode.Tcf_Except);
            CORBA.Internals.Add_Parameter
              (TC_TimeUnavailable,
               CORBA.To_Any
                 (Name_Ü));
            CORBA.Internals.Add_Parameter
              (TC_TimeUnavailable,
               CORBA.To_Any
                 (Id_Ü));
            PolyORB.Exceptions.Register_Exception
              (CORBA.TypeCode.Internals.To_PolyORB_Object
                 (TC_TimeUnavailable),
               Raise_TimeUnavailable_From_Any'Access);
            CORBA.TypeCode.Internals.Disable_Ref_Counting
              (TC_TimeUnavailable);
            CORBA.TypeCode.Internals.Freeze
              (TC_TimeUnavailable);
         end if;
      end Initialize_TimeUnavailable;

      TIO_Initialized : PolyORB.Std.Boolean :=
        False;

      --------------------
      -- Initialize_TIO --
      --------------------

      procedure Initialize_TIO is
         Name_Ü : constant CORBA.String :=
           CORBA.To_CORBA_String
              ("TIO");
         Id_Ü : constant CORBA.String :=
           CORBA.To_CORBA_String
              ("IDL:omg.org/CosTime/TIO:1.0");
      begin
         if not TIO_Initialized
         then
            TIO_Initialized :=
              True;
            CosTime.Helper.TC_TIO :=
              CORBA.TypeCode.Internals.To_CORBA_Object
                 (PolyORB.Any.TypeCode.Tcf_Object);
            CORBA.Internals.Add_Parameter
              (TC_TIO,
               CORBA.To_Any
                 (Name_Ü));
            CORBA.Internals.Add_Parameter
              (TC_TIO,
               CORBA.To_Any
                 (Id_Ü));
            CORBA.TypeCode.Internals.Disable_Ref_Counting
              (TC_TIO);
            CORBA.TypeCode.Internals.Freeze
              (TC_TIO);
         end if;
      end Initialize_TIO;

   end Internals;

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

   function From_Any
     (Item : CORBA.Any)
     return CosTime.TimeComparison
   is
   begin
      return CosTime.Helper.Internals.From_Any
        (CORBA.Get_Container
           (Item).all);
   end From_Any;

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

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

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

   function From_Any
     (Item : CORBA.Any)
     return CosTime.ComparisonType
   is
   begin
      return CosTime.Helper.Internals.From_Any
        (CORBA.Get_Container
           (Item).all);
   end From_Any;

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

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

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

   function From_Any
     (Item : CORBA.Any)
     return CosTime.OverlapType
   is
   begin
      return CosTime.Helper.Internals.From_Any
        (CORBA.Get_Container
           (Item).all);
   end From_Any;

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

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

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

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

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

   function To_Any
     (Item : CosTime.TimeUnavailable_Members)
     return CORBA.Any
   is
      Result_Ü : constant CORBA.Any :=
        CORBA.Internals.Get_Empty_Any_Aggregate
           (CosTime.Helper.TC_TimeUnavailable);
      pragma Warnings (Off);
      pragma Unreferenced (Item);
      pragma Warnings (On);
   begin
      return Result_Ü;
   end To_Any;

   ---------------------------
   -- Raise_TimeUnavailable --
   ---------------------------

   procedure Raise_TimeUnavailable
     (Members : CosTime.TimeUnavailable_Members)
   is
   begin
      PolyORB.Exceptions.User_Raise_Exception
        (TimeUnavailable'Identity,
         Members);
   end Raise_TimeUnavailable;

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

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

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

   function To_Any
     (Item : CosTime.TIO_Forward.Ref)
     return CORBA.Any
   is
   begin
      return CORBA.Object.Helper.To_Any
        (CORBA.Object.Ref
           (Item));
   end To_Any;

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

   function Unchecked_To_Ref
     (The_Ref : CORBA.Object.Ref'Class)
     return CosTime.TIO_Forward.Ref
   is
      Result : CosTime.TIO_Forward.Ref;
   begin
      CosTime.TIO_Forward.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 CosTime.TIO_Forward.Ref
   is
   begin
      if (CORBA.Object.Is_Nil
        (The_Ref)
         or else CORBA.Object.Is_A
           (The_Ref,
            "IDL:omg.org/CosTime/TIO:1.0"))
      then
         return Unchecked_To_Ref
           (The_Ref);
      end if;
      CORBA.Raise_Bad_Param
        (CORBA.Default_Sys_Member);
   end To_Ref;

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

   procedure Deferred_Initialization is
   begin
      CosTime.Helper.Internals.Initialize_TimeComparison;
      CosTime.Helper.Internals.Initialize_ComparisonType;
      CosTime.Helper.Internals.Initialize_OverlapType;
      CosTime.Helper.Internals.Initialize_TimeUnavailable;
      CosTime.Helper.Internals.Initialize_TIO;
   end Deferred_Initialization;

begin
   declare
      use PolyORB.Utils.Strings;
      use PolyORB.Utils.Strings.Lists;
   begin
      PolyORB.Initialization.Register_Module
        (PolyORB.Initialization.Module_Info'
           (Name => +"CosTime.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 CosTime.Helper;
