00001 // $Id: Delivery_Request.cpp 79230 2007-08-06 18:18:07Z elliott_c $ 00002 00003 #include "orbsvcs/Notify/Delivery_Request.h" 00004 00005 #if ! defined (__ACE_INLINE__) 00006 #include "orbsvcs/Notify/Delivery_Request.inl" 00007 #endif /* __ACE_INLINE__ */ 00008 00009 #include "orbsvcs/Notify/Routing_Slip.h" 00010 00011 #include "tao/debug.h" 00012 #include "tao/corba.h" 00013 00014 #include "ace/Truncate.h" 00015 00016 //#define DEBUG_LEVEL 9 00017 #ifndef DEBUG_LEVEL 00018 # define DEBUG_LEVEL TAO_debug_level 00019 #endif //DEBUG_LEVEL 00020 00021 TAO_BEGIN_VERSIONED_NAMESPACE_DECL 00022 00023 namespace TAO_Notify 00024 { 00025 00026 /////////////////// 00027 // Delivery_Request 00028 Delivery_Request::Delivery_Request (const Routing_Slip_Ptr & routing_slip, size_t request_id) 00029 : routing_slip_ (routing_slip) 00030 , request_id_ (request_id) 00031 , delivery_type_ (0) 00032 { 00033 if (DEBUG_LEVEL > 8) ACE_DEBUG ((LM_DEBUG, 00034 ACE_TEXT ("(%P|%t) Delivery_Request:: constructor\n") 00035 )); 00036 } 00037 00038 Delivery_Request::~Delivery_Request () 00039 { 00040 if (DEBUG_LEVEL > 8) ACE_DEBUG ((LM_DEBUG, 00041 ACE_TEXT ("(%P|%t) Delivery_Request:: destructor\n") 00042 )); 00043 } 00044 00045 // DO NOT INLINE THIS. It uses the Routing_Slip_Ptr which cannot be declared at 00046 // the time Delivery_Request.inl is compiled. 00047 void 00048 Delivery_Request::complete () 00049 { 00050 routing_slip_->delivery_request_complete (this->request_id_); 00051 } 00052 00053 // DO NOT INLINE THIS. It uses the Routing_Slip_Ptr which cannot be declared at 00054 // the time Delivery_Request.inl is compiled. 00055 const TAO_Notify_Event::Ptr & 00056 Delivery_Request::event () const 00057 { 00058 return this->routing_slip_->event (); 00059 } 00060 00061 void 00062 Delivery_Request::marshal (TAO_OutputCDR & cdr) 00063 { 00064 if (this->delivery_type_ != 0) 00065 { 00066 cdr.write_octet (this->delivery_type_); 00067 CORBA::ULong dest_count = 00068 ACE_Utils::truncate_cast<CORBA::ULong> (this->destination_id_.size ()); 00069 cdr.write_ulong (dest_count); 00070 for (size_t ndest = 0; ndest < dest_count; ++ ndest) 00071 { 00072 cdr.write_ulong (this->destination_id_ [ndest]); 00073 } 00074 } 00075 } 00076 00077 unsigned long 00078 Delivery_Request::sequence () const 00079 { 00080 return this->routing_slip_->sequence (); 00081 } 00082 00083 00084 bool 00085 Delivery_Request::should_retry () const 00086 { 00087 return this->routing_slip_->should_retry (); 00088 } 00089 00090 void 00091 Delivery_Request::dispatch ( 00092 TAO_Notify_ProxySupplier * proxy_supplier, 00093 bool filter) 00094 { 00095 this->routing_slip_->dispatch (proxy_supplier, filter); 00096 } 00097 00098 const Routing_Slip_Ptr & 00099 Delivery_Request::routing_slip () const 00100 { 00101 return this->routing_slip_; 00102 } 00103 00104 } // namespace 00105 00106 TAO_END_VERSIONED_NAMESPACE_DECL