Delivery_Request.h

Go to the documentation of this file.
00001 /* -*- C++ -*- */
00002 // $Id: Delivery_Request.h 76589 2007-01-25 18:04:11Z elliott_c $
00003 
00004 #ifndef TAO_NOTIFY_DELIVERY_REQUEST_H
00005 #define TAO_NOTIFY_DELIVERY_REQUEST_H
00006 #include /**/ "ace/pre.h"
00007 
00008 #include "orbsvcs/Notify/notify_serv_export.h"
00009 #include "orbsvcs/Notify/Topology_Object.h"
00010 #include "orbsvcs/Notify/Event.h"
00011 #include <ace/Vector_T.h>
00012 #include <ace/Bound_Ptr.h>
00013 #if !defined (ACE_LACKS_PRAGMA_ONCE)
00014 # pragma once
00015 #endif /* ACE_LACKS_PRAGMA_ONCE */
00016 
00017 TAO_BEGIN_VERSIONED_NAMESPACE_DECL
00018 
00019 // Forward declarations of referenced classes
00020 class TAO_Notify_EventChannelFactory;
00021 class TAO_Notify_ProxySupplier;
00022 
00023 namespace TAO_Notify
00024 {
00025 
00026 // Forward declarations of TAO_Notify classes/pointers/collections declared
00027 // in this header
00028 class Delivery_Request;
00029 /// A reference-counted smart pointer to a Delivery_Request.
00030 typedef ACE_Strong_Bound_Ptr<Delivery_Request, TAO_SYNCH_MUTEX> Delivery_Request_Ptr;
00031 
00032 typedef ACE_Unbounded_Queue<Delivery_Request_Ptr> Delivery_Request_Queue;
00033 
00034 // Forward declarations of TAO_Notify classes/pointers/collections referenced
00035 // in this header
00036 
00037 class Routing_Slip;
00038 typedef ACE_Strong_Bound_Ptr<Routing_Slip, TAO_SYNCH_MUTEX> Routing_Slip_Ptr;
00039 
00040 /// \brief Represents a request to deliver an event to a particular destination.
00041 ///
00042 /// A Routing Slip contains a collection of Delivery Requests.
00043 /// A Delivery Request is associated with a Delivery Method.  Delivery Methods
00044 /// should be lightweight objects because they are copied, queued, and otherwise
00045 /// passed around while they are waiting to be executed.  The Delivery Request is
00046 /// more stable.
00047 class TAO_Notify_Serv_Export Delivery_Request
00048 {
00049 public:
00050   /// Normal constructor
00051   /// \param routing_slip the routing slip that owns this Delivery Request.
00052   /// \param request_id an id that identifies this Delivery Request to the Routing Slip.
00053   Delivery_Request (const Routing_Slip_Ptr & routing_slip, size_t request_id);
00054 
00055   /// \brief A static "factory" method for use during restart.
00056   ///
00057   /// \param routing_slip. The routing slip to which the new Delivery Request should be attached.
00058   /// \param request_id The id used to identify this Delivery Request to the Routing Slip.
00059   /// \param ecf The EventChannelFactory responsible for reloading this Delivery Method.
00060   /// \param cdr A CDR stream from which the peristent information for this Delivery Requect can be retrieved.
00061   /// \return a pointer to the newly-allocated Delivery Request
00062   static Delivery_Request_Ptr create (
00063     const Routing_Slip_Ptr & routing_slip,
00064     size_t request_id,
00065     TAO_Notify_EventChannelFactory & ecf,
00066     TAO_InputCDR & cdr);
00067 
00068   /// a normal destructor.
00069   ~Delivery_Request ();
00070 
00071   /// \brief A method to indicate the delivery is complete.
00072   ///
00073   /// To be called by the delivery method associated with this delivery request.
00074   void complete ();
00075 
00076   /// \brief An accessor method for the event associated with the Routing Slip that owns this Delivery request.
00077   const TAO_Notify_Event::Ptr & event () const;
00078 
00079   /// \brief An accessor method for the routing slip that owns this request.
00080   const Routing_Slip_Ptr & routing_slip ()const;
00081 
00082   /// \brief Capture Delivery Type for the Delivery Method
00083   ///
00084   /// Called by the delivery method to capture information that should be persisted.
00085   void set_delivery_type (ACE_CDR::Octet type);
00086 
00087   /// \brief Capture destination ID for the Delivery Request.
00088   ///
00089   /// Called by the delivery method to capture information that should be persisted.
00090   void set_destination_id (IdVec & destination_id);
00091 
00092   /// \brief Marshal peristent information for this delivery request and its delivery methods into a CDR stream.
00093   ///
00094   /// Called during persistent event storage.
00095   void marshal (TAO_OutputCDR & cdr);
00096 
00097   /// expose routing slip method
00098   unsigned long sequence () const;
00099 
00100   /// expose routing slip method
00101   bool should_retry () const;
00102 
00103   /// expose routing slip method
00104   void dispatch (TAO_Notify_ProxySupplier * proxy_supplier, bool filter);
00105 
00106   // Meaningless, but needed by ACE_Vector on some platforms (gcc2.x LynxOS)
00107   bool operator == (const Delivery_Request & rhs) const;
00108   // Meaningless, but needed by ACE_Vector on some platforms
00109   bool  operator != (const Delivery_Request & rhs) const;
00110 
00111 private:
00112   /// No null constructor.
00113   Delivery_Request ();
00114   /// No copy constructor.
00115   Delivery_Request (const Delivery_Request & rhs);
00116   /// no assignment operator
00117   Delivery_Request & operator = (const Delivery_Request & rhs);
00118 
00119 private:
00120   Routing_Slip_Ptr routing_slip_;
00121   size_t request_id_;
00122   ACE_CDR::Octet delivery_type_;
00123   IdVec destination_id_;
00124 };
00125 
00126 } // namespace
00127 
00128 TAO_END_VERSIONED_NAMESPACE_DECL
00129 
00130 #if defined (__ACE_INLINE__)
00131 #include "orbsvcs/Notify/Delivery_Request.inl"
00132 #endif /* __ACE_INLINE__ */
00133 
00134 #include /**/ "ace/post.h"
00135 #endif /* TAO_NOTIFY_DELIVERY_REQUEST_H */

Generated on Tue Feb 2 17:45:29 2010 for TAO_CosNotification by  doxygen 1.4.7