Main Page   Class Hierarchy   Alphabetical List   Compound List   File List   Compound Members   File Members   Related Pages  

ACE_Time_Request Class Reference

Message format for delivering requests to the ACE_Time Server. More...

#include <Time_Request_Reply.h>

List of all members.

Public Types

enum  Constants { TIME_UPDATE = 01, MAX_TIME_LEN = MAXPATHLEN + 1 }

Public Methods

 ACE_Time_Request (void)
 Default constructor. More...

 ACE_Time_Request (ACE_INT32 msg_type, const ACE_UINT32 time, ACE_Time_Value *timeout=0)
void init (void)
ssize_t size (void) const
ACE_INT32 msg_type (void) const
 Get the type of the message. More...

void msg_type (ACE_INT32)
 Set the type of the message. More...

ACE_UINT32 time (void) const
 Get the time. More...

void time (ACE_UINT32 t)
ACE_UINT32 block_forever (void) const
 Get the blocking semantics. More...

void block_forever (ACE_UINT32)
 Set the blocking semantics. More...

ACE_Time_Value timeout (void) const
 Get the timeout. More...

void timeout (const ACE_Time_Value &timeout)
 Set the timeout. More...

int encode (void *&)
 Encode the message before transmission. More...

int decode (void)
 Decode message after reception. More...

void dump (void) const
 Print out the values of the message for debugging purposes. More...


Private Attributes

Transfer transfer_
 Transfer buffer. More...

ACE_UINT32 time_
 Time. More...


Detailed Description

Message format for delivering requests to the ACE_Time Server.

This class is implemented to minimize data copying. In particular, all marshaling is done in situ...

Definition at line 36 of file Time_Request_Reply.h.


Member Enumeration Documentation

enum ACE_Time_Request::Constants
 

Enumeration values:
TIME_UPDATE  Request message types.
MAX_TIME_LEN  Class-specific constant values.

Definition at line 39 of file Time_Request_Reply.h.

00040   {
00041     /// Request message types.
00042     TIME_UPDATE = 01,
00043 
00044     /// Class-specific constant values.
00045     MAX_TIME_LEN = MAXPATHLEN + 1
00046   };


Constructor & Destructor Documentation

ACE_Time_Request::ACE_Time_Request void   
 

Default constructor.

Definition at line 11 of file Time_Request_Reply.cpp.

References ACE_TRACE.

00012 {
00013   ACE_TRACE ("ACE_Time_Request::ACE_Time_Request");
00014 }

ACE_Time_Request::ACE_Time_Request ACE_INT32    msg_type,
const ACE_UINT32    time,
ACE_Time_Value   timeout = 0
 

Create a ACE_Time_Request message.

Parameters:
msg_type  Type of request.
time  Time.
timeout  Max time waiting for request.

Definition at line 18 of file Time_Request_Reply.cpp.

References ACE_TRACE.

00021 {
00022   ACE_TRACE ("ACE_Time_Request::ACE_Time_Request");
00023   this->msg_type (t);
00024 
00025   // If timeout is a NULL pointer, then block forever...
00026   if (timeout == 0)
00027     {
00028       this->transfer_.block_forever_ = 1;
00029       this->transfer_.sec_timeout_   = 0;
00030       this->transfer_.usec_timeout_  = 0;
00031     }
00032   else // Do a "timed wait."
00033     {
00034       this->block_forever (0);
00035       // Keep track of how long client is willing to wait.
00036       this->transfer_.sec_timeout_ = timeout->sec ();
00037       this->transfer_.usec_timeout_ = timeout->usec ();
00038     }
00039 
00040   // Copy time into request
00041   this->time_ = this->transfer_.time_ = time;
00042 }


Member Function Documentation

void ACE_Time_Request::block_forever ACE_UINT32   
 

Set the blocking semantics.

Definition at line 84 of file Time_Request_Reply.cpp.

References ACE_TRACE, ACE_Time_Request::Transfer::block_forever_, and transfer_.

00085 {
00086   ACE_TRACE ("ACE_Time_Request::block_forever");
00087   this->transfer_.block_forever_ = bs;
00088 }

ACE_UINT32 ACE_Time_Request::block_forever void    const
 

