pragma Style_Checks ("NM32766");

---------------------------------------------------
--  This file has been generated automatically from
--  /wrkdirs/usr/ports/net/polyorb/work/polyorb-2.9.0/idls/cos/notification/CosNotification.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 CosNotification.QoSAdmin.Impl;
with CosNotification.Helper;
with PolyORB.Any;
with CORBA;
pragma Elaborate_All (CORBA);
with CORBA.ServerRequest;
with CORBA.NVList;
with PolyORB.CORBA_P.IR_Hooks;
with CORBA.Object;
with CORBA.Object.Helper;
with PolyORB.CORBA_P.Domain_Management;
with CosNotification_QoSAdmin_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 CosNotification.QoSAdmin.Skel is

   set_qos_Arg_Name_qos_Ü : constant CORBA.Identifier :=
     CORBA.To_CORBA_String
        ("qos");

   validate_qos_Arg_Name_required_qos_Ü : constant CORBA.Identifier :=
     CORBA.To_CORBA_String
        ("required_qos");

   validate_qos_Arg_Name_available_qos_Ü : constant CORBA.Identifier :=
     CORBA.To_CORBA_String
        ("available_qos");

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

   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_Ü :=
        CosNotification_QoSAdmin_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_get_qos;

      --------------------
      -- Invoke_get_qos --
      --------------------

      procedure Invoke_get_qos is
         Result_Ü : CosNotification.QoSProperties;
         pragma Warnings (Off, Result_Ü);
         pragma Suppress (Validity_Check, Result_Ü);
         Arg_CC_Result_Ü_Ü : aliased PolyORB.Any.Content'Class :=
           CosNotification.Helper.Internals.Wrap
              (CosNotification.IDL_SEQUENCE_CosNotification_Property.Sequence
                 (Result_Ü)'Unrestricted_Access);
         Arg_Any_Result_Ü_Ü : constant CORBA.Any :=
           CORBA.Internals.Get_Wrapper_Any
              (CosNotification.Helper.TC_QoSProperties,
               Arg_CC_Result_Ü_Ü'Unchecked_Access);
      begin
         --  Processing request
         CORBA.ServerRequest.Arguments
           (Request,
            Argument_List_Ü);
         --  Call Implementation
         Result_Ü :=
           CosNotification.QoSAdmin.Impl.get_qos
              (CosNotification.QoSAdmin.Impl.Object'Class
                 (Self.all)'Access);
         --  Setting the result
         CORBA.ServerRequest.Set_Result
           (Request,
            Arg_Any_Result_Ü_Ü);
         CORBA.NVList.Internals.Clone_Out_Args
           (Argument_List_Ü);
      end Invoke_get_qos;

      procedure Invoke_set_qos;

      --------------------
      -- Invoke_set_qos --
      --------------------

      procedure Invoke_set_qos is
         Argument_qos_Ü : CosNotification.QoSProperties;
         pragma Warnings (Off, Argument_qos_Ü);
         pragma Suppress (Validity_Check, Argument_qos_Ü);
         Arg_CC_qos_Ü : aliased PolyORB.Any.Content'Class :=
           CosNotification.Helper.Internals.Wrap
              (CosNotification.IDL_SEQUENCE_CosNotification_Property.Sequence
                 (Argument_qos_Ü)'Unrestricted_Access);
         Arg_Any_qos_Ü : constant CORBA.Any :=
           CORBA.Internals.Get_Wrapper_Any
              (CosNotification.Helper.TC_QoSProperties,
               Arg_CC_qos_Ü'Unchecked_Access);
      begin
         CORBA.NVList.Add_Item
           (Argument_List_Ü,
            set_qos_Arg_Name_qos_Ü,
            Arg_Any_qos_Ü,
            CORBA.ARG_IN);
         --  Processing request
         CORBA.ServerRequest.Arguments
           (Request,
            Argument_List_Ü);
         begin
            --  Call Implementation
            CosNotification.QoSAdmin.Impl.set_qos
              (CosNotification.QoSAdmin.Impl.Object'Class
                 (Self.all)'Access,
               Argument_qos_Ü);
         exception
            when E : CosNotification.UnsupportedQoS =>
               declare
                  Members : CosNotification.UnsupportedQoS_Members;
               begin
                  CosNotification.Get_Members
                    (E,
                     Members);
                  CORBA.ServerRequest.Set_Exception
                    (Request,
                     CosNotification.Helper.To_Any
                       (Members));
                  return;
               end;
         end;
         CORBA.NVList.Internals.Clone_Out_Args
           (Argument_List_Ü);
      end Invoke_set_qos;

      procedure Invoke_validate_qos;

      -------------------------
      -- Invoke_validate_qos --
      -------------------------

      procedure Invoke_validate_qos is
         Argument_required_qos_Ü : CosNotification.QoSProperties;
         pragma Warnings (Off, Argument_required_qos_Ü);
         pragma Suppress (Validity_Check, Argument_required_qos_Ü);
         Arg_CC_required_qos_Ü : aliased PolyORB.Any.Content'Class :=
           CosNotification.Helper.Internals.Wrap
              (CosNotification.IDL_SEQUENCE_CosNotification_Property.Sequence
                 (Argument_required_qos_Ü)'Unrestricted_Access);
         Arg_Any_required_qos_Ü : constant CORBA.Any :=
           CORBA.Internals.Get_Wrapper_Any
              (CosNotification.Helper.TC_QoSProperties,
               Arg_CC_required_qos_Ü'Unchecked_Access);
         Argument_available_qos_Ü : CosNotification.NamedPropertyRangeSeq;
         pragma Warnings (Off, Argument_available_qos_Ü);
         pragma Suppress (Validity_Check, Argument_available_qos_Ü);
         Arg_CC_available_qos_Ü : aliased PolyORB.Any.Content'Class :=
           CosNotification.Helper.Internals.Wrap
              (CosNotification.IDL_SEQUENCE_CosNotification_NamedPropertyRange.Sequence
                 (Argument_available_qos_Ü)'Unrestricted_Access);
         Arg_Any_available_qos_Ü : constant CORBA.Any :=
           CORBA.Internals.Get_Wrapper_Any
              (CosNotification.Helper.TC_NamedPropertyRangeSeq,
               Arg_CC_available_qos_Ü'Unchecked_Access);
      begin
         CORBA.NVList.Add_Item
           (Argument_List_Ü,
            validate_qos_Arg_Name_required_qos_Ü,
            Arg_Any_required_qos_Ü,
            CORBA.ARG_IN);
         CORBA.NVList.Add_Item
           (Argument_List_Ü,
            validate_qos_Arg_Name_available_qos_Ü,
            Arg_Any_available_qos_Ü,
            CORBA.ARG_OUT);
         --  Processing request
         CORBA.ServerRequest.Arguments
           (Request,
            Argument_List_Ü);
         begin
            --  Call Implementation
            CosNotification.QoSAdmin.Impl.validate_qos
              (CosNotification.QoSAdmin.Impl.Object'Class
                 (Self.all)'Access,
               Argument_required_qos_Ü,
               Argument_available_qos_Ü);
         exception
            when E : CosNotification.UnsupportedQoS =>
               declare
                  Members : CosNotification.UnsupportedQoS_Members;
               begin
                  CosNotification.Get_Members
                    (E,
                     Members);
                  CORBA.ServerRequest.Set_Exception
                    (Request,
                     CosNotification.Helper.To_Any
                       (Members));
                  return;
               end;
         end;
         CORBA.NVList.Internals.Clone_Out_Args
           (Argument_List_Ü);
      end Invoke_validate_qos;

      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_get_qos;
            when 1 =>
               Invoke_set_qos;
            when 2 =>
               Invoke_validate_qos;
            when 4 =>
               Invoke_Uinterface;
            when 5 =>
               Invoke_Udomain_managers;
            when 6
               | 7 =>
               Invoke_Unon_existent;
            when 3 =>
               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_Ü :=
        CosNotification_QoSAdmin_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 CosNotification.QoSAdmin.Impl.Object'Class);
   end Servant_Is_A;

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

   procedure Deferred_Initialization is
   begin
      PortableServer.Internals.Register_Skeleton
        (CosNotification.QoSAdmin.Repository_Id,
         Servant_Is_A'Access,
         Is_A'Access,
         Invoke'Access);
      Register_Procedure
        ("get_qos");
      Register_Procedure
        ("set_qos");
      Register_Procedure
        ("validate_qos");
      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 => +"CosNotification.QoSAdmin.Skel",
            Conflicts => PolyORB.Utils.Strings.Lists.Empty,
            Depends => PolyORB.Utils.Strings.Lists.Empty,
            Provides => PolyORB.Utils.Strings.Lists.Empty,
            Implicit => False,
            Init => Deferred_Initialization'Access,
            Shutdown => null));
   end;
end CosNotification.QoSAdmin.Skel;
