Method_Request.cpp

Go to the documentation of this file.
00001 // $Id: Method_Request.cpp 79084 2007-07-30 13:13:45Z elliott_c $
00002 
00003 #include "orbsvcs/Notify/Method_Request.h"
00004 
00005 #include "orbsvcs/Time_Utilities.h"
00006 #include "ace/OS_NS_sys_time.h"
00007 
00008 ACE_RCSID(Notify, TAO_Notify_Method_Request_Queueable, "$Id: Method_Request.cpp 79084 2007-07-30 13:13:45Z elliott_c $")
00009 
00010 
00011 TAO_BEGIN_VERSIONED_NAMESPACE_DECL
00012 
00013 TAO_Notify_Method_Request::~TAO_Notify_Method_Request (void)
00014 {
00015 }
00016 
00017 TAO_Notify_Method_Request_Queueable *
00018 TAO_Notify_Method_Request_Queueable::copy (void)
00019 {
00020   return this;
00021 }
00022 
00023 TAO_Notify_Method_Request_Queueable::TAO_Notify_Method_Request_Queueable()
00024 {
00025 }
00026 
00027 TAO_Notify_Method_Request_Queueable::TAO_Notify_Method_Request_Queueable(const TAO_Notify_Event * event)
00028 {
00029   this->init (event);
00030 }
00031 
00032 void
00033 TAO_Notify_Method_Request_Queueable::init (const TAO_Notify_Event* event)
00034 {
00035   ACE_ASSERT( event != 0 );
00036   // Set the parameters that affect queuing in the message queue.
00037   // The ACE_Message_Block priorities go from 0 (lowest) to ULONG_MAX
00038   // (highest), while the Notification Events go from -32767 (lowest,
00039   // even though CORBA::Short goes to -32768) to 32767 (highest).
00040 
00041   // Convert to CORBA::Long to preserve the sign.  Conversion to
00042   // unsigned long will happen automatically and we do not have to worry
00043   // about losing the number in the addition since priority () returns a
00044   // CORBA::Short.
00045   this->msg_priority ((CORBA::Long)event->priority ().value () + PRIORITY_BASE);
00046 
00047   // The deadline time for the message block is absolute, while the
00048   // timeout for the event is relative to the time it was received.
00049   // So, we do a little conversion and set it on the message block (us)
00050 
00051   const TAO_Notify_Property_Time& timeout = event->timeout ();
00052 
00053   if (timeout.is_valid () && timeout != 0)
00054   {
00055     ACE_Time_Value deadline;
00056     ORBSVCS_Time::TimeT_to_Time_Value(deadline, timeout.value());
00057     deadline += ACE_OS::gettimeofday ();
00058     this->msg_deadline_time (deadline);
00059   }
00060 
00061   this->time_ = event->creation_time ();
00062 }
00063 
00064 const ACE_Time_Value&
00065 TAO_Notify_Method_Request_Queueable::creation_time (void) const
00066 {
00067   return this->time_;
00068 }
00069 
00070 TAO_END_VERSIONED_NAMESPACE_DECL

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