Get the blocking semantics.

Definition at line 77 of file Time_Request_Reply.cpp.

References ACE_TRACE, ACE_Time_Request::Transfer::block_forever_, and transfer_.

Referenced by dump.

00078 {
00079   ACE_TRACE ("ACE_Time_Request::block_forever");
00080   return this->transfer_.block_forever_;
00081 }

int ACE_Time_Request::decode void   
 

Decode message after reception.

Definition at line 142 of file Time_Request_Reply.cpp.

References ACE_TRACE, ACE_Time_Request::Transfer::block_forever_, ACE_Time_Request::Transfer::msg_type_, ACE_Time_Request::Transfer::sec_timeout_, time_, ACE_Time_Request::Transfer::time_, transfer_, and ACE_Time_Request::Transfer::usec_timeout_.

00143 {
00144   ACE_TRACE ("ACE_Time_Request::decode");
00145   // Decode
00146   this->transfer_.block_forever_ = ntohl (this->transfer_.block_forever_);
00147   this->transfer_.usec_timeout_  = ntohl (this->transfer_.usec_timeout_);
00148   this->transfer_.sec_timeout_   = ntohl (this->transfer_.sec_timeout_);
00149   this->transfer_.msg_type_      = ntohl (this->transfer_.msg_type_);
00150   this->transfer_.time_          = ntohl (this->transfer_.time_);
00151 
00152   this->time_ = this->transfer_.time_;
00153   return 0;
00154 }

void ACE_Time_Request::dump void    const
 

Print out the values of the message for debugging purposes.

Definition at line 159 of file Time_Request_Reply.cpp.

References ACE_DEBUG, ACE_LIB_TEXT, ACE_TRACE, block_forever, LM_DEBUG, msg_type, ACE_Time_Value::sec, TIME_UPDATE, timeout, and ACE_Time_Value::usec.

00160 {
00161   ACE_TRACE ("ACE_Time_Request::dump");
00162   ACE_DEBUG ((LM_DEBUG,  ACE_LIB_TEXT ("*******\nlength = %d\n"),
00163               this->size ()));
00164   ACE_DEBUG ((LM_DEBUG,  ACE_LIB_TEXT ("message-type = ")));
00165 
00166   switch (this->msg_type ())
00167     {
00168     case ACE_Time_Request::TIME_UPDATE:
00169       ACE_DEBUG ((LM_DEBUG,  ACE_LIB_TEXT ("TIME_UPDATE\n")));
00170       break;
00171     default:
00172       ACE_DEBUG ((LM_DEBUG,  ACE_LIB_TEXT ("<unknown type> = %d\n"), this->msg_type ()));
00173       break;
00174     }
00175 
00176   if (this->block_forever ())
00177     ACE_DEBUG ((LM_DEBUG,  ACE_LIB_TEXT ("blocking forever\n")));
00178   else
00179     {
00180 #if !defined (ACE_NLOGGING)
00181       ACE_Time_Value tv = this->timeout ();
00182 #endif /* ! ACE_NLOGGING */
00183       ACE_DEBUG ((LM_DEBUG,  ACE_LIB_TEXT ("waiting for %d secs and %d usecs\n"),
00184                   tv.sec (), tv.usec ()));
00185     }
00186   ACE_DEBUG ((LM_DEBUG,  ACE_LIB_TEXT ("*******\ntime = %d\n"),
00187               this->time ()));
00188   ACE_DEBUG ((LM_DEBUG,  ACE_LIB_TEXT ("+++++++\n")));
00189 }

int ACE_Time_Request::encode void *&   
 

Encode the message before transmission.

Definition at line 124 of file Time_Request_Reply.cpp.

References ACE_TRACE, ACE_Time_Request::Transfer::block_forever_, ACE_Time_Request::Transfer::msg_type_, ACE_Time_Request::Transfer::sec_timeout_, size, ACE_Time_Request::Transfer::time_, transfer_, and ACE_Time_Request::Transfer::usec_timeout_.

00125 {
00126   ACE_TRACE ("ACE_Time_Request::encode");
00127   // Compute the length *before* doing the marshaling.
00128 
00129   buf = (void *) &this->transfer_;
00130   this->transfer_.block_forever_ = htonl (this->transfer_.block_forever_);
00131   this->transfer_.usec_timeout_  = htonl (this->transfer_.usec_timeout_);
00132   this->transfer_.sec_timeout_   = htonl (this->transfer_.sec_timeout_);
00133   this->transfer_.msg_type_      = htonl (this->transfer_.msg_type_);
00134   this->transfer_.time_          = htonl (this->transfer_.time_);
00135 
00136   return this->size ();  // Always fixed
00137 }

void ACE_Time_Request::init void   
 

Initialize length_ in order to ensure correct byte ordering before a request is sent.

Deprecated:
This method is a no-op.

Definition at line 46 of file Time_Request_Reply.cpp.

References ACE_TRACE.

00047 {
00048   ACE_TRACE ("ACE_Time_Request::init");
00049 //  this->length (sizeof this->transfer_);
00050 }

void ACE_Time_Request::msg_type ACE_INT32   
 

Set the type of the message.

Definition at line 69 of file Time_Request_Reply.cpp.

References ACE_TRACE, ACE_Time_Request::Transfer::msg_type_, and transfer_.

00070 {
00071   ACE_TRACE ("ACE_Time_Request::msg_type");
00072   this->transfer_.msg_type_ = t;
00073 }

ACE_INT32 ACE_Time_Request::msg_type void    const
 

Get the type of the message.

Definition at line 62 of file Time_Request_Reply.cpp.

References ACE_TRACE, ACE_Time_Request::Transfer::msg_type_, and transfer_.

Referenced by dump.

00063 {
00064   ACE_TRACE ("ACE_Time_Request::msg_type");
00065   return this->transfer_.msg_type_;
00066 }

ssize_t ACE_Time_Request::size void    const
 

Definition at line 54 of file Time_Request_Reply.cpp.

References ACE_TRACE, and transfer_.

Referenced by encode.

00055 {
00056   ACE_TRACE ("ACE_Time_Request::size");
00057   return sizeof (this->transfer_);
00058 }

void ACE_Time_Request::time ACE_UINT32    t
 

Definition at line 115 of file Time_Request_Reply.cpp.

References ACE_TRACE, and time_.

00116 {
00117   ACE_TRACE ("ACE_Time_Request::time");
00118   this->time_ = t;
00119 }

ACE_UINT32 ACE_Time_Request::time void    const
 

Get the time.

Definition at line 108 of file Time_Request_Reply.cpp.

References ACE_TRACE, and time_.

00109 {
00110   ACE_TRACE ("ACE_Time_Request::time");
00111   return this->time_;
00112 }

void ACE_Time_Request::timeout const ACE_Time_Value   timeout
 

Set the timeout.

Definition at line 99 of file Time_Request_Reply.cpp.

References ACE_TRACE, ACE_Time_Value::sec, ACE_Time_Request::Transfer::sec_timeout_, transfer_, ACE_Time_Value::usec, and ACE_Time_Request::Transfer::usec_timeout_.

00100 {
00101   ACE_TRACE ("ACE_Time_Request::timeout");
00102   this->transfer_.sec_timeout_  = timeout.sec ();
00103   this->transfer_.usec_timeout_ = timeout.usec ();
00104 }

ACE_Time_Value ACE_Time_Request::timeout void    const
 

Get the timeout.

Definition at line 92 of file Time_Request_Reply.cpp.

References ACE_TRACE.

Referenced by dump.

00093 {
00094   ACE_TRACE ("ACE_Time_Request::timeout");
00095   return ACE_Time_Value (this->transfer_.sec_timeout_, this->transfer_.usec_timeout_);
00096 }


Member Data Documentation

ACE_UINT32 ACE_Time_Request::time_ [private]
 

Time.

Definition at line 132 of file Time_Request_Reply.h.

Referenced by decode, and time.

Transfer ACE_Time_Request::transfer_ [private]
 

Transfer buffer.

Definition at line 129 of file Time_Request_Reply.h.

Referenced by block_forever, decode, encode, msg_type, size, and timeout.


The documentation for this class was generated from the following files:
Generated on Mon Jun 16 12:57:50 2003 for ACE by doxygen1.2.14 written by Dimitri van Heesch, © 1997-2002