#include <Time_Request_Reply.h>
Collaboration diagram for ACE_Time_Request:
Public Types | |
enum | Constants { TIME_UPDATE = 01, MAX_TIME_LEN = MAXPATHLEN + 1 } |
Public Member Functions | |
ACE_Time_Request (void) | |
Default constructor. | |
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. | |
void | msg_type (ACE_INT32) |
Set the type of the message. | |
ACE_UINT32 | time (void) const |
Get the time. | |
void | time (ACE_UINT32 t) |
ACE_UINT32 | block_forever (void) const |
Get the blocking semantics. | |
void | block_forever (ACE_UINT32) |
Set the blocking semantics. | |
ACE_Time_Value | timeout (void) const |
Get the timeout. | |
void | timeout (const ACE_Time_Value &timeout) |
Set the timeout. | |
int | encode (void *&) |
Encode the message before transmission. | |
int | decode (void) |
Decode message after reception. | |
void | dump (void) const |
Print out the values of the message for debugging purposes. | |
Private Attributes | |
Transfer | transfer_ |
Transfer buffer. | |
ACE_UINT32 | time_ |
Time. |
This class is implemented to minimize data copying. In particular, all marshaling is done in situ...
Definition at line 37 of file Time_Request_Reply.h.
|
Definition at line 40 of file Time_Request_Reply.h.
00041 { 00042 /// Request message types. 00043 TIME_UPDATE = 01, 00044 00045 /// Class-specific constant values. 00046 MAX_TIME_LEN = MAXPATHLEN + 1 00047 }; |
|
Default constructor.
Definition at line 14 of file Time_Request_Reply.cpp. References ACE_TRACE.
00015 { 00016 ACE_TRACE ("ACE_Time_Request::ACE_Time_Request"); 00017 } |
|
Create a ACE_Time_Request message.
Definition at line 21 of file Time_Request_Reply.cpp. References ACE_TRACE, block_forever(), ACE_Time_Request::Transfer::block_forever_, msg_type(), ACE_Time_Value::sec(), ACE_Time_Request::Transfer::sec_timeout_, ACE_Time_Request::Transfer::time_, ACE_Time_Value::usec(), and ACE_Time_Request::Transfer::usec_timeout_.
00024 { 00025 ACE_TRACE ("ACE_Time_Request::ACE_Time_Request"); 00026 this->msg_type (t); 00027 00028 // If timeout is a NULL pointer, then block forever... 00029 if (timeout == 0) 00030 { 00031 this->transfer_.block_forever_ = 1; 00032 this->transfer_.sec_timeout_ = 0; 00033 this->transfer_.usec_timeout_ = 0; 00034 } 00035 else // Do a "timed wait." 00036 { 00037 this->block_forever (0); 00038 // Keep track of how long client is willing to wait. 00039 this->transfer_.sec_timeout_ = timeout->sec (); 00040 this->transfer_.usec_timeout_ = timeout->usec (); 00041 } 00042 00043 // Copy time into request 00044 this->time_ = this->transfer_.time_ = time; 00045 } |
|
Set the blocking semantics.
Definition at line 87 of file Time_Request_Reply.cpp. References ACE_TRACE, and ACE_Time_Request::Transfer::block_forever_.
00088 { 00089 ACE_TRACE ("ACE_Time_Request::block_forever"); 00090 this->transfer_.block_forever_ = bs; 00091 } |
|
Get the blocking semantics.
Definition at line 80 of file Time_Request_Reply.cpp. References ACE_TRACE, and ACE_Time_Request::Transfer::block_forever_. Referenced by ACE_Time_Request(), and dump().
00081 { 00082 ACE_TRACE ("ACE_Time_Request::block_forever"); 00083 return this->transfer_.block_forever_; 00084 } |
|
Decode message after reception.
Definition at line 145 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_, ACE_Time_Request::Transfer::time_, and ACE_Time_Request::Transfer::usec_timeout_.
00146 { 00147 ACE_TRACE ("ACE_Time_Request::decode"); 00148 // Decode 00149 this->transfer_.block_forever_ = ntohl (this->transfer_.block_forever_); 00150 this->transfer_.usec_timeout_ = ntohl (this->transfer_.usec_timeout_); 00151 this->transfer_.sec_timeout_ = ntohl (this->transfer_.sec_timeout_); 00152 this->transfer_.msg_type_ = ntohl (this->transfer_.msg_type_); 00153 this->transfer_.time_ = ntohl (this->transfer_.time_); 00154 00155 this->time_ = this->transfer_.time_; 00156 return 0; 00157 } |
|
Print out the values of the message for debugging purposes.
Definition at line 162 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().
00163 { 00164 #if defined (ACE_HAS_DUMP) 00165 ACE_TRACE ("ACE_Time_Request::dump"); 00166 ACE_DEBUG ((LM_DEBUG, ACE_LIB_TEXT ("*******\nlength = %d\n"), 00167 this->size ())); 00168 ACE_DEBUG ((LM_DEBUG, ACE_LIB_TEXT ("message-type = "))); 00169 00170 switch (this->msg_type ()) 00171 { 00172 case ACE_Time_Request::TIME_UPDATE: 00173 ACE_DEBUG ((LM_DEBUG, ACE_LIB_TEXT ("TIME_UPDATE\n"))); 00174 break; 00175 default: 00176 ACE_DEBUG ((LM_DEBUG, ACE_LIB_TEXT ("<unknown type> = %d\n"), this->msg_type ())); 00177 break; 00178 } 00179 00180 if (this->block_forever ()) 00181 ACE_DEBUG ((LM_DEBUG, ACE_LIB_TEXT ("blocking forever\n"))); 00182 else 00183 { 00184 #if !defined (ACE_NLOGGING) 00185 ACE_Time_Value tv = this->timeout (); 00186 #endif /* ! ACE_NLOGGING */ 00187 ACE_DEBUG ((LM_DEBUG, ACE_LIB_TEXT ("waiting for %d secs and %d usecs\n"), 00188 tv.sec (), tv.usec ())); 00189 } 00190 ACE_DEBUG ((LM_DEBUG, ACE_LIB_TEXT ("*******\ntime = %d\n"), 00191 this->time ())); 00192 ACE_DEBUG ((LM_DEBUG, ACE_LIB_TEXT ("+++++++\n"))); 00193 #endif /* ACE_HAS_DUMP */ 00194 } |
|
Encode the message before transmission.
Definition at line 127 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_, and ACE_Time_Request::Transfer::usec_timeout_.
00128 { 00129 ACE_TRACE ("ACE_Time_Request::encode"); 00130 // Compute the length *before* doing the marshaling. 00131 00132 buf = (void *) &this->transfer_; 00133 this->transfer_.block_forever_ = htonl (this->transfer_.block_forever_); 00134 this->transfer_.usec_timeout_ = htonl (this->transfer_.usec_timeout_); 00135 this->transfer_.sec_timeout_ = htonl (this->transfer_.sec_timeout_); 00136 this->transfer_.msg_type_ = htonl (this->transfer_.msg_type_); 00137 this->transfer_.time_ = htonl (this->transfer_.time_); 00138 00139 return this->size (); // Always fixed 00140 } |
|
Initialize length_ in order to ensure correct byte ordering before a request is sent.
Definition at line 49 of file Time_Request_Reply.cpp. References ACE_TRACE.
00050 { 00051 ACE_TRACE ("ACE_Time_Request::init"); 00052 // this->length (sizeof this->transfer_); 00053 } |
|
Set the type of the message.
Definition at line 72 of file Time_Request_Reply.cpp. References ACE_TRACE, and ACE_Time_Request::Transfer::msg_type_.
|
|
Get the type of the message.
Definition at line 65 of file Time_Request_Reply.cpp. References ACE_TRACE, and ACE_Time_Request::Transfer::msg_type_. Referenced by ACE_Time_Request(), and dump().
|
|
Definition at line 57 of file Time_Request_Reply.cpp. References ACE_TRACE. Referenced by encode().
|
|
Definition at line 118 of file Time_Request_Reply.cpp. References ACE_TRACE.
|
|
Get the time.
Definition at line 111 of file Time_Request_Reply.cpp. References ACE_TRACE.
|
|
Set the timeout.
Definition at line 102 of file Time_Request_Reply.cpp. References ACE_TRACE, ACE_Time_Value::sec(), ACE_Time_Request::Transfer::sec_timeout_, ACE_Time_Value::usec(), and ACE_Time_Request::Transfer::usec_timeout_.
00103 { 00104 ACE_TRACE ("ACE_Time_Request::timeout"); 00105 this->transfer_.sec_timeout_ = timeout.sec (); 00106 this->transfer_.usec_timeout_ = timeout.usec (); 00107 } |
|
Get the timeout.
Definition at line 95 of file Time_Request_Reply.cpp. References ACE_Time_Value, and ACE_TRACE. Referenced by dump().
00096 { 00097 ACE_TRACE ("ACE_Time_Request::timeout"); 00098 return ACE_Time_Value (this->transfer_.sec_timeout_, this->transfer_.usec_timeout_); 00099 } |
|
Time.
Definition at line 133 of file Time_Request_Reply.h. |
|
Transfer buffer.
Definition at line 130 of file Time_Request_Reply.h. |