------------------------------------------------------------------------------
--                                                                          --
--                           POLYORB COMPONENTS                             --
--                                                                          --
--                  PORTABLEINTERCEPTOR.CLIENTREQUESTINFO                   --
--                                                                          --
--                                 B o d y                                  --
--                                                                          --
--         Copyright (C) 2004-2006, Free Software Foundation, Inc.          --
--                                                                          --
-- PolyORB is free software; you  can  redistribute  it and/or modify it    --
-- under terms of the  GNU General Public License as published by the  Free --
-- Software Foundation;  either version 2,  or (at your option)  any  later --
-- version. PolyORB is distributed  in the hope that it will be  useful,    --
-- but WITHOUT ANY WARRANTY;  without even the implied warranty of MERCHAN- --
-- TABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public --
-- License  for more details.  You should have received  a copy of the GNU  --
-- General Public License distributed with PolyORB; see file COPYING. If    --
-- not, write to the Free Software Foundation, 51 Franklin Street, Fifth    --
-- Floor, Boston, MA 02111-1301, USA.                                       --
--                                                                          --
--
--
--
--
--
--
--
--                  PolyORB is maintained by AdaCore                        --
--                     (email: sales@adacore.com)                           --
--                                                                          --
------------------------------------------------------------------------------

with PortableInterceptor.ClientRequestInfo.Impl;

package body PortableInterceptor.ClientRequestInfo is

   ---------------------------------
   -- Add_Request_Service_Context --
   ---------------------------------

   procedure Add_Request_Service_Context
     (Self            : Local_Ref;
      Service_Context : IOP.ServiceContext;
      Replace         : CORBA.Boolean)
   is
      Self_Ref : constant CORBA.Object.Ref := CORBA.Object.Ref (Self);
   begin

      if CORBA.Object.Is_Nil (Self_Ref) then
         CORBA.Raise_Inv_Objref (CORBA.Default_Sys_Member);
      end if;

      PortableInterceptor.ClientRequestInfo.Impl.Add_Request_Service_Context
       (PortableInterceptor.ClientRequestInfo.Impl.Object_Ptr
         (Entity_Of (Self)),
        Service_Context,
        Replace);
   end Add_Request_Service_Context;

   -----------------------------
   -- Get_Effective_Component --
   -----------------------------

   function Get_Effective_Component
     (Self : Local_Ref;
      Id   : IOP.ComponentId)
      return IOP.TaggedComponent
   is
      Self_Ref : constant CORBA.Object.Ref := CORBA.Object.Ref (Self);

   begin
      if CORBA.Object.Is_Nil (Self_Ref) then
         CORBA.Raise_Inv_Objref (CORBA.Default_Sys_Member);
      end if;

      return
        PortableInterceptor.ClientRequestInfo.Impl.Get_Effective_Component
         (PortableInterceptor.ClientRequestInfo.Impl.Object_Ptr
           (Entity_Of (Self)),
          Id);
   end Get_Effective_Component;

   ------------------------------
   -- Get_Effective_Components --
   ------------------------------

   function Get_Effective_Components
     (Self : Local_Ref;
      Id   : IOP.ComponentId)
      return IOP.TaggedComponentSeq
   is
      Self_Ref : constant CORBA.Object.Ref := CORBA.Object.Ref (Self);

   begin
      if CORBA.Object.Is_Nil (Self_Ref) then
         CORBA.Raise_Inv_Objref (CORBA.Default_Sys_Member);
      end if;

      return
        PortableInterceptor.ClientRequestInfo.Impl.Get_Effective_Components
         (PortableInterceptor.ClientRequestInfo.Impl.Object_Ptr
           (Entity_Of (Self)),
          Id);
   end Get_Effective_Components;

   ---------------------------
   -- Get_Effective_Profile --
   ---------------------------

   function Get_Effective_Profile
     (Self : Local_Ref)
      return IOP.TaggedProfile
   is
      Self_Ref : constant CORBA.Object.Ref := CORBA.Object.Ref (Self);

   begin
      if CORBA.Object.Is_Nil (Self_Ref) then
         CORBA.Raise_Inv_Objref (CORBA.Default_Sys_Member);
      end if;

      return PortableInterceptor.ClientRequestInfo.Impl.Get_Effective_Profile
        (PortableInterceptor.ClientRequestInfo.Impl.Object_Ptr
          (Entity_Of (Self)));
   end Get_Effective_Profile;

   --------------------------
   -- Get_Effective_Target --
   --------------------------

   function Get_Effective_Target
     (Self : Local_Ref)
      return CORBA.Object.Ref
   is
      Self_Ref : constant CORBA.Object.Ref := CORBA.Object.Ref (Self);

   begin
      if CORBA.Object.Is_Nil (Self_Ref) then
         CORBA.Raise_Inv_Objref (CORBA.Default_Sys_Member);
      end if;

      return PortableInterceptor.ClientRequestInfo.Impl.Get_Effective_Target
        (PortableInterceptor.ClientRequestInfo.Impl.Object_Ptr
          (Entity_Of (Self)));
   end Get_Effective_Target;

   ----------------------------
   -- Get_Received_Exception --
   ----------------------------

   function Get_Received_Exception
     (Self : Local_Ref)
      return CORBA.Any
   is
      Self_Ref : constant CORBA.Object.Ref := CORBA.Object.Ref (Self);

   begin
      if CORBA.Object.Is_Nil (Self_Ref) then
         CORBA.Raise_Inv_Objref (CORBA.Default_Sys_Member);
      end if;

      return PortableInterceptor.ClientRequestInfo.Impl.Get_Received_Exception
        (PortableInterceptor.ClientRequestInfo.Impl.Object_Ptr
          (Entity_Of (Self)));
   end Get_Received_Exception;

   -------------------------------
   -- Get_Received_Exception_Id --
   -------------------------------

   function Get_Received_Exception_Id
     (Self : Local_Ref)
      return CORBA.RepositoryId
   is
      Self_Ref : constant CORBA.Object.Ref := CORBA.Object.Ref (Self);

   begin
      if CORBA.Object.Is_Nil (Self_Ref) then
         CORBA.Raise_Inv_Objref (CORBA.Default_Sys_Member);
      end if;

      return
        PortableInterceptor.ClientRequestInfo.Impl.Get_Received_Exception_Id
         (PortableInterceptor.ClientRequestInfo.Impl.Object_Ptr
           (Entity_Of (Self)));
   end Get_Received_Exception_Id;

   ------------------------
   -- Get_Request_Policy --
   ------------------------

   function Get_Request_Policy
     (Self     : Local_Ref;
      IDL_Type : CORBA.PolicyType)
      return CORBA.Policy.Ref
   is
      Self_Ref : constant CORBA.Object.Ref := CORBA.Object.Ref (Self);

   begin
      if CORBA.Object.Is_Nil (Self_Ref) then
         CORBA.Raise_Inv_Objref (CORBA.Default_Sys_Member);
      end if;

      return PortableInterceptor.ClientRequestInfo.Impl.Get_Request_Policy
        (PortableInterceptor.ClientRequestInfo.Impl.Object_Ptr
          (Entity_Of (Self)),
         IDL_Type);
   end Get_Request_Policy;

   ----------------
   -- Get_Target --
   ----------------

   function Get_Target
     (Self : Local_Ref)
      return CORBA.Object.Ref
   is
      Self_Ref : constant CORBA.Object.Ref := CORBA.Object.Ref (Self);

   begin
      if CORBA.Object.Is_Nil (Self_Ref) then
         CORBA.Raise_Inv_Objref (CORBA.Default_Sys_Member);
      end if;

      return PortableInterceptor.ClientRequestInfo.Impl.Get_Target
        (PortableInterceptor.ClientRequestInfo.Impl.Object_Ptr
          (Entity_Of (Self)));
   end Get_Target;

end PortableInterceptor.ClientRequestInfo;
