3 // $Id: Log_Record.inl 80826 2008-03-04 14:51:23Z wotte $
5 #include "ace/Global_Macros.h"
6 #include "ace/os_include/arpa/os_inet.h"
7 #include "ace/Time_Value.h"
8 #include "ace/OS_NS_string.h"
10 ACE_BEGIN_VERSIONED_NAMESPACE_DECL
13 ACE_Log_Record::~ACE_Log_Record (void)
16 delete [] this->msg_data_;
20 ACE_Log_Record::encode (void)
22 ACE_TRACE ("ACE_Log_Record::encode");
23 #if !defined (ACE_LACKS_HTONL)
24 this->length_ = htonl (this->length_);
25 this->type_ = htonl (this->type_);
26 // Make sure we don't enclose the sec() and usec() fields until
27 // they've been normalized.
28 // secs_ is commented out because it can be 64 bits. This method is
29 // deprecated; use the CDR operations instead.
30 // this->secs_ = htonl (this->secs_);
31 this->usecs_ = htonl (this->usecs_);
32 this->pid_ = htonl (this->pid_);
33 #endif /* ACE_LACKS_HTONL */
37 ACE_Log_Record::decode (void)
39 ACE_TRACE ("ACE_Log_Record::decode");
40 #if !defined (ACE_LACKS_NTOHL)
41 ACE_Time_Value tv (this->secs_,
42 ntohl (this->usecs_));
44 this->secs_ = tv.sec ();
45 this->usecs_ = tv.usec ();
46 this->type_ = ntohl (this->type_);
47 this->pid_ = ntohl (this->pid_);
48 this->length_ = ntohl (this->length_);
49 #endif /* ACE_LACKS_NTOHL */
53 ACE_Log_Record::type (void) const
55 ACE_TRACE ("ACE_Log_Record::type");
60 ACE_Log_Record::type (ACE_UINT32 t)
62 ACE_TRACE ("ACE_Log_Record::type");
67 ACE_Log_Record::length (void) const
69 ACE_TRACE ("ACE_Log_Record::length");
70 return (long) this->length_;
74 ACE_Log_Record::length (long l)
76 ACE_TRACE ("ACE_Log_Record::length");
77 this->length_ = static_cast<ACE_UINT32> (l);
80 ACE_INLINE ACE_Time_Value
81 ACE_Log_Record::time_stamp (void) const
83 ACE_TRACE ("ACE_Log_Record::time_stamp");
84 return ACE_Time_Value (this->secs_, (long) this->usecs_);
88 ACE_Log_Record::time_stamp (const ACE_Time_Value &ts)
90 ACE_TRACE ("ACE_Log_Record::time_stamp");
91 this->secs_ = ts.sec ();
92 this->usecs_ = (ACE_UINT32) ts.usec ();
96 ACE_Log_Record::pid (void) const
98 ACE_TRACE ("ACE_Log_Record::pid");
99 return (long) this->pid_;
103 ACE_Log_Record::pid (long p)
105 ACE_TRACE ("ACE_Log_Record::pid");
106 this->pid_ = (ACE_UINT32) p;
109 ACE_INLINE const ACE_TCHAR *
110 ACE_Log_Record::msg_data (void) const
112 ACE_TRACE ("ACE_Log_Record::msg_data");
113 return this->msg_data_;
117 ACE_Log_Record::msg_data_len (void) const
119 ACE_TRACE ("ACE_Log_Record::msg_data_len");
120 return ACE_OS::strlen (this->msg_data_) + 1;
123 ACE_END_VERSIONED_NAMESPACE_DECL