pragma Style_Checks ("NM32766");

---------------------------------------------------
--  This file has been generated automatically from
--  /wrkdirs/usr/ports/net/polyorb/work/polyorb-2.9.0/idls/cos/notification/CosNotifyComm.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 CosNotifyComm.StructuredPullSupplier.Impl;
with CosNotification;
with CosNotification.Helper;
with PolyORB.Any;
with CORBA;
pragma Elaborate_All (CORBA);
with CORBA.ServerRequest;
with CosEventComm;
with CosEventComm.Helper;
with CORBA.NVList;
with CosNotifyComm.Helper;
with PolyORB.CORBA_P.IR_Hooks;
with CORBA.Object;
with CORBA.Object.Helper;
with PolyORB.CORBA_P.Domain_Management;
with CosNotifyComm_StructuredPullSupplier_Hash;
with PolyORB.Std;
with PortableServer;
with CORBA.ORB;
with PolyORB.CORBA_P.Exceptions;
with PolyORB.Qos.Exception_Informations;
with PolyORB.Utils.Strings;
with PolyORB.Utils.Strings.Lists;
with PolyORB.Initialization;

package body CosNotifyComm.StructuredPullSupplier.Skel is

   try_pull_structured_event_Arg_Name_has_event_Ü : constant CORBA.Identifier :=
     CORBA.To_CORBA_String
        ("has_event");

   subscription_change_Arg_Name_added_Ü : constant CORBA.Identifier :=
     CORBA.To_CORBA_String
        ("added");

   subscription_change_Arg_Name_removed_Ü : constant CORBA.Identifier :=
     CORBA.To_CORBA_String
        ("removed");

   N_Operations : constant PolyORB.Std.Natural :=
     9;

   type String_Ptr is
     access PolyORB.Std.String;

   Invoke_Db : array (0 .. (N_Operations
      - 1)) of String_Ptr :=
     (others => null);

   procedure Register_Procedure
     (Operation_Name : PolyORB.Std.String);

   ------------------------
   -- Register_Procedure --
   ------------------------

   procedure Register_Procedure
     (Operation_Name : PolyORB.Std.String)
   is
      Index_Ü : PolyORB.Std.Natural;
      Invoke_Name_Access : String_Ptr;
   begin
      Index_Ü :=
        CosNotifyComm_StructuredPullSupplier_Hash.Hash
           (Operation_Name);
      if (Invoke_Db
        (Index_Ü)
         /= null)
      then
         raise Program_Error;
      end if;
      Invoke_Name_Access :=
        new PolyORB.Std.String'
           (Operation_Name);
      Invoke_Db
        (Index_Ü) :=
        Invoke_Name_Access;
   end Register_Procedure;

   procedure Invoke
     (Self : PortableServer.Servant;
      Request : CORBA.ServerRequest.Object_Ptr);

   ------------
   -- Invoke --
   ------------

   procedure Invoke
     (Self : PortableServer.Servant;
      Request : CORBA.ServerRequest.Object_Ptr)
   is
      Operation_Ü : constant PolyORB.Std.String :=
        CORBA.To_Standard_String
           (CORBA.ServerRequest.Operation
              (Request.all));
      Argument_List_Ü : CORBA.NVList.Ref;
      Index_Ü : PolyORB.Std.Natural;
      Invoke_Name_Access : String_Ptr;

      procedure Invoke_pull_structured_event;

      ----------------------------------
      -- Invoke_pull_structured_event --
      ----------------------------------

      procedure Invoke_pull_structured_event is
         Result_Ü : CosNotification.StructuredEvent;
         pragma Warnings (Off, Result_Ü);
         pragma Suppress (Validity_Check, Result_Ü);
         Arg_CC_Result_Ü_Ü : aliased PolyORB.Any.Content'Class :=
           CosNotification.Helper.Internals.Wrap
              (Result_Ü'Unrestricted_Access);
         Arg_Any_Result_Ü_Ü : constant CORBA.Any :=
           CORBA.Internals.Get_Wrapper_Any
              (CosNotification.Helper.TC_StructuredEvent,
               Arg_CC_Result_Ü_Ü'Unchecked_Access);
      begin
         --  Processing request
         CORBA.ServerRequest.Arguments
           (Request,
            Argument_List_Ü);
         begin
            --  Call Implementation
            Result_Ü :=
              CosNotifyComm.StructuredPullSupplier.Impl.pull_structured_event
                 (CosNotifyComm.StructuredPullSupplier.Impl.Object'Class
                    (Self.all)'Access);
         exception
            when E : CosEventComm.Disconnected =>
               declare
                  Members : CosEventComm.Disconnected_Members;
               begin
                  CosEventComm.Get_Members
                    (E,
                     Members);
                  CORBA.ServerRequest.Set_Exception
                    (Request,
                     CosEventComm.Helper.To_Any
                       (Members));
                  return;
               end;
         end;
         --  Setting the result
         CORBA.ServerRequest.Set_Result
           (Request,
            Arg_Any_Result_Ü_Ü);
         CORBA.NVList.Internals.Clone_Out_Args
           (Argument_List_Ü);
      end Invoke_pull_structured_event;

      procedure Invoke_try_pull_structured_event;

      --------------------------------------
      -- Invoke_try_pull_structured_event --
      --------------------------------------

      procedure Invoke_try_pull_structured_event is
         Argument_has_event_Ü : CORBA.Boolean;
         pragma Warnings (Off, Argument_has_event_Ü);
         pragma Suppress (Validity_Check, Argument_has_event_Ü);
         Arg_CC_has_event_Ü : aliased PolyORB.Any.Content'Class :=
           CORBA.Wrap
              (Argument_has_event_Ü'Unrestricted_Access);
         Arg_Any_has_event_Ü : constant CORBA.Any :=
           CORBA.Internals.Get_Wrapper_Any
              (CORBA.TC_Boolean,
               Arg_CC_has_event_Ü'Unchecked_Access);
         Result_Ü : CosNotification.StructuredEvent;
         pragma Warnings (Off, Result_Ü);
         pragma Suppress (Validity_Check, Result_Ü);
         Arg_CC_Result_Ü_Ü : aliased PolyORB.Any.Content'Class :=
           CosNotification.Helper.Internals.Wrap
              (Result_Ü'Unrestricted_Access);
         Arg_Any_Result_Ü_Ü : constant CORBA.Any :=
           CORBA.Internals.Get_Wrapper_Any
              (CosNotification.Helper.TC_StructuredEvent,
               Arg_CC_Result_Ü_Ü'Unchecked_Access);
      begin
         CORBA.NVList.Add_Item
           (Argument_List_Ü,
            try_pull_structured_event_Arg_Name_has_event_Ü,
            Arg_Any_has_event_Ü,
            CORBA.ARG_OUT);
         --  Processing request
         CORBA.ServerRequest.Arguments
           (Request,
            Argument_List_Ü);
         begin
            --  Call Implementation
            CosNotifyComm.StructuredPullSupplier.Impl.try_pull_structured_event
              (CosNotifyComm.StructuredPullSupplier.Impl.Object'Class
                 (Self.all)'Access,
               Argument_has_event_Ü,
               Result_Ü);
         exception
            when E : CosEventComm.Disconnected =>
               declare
                  Members : CosEventComm.Disconnected_Members;
               begin
                  CosEventComm.Get_Members
                    (E,
                     Members);
                  CORBA.ServerRequest.Set_Exception
                    (Request,
                     CosEventComm.Helper.To_Any
                       (Members));
                  return;
               end;
         end;
         --  Setting the result
         CORBA.ServerRequest.Set_Result
           (Request,
            Arg_Any_Result_Ü_Ü);
         CORBA.NVList.Internals.Clone_Out_Args
           (Argument_List_Ü);
      end Invoke_try_pull_structured_event;

      procedure Invoke_disconnect_structured_pull_supplier;

      ------------------------------------------------
      -- Invoke_disconnect_structured_pull_supplier --
      ------------------------------------------------

      procedure Invoke_disconnect_structured_pull_supplier is
      begin
         --  Processing request
         CORBA.ServerRequest.Arguments
           (Request,
            Argument_List_Ü);
         --  Call Implementation
         CosNotifyComm.StructuredPullSupplier.Impl.disconnect_structured_pull_supplier
           (CosNotifyComm.StructuredPullSupplier.Impl.Object'Class
              (Self.all)'Access);
         CORBA.NVList.Internals.Clone_Out_Args
           (Argument_List_Ü);
      end Invoke_disconnect_structured_pull_supplier;

      procedure Invoke_subscription_change;

      --------------------------------
      -- Invoke_subscription_change --
      --------------------------------

      procedure Invoke_subscription_change is
         Argument_added_Ü : CosNotification.EventTypeSeq;
         pragma Warnings (Off, Argument_added_Ü);
         pragma Suppress (Validity_Check, Argument_added_Ü);
         Arg_CC_added_Ü : aliased PolyORB.Any.Content'Class :=
           CosNotification.Helper.Internals.Wrap
              (CosNotification.IDL_SEQUENCE_CosNotification_EventType.Sequence
                 (Argument_added_Ü)'Unrestricted_Access);
         Arg_Any_added_Ü : constant CORBA.Any :=
           CORBA.Internals.Get_Wrapper_Any
              (CosNotification.Helper.TC_EventTypeSeq,
               Arg_CC_added_Ü'Unchecked_Access);
         Argument_removed_Ü : CosNotification.EventTypeSeq;
         pragma Warnings (Off, Argument_removed_Ü);
         pragma Suppress (Validity_Check, Argument_removed_Ü);
         Arg_CC_removed_Ü : aliased PolyORB.Any.Content'Class :=
           CosNotification.Helper.Internals.Wrap
              (CosNotification.IDL_SEQUENCE_CosNotification_EventType.Sequence
                 (Argument_removed_Ü)'Unrestricted_Access);
         Arg_Any_removed_Ü : constant CORBA.Any :=
           CORBA.Internals.Get_Wrapper_Any
              (CosNotification.Helper.TC_EventTypeSeq,
               Arg_CC_removed_Ü'Unchecked_Access);
      begin
         CORBA.NVList.Add_Item
           (Argument_List_Ü,
            subscription_change_Arg_Name_added_Ü,
            Arg_Any_added_Ü,
            CORBA.ARG_IN);
         CORBA.NVList.Add_Item
           (Argument_List_Ü,
            subscription_change_Arg_Name_removed_Ü,
            Arg_Any_removed_Ü,
            CORBA.ARG_IN);
         --  Processing request
         CORBA.ServerRequest.Arguments
           (Request,
            Argument_List_Ü);
         begin
            --  Call Implementation
            CosNotifyComm.StructuredPullSupplier.Impl.subscription_change
              (CosNotifyComm.StructuredPullSupplier.Impl.Object'Class
                 (Self.all)'Access,
               Argument_added_Ü,
               Argument_removed_Ü);
         exception
            when E : CosNotifyComm.InvalidEventType =>
               declare
                  Members : CosNotifyComm.InvalidEventType_Members;
               begin
                  CosNotifyComm.Get_Members
                    (E,
                     Members);
                  CORBA.ServerRequest.Set_Exception
                    (Request,
                     CosNotifyComm.Helper.To_Any
                       (Members));
                  return;
               end;
         end;
         CORBA.NVList.Internals.Clone_Out_Args
           (Argument_List_Ü);
      end Invoke_subscription_change;

      procedure Invoke_Uis_a;

      ------------------
      -- Invoke_Uis_a --
      ------------------

      procedure Invoke_Uis_a is
         Type_Id_Ü : CORBA.String;
         Arg_Name_Type_Id_Ü : constant CORBA.Identifier :=
           CORBA.To_CORBA_String
              ("Type_Id_Ü");
         Argument_Type_Id_Ü : constant CORBA.Any :=
           CORBA.To_Any
              (Type_Id_Ü);
         Result_Ü : CORBA.Boolean;
      begin
         CORBA.NVList.Add_Item
           (Argument_List_Ü,
            Arg_Name_Type_Id_Ü,
            Argument_Type_Id_Ü,
            CORBA.ARG_IN);
         CORBA.ServerRequest.Arguments
           (Request,
            Argument_List_Ü);
         Type_Id_Ü :=
           CORBA.From_Any
              (Argument_Type_Id_Ü);
         Result_Ü :=
           Is_A
              (CORBA.To_Standard_String
                 (Type_Id_Ü));
         CORBA.ServerRequest.Set_Result
           (Request,
            CORBA.To_Any
              (Result_Ü));
      end Invoke_Uis_a;

      procedure Invoke_Uinterface;

      -----------------------
      -- Invoke_Uinterface --
      -----------------------

      procedure Invoke_Uinterface is
      begin
         CORBA.ServerRequest.Arguments
           (Request,
            Argument_List_Ü);
         CORBA.ServerRequest.Set_Result
           (Request,
            CORBA.Object.Helper.To_Any
              (CORBA.Object.Ref
                 (PolyORB.CORBA_P.IR_Hooks.Get_Interface_Definition
                    (CORBA.To_CORBA_String
                       (Repository_Id)))));
      end Invoke_Uinterface;

      procedure Invoke_Udomain_managers;

      -----------------------------
      -- Invoke_Udomain_managers --
      -----------------------------

      procedure Invoke_Udomain_managers is
      begin
         CORBA.ServerRequest.Arguments
           (Request,
            Argument_List_Ü);
         CORBA.ServerRequest.Set_Result
           (Request,
            PolyORB.CORBA_P.Domain_Management.Get_Domain_Managers
              (Self));
      end Invoke_Udomain_managers;

      procedure Invoke_Unon_existent;

      --------------------------
      -- Invoke_Unon_existent --
      --------------------------

      procedure Invoke_Unon_existent is
      begin
         CORBA.ServerRequest.Arguments
           (Request,
            Argument_List_Ü);
         CORBA.ServerRequest.Set_Result
           (Request,
            CORBA.To_Any
              (CORBA.Boolean'
                 (False)));
      end Invoke_Unon_existent;

      procedure Dispatch;

      --------------
      -- Dispatch --
      --------------

      procedure Dispatch is
      begin
         case Index_Ü is
            when 0 =>
               Invoke_pull_structured_event;
            when 1 =>
               Invoke_try_pull_structured_event;
            when 2 =>
               Invoke_disconnect_structured_pull_supplier;
            when 3 =>
               Invoke_subscription_change;
            when 5 =>
               Invoke_Uinterface;
            when 6 =>
               Invoke_Udomain_managers;
            when 7
               | 8 =>
               Invoke_Unon_existent;
            when 4 =>
               Invoke_Uis_a;
            pragma Warnings (Off);
            when others =>
               raise Program_Error;
            pragma Warnings (On);

         end case;
      end Dispatch;

   begin
      CORBA.ORB.Create_List
        (0,
         Argument_List_Ü);
      Index_Ü :=
        CosNotifyComm_StructuredPullSupplier_Hash.Hash
           (Operation_Ü);
      Invoke_Name_Access :=
        Invoke_Db
           (Index_Ü);
      begin
         if (Operation_Ü
            = Invoke_Name_Access.all)
         then
            Dispatch;
         else
            CORBA.Raise_Bad_Operation
              (CORBA.Default_Sys_Member);
         end if;
      exception
         when E : others =>
            CORBA.ServerRequest.Set_Exception
              (Request,
               PolyORB.CORBA_P.Exceptions.System_Exception_To_Any
                 (E));
            PolyORB.Qos.Exception_Informations.Set_Exception_Information
              (Request.all,
               E);
      end;
   end Invoke;

   function Servant_Is_A
     (Obj : PortableServer.Servant)
     return Boolean;

   ------------------
   -- Servant_Is_A --
   ------------------

   function Servant_Is_A
     (Obj : PortableServer.Servant)
     return Boolean
   is
   begin
      return (Obj.all
         in CosNotifyComm.StructuredPullSupplier.Impl.Object'Class);
   end Servant_Is_A;

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

   procedure Deferred_Initialization is
   begin
      PortableServer.Internals.Register_Skeleton
        (CosNotifyComm.StructuredPullSupplier.Repository_Id,
         Servant_Is_A'Access,
         Is_A'Access,
         Invoke'Access);
      Register_Procedure
        ("pull_structured_event");
      Register_Procedure
        ("try_pull_structured_event");
      Register_Procedure
        ("disconnect_structured_pull_supplier");
      Register_Procedure
        ("subscription_change");
      Register_Procedure
        ("_is_a");
      Register_Procedure
        ("_interface");
      Register_Procedure
        ("_domain_managers");
      Register_Procedure
        ("_non_existent");
      Register_Procedure
        ("_not_existent");
   end Deferred_Initialization;

begin
   declare
      use PolyORB.Utils.Strings;
      use PolyORB.Utils.Strings.Lists;
   begin
      PolyORB.Initialization.Register_Module
        (PolyORB.Initialization.Module_Info'
           (Name => +"CosNotifyComm.StructuredPullSupplier.Skel",
            Conflicts => PolyORB.Utils.Strings.Lists.Empty,
            Depends => PolyORB.Utils.Strings.Lists.Empty
               & "CosNotifyComm.NotifySubscribe.Skel?",
            Provides => PolyORB.Utils.Strings.Lists.Empty,
            Implicit => False,
            Init => Deferred_Initialization'Access,
            Shutdown => null));
   end;
end CosNotifyComm.StructuredPullSupplier.Skel;
