DEV_Addr.cpp

Go to the documentation of this file.
00001 // DEV_Addr.cpp,v 4.17 2005/10/28 16:14:52 ossama Exp
00002 
00003 #include "ace/DEV_Addr.h"
00004 #if !defined (__ACE_INLINE__)
00005 #include "ace/DEV_Addr.inl"
00006 #endif /* __ACE_INLINE__ */
00007 
00008 #include "ace/Log_Msg.h"
00009 #include "ace/OS_NS_string.h"
00010 
00011 ACE_RCSID (ace,
00012            DEV_Addr,
00013            "DEV_Addr.cpp,v 4.17 2005/10/28 16:14:52 ossama Exp")
00014 
00015 ACE_BEGIN_VERSIONED_NAMESPACE_DECL
00016 
00017 ACE_ALLOC_HOOK_DEFINE(ACE_DEV_Addr)
00018 
00019 // Transform the current address into string format.
00020 
00021 int
00022 ACE_DEV_Addr::addr_to_string (ACE_TCHAR *s, size_t len) const
00023 {
00024   ACE_TRACE ("ACE_DEV_Addr::addr_to_string");
00025 
00026   ACE_OS::strsncpy (s, this->devname_, len);
00027   return 0;
00028 }
00029 
00030 // Return a pointer to the address.
00031 
00032 void *
00033 ACE_DEV_Addr::get_addr (void) const
00034 {
00035   ACE_TRACE ("ACE_DEV_Addr::get_addr");
00036 
00037   return (void *) &this->devname_;
00038 }
00039 
00040 void
00041 ACE_DEV_Addr::dump (void) const
00042 {
00043 #if defined (ACE_HAS_DUMP)
00044   ACE_TRACE ("ACE_DEV_Addr::dump");
00045 
00046   ACE_DEBUG ((LM_DEBUG, ACE_BEGIN_DUMP, this));
00047   ACE_DEBUG ((LM_DEBUG, ACE_LIB_TEXT ("devname_ = %s"), this->devname_));
00048   ACE_DEBUG ((LM_DEBUG, ACE_END_DUMP));
00049 #endif /* ACE_HAS_DUMP */
00050 }
00051 
00052 // Do nothing constructor.
00053 
00054 ACE_DEV_Addr::ACE_DEV_Addr (void)
00055   : ACE_Addr (AF_DEV, sizeof this->devname_)
00056 {
00057   ACE_TRACE ("ACE_DEV_Addr::ACE_DEV_Addr");
00058 
00059   (void) ACE_OS::memset ((void *) &this->devname_,
00060                          0, sizeof this->devname_);
00061 }
00062 
00063 int
00064 ACE_DEV_Addr::set (const ACE_DEV_Addr &sa)
00065 {
00066   this->base_set (sa.get_type (), sa.get_size ());
00067 
00068   if (sa.get_type () == AF_ANY)
00069     (void) ACE_OS::memset ((void *) &this->devname_,
00070                            0,
00071                            sizeof this->devname_);
00072   else
00073     (void) ACE_OS::strsncpy (this->devname_,
00074                              sa.devname_,
00075                              ACE_DEV_Addr::DEVNAME_LENGTH);
00076   return 0;
00077 }
00078 
00079 // Copy constructor.
00080 
00081 ACE_DEV_Addr::ACE_DEV_Addr (const ACE_DEV_Addr &sa)
00082   : ACE_Addr (AF_DEV, sizeof this->devname_)
00083 {
00084   ACE_TRACE ("ACE_DEV_Addr::ACE_DEV_Addr");
00085 
00086   this->set (sa);
00087 }
00088 
00089 ACE_DEV_Addr::ACE_DEV_Addr (const ACE_TCHAR *devname)
00090   : ACE_Addr (AF_DEV, sizeof this->devname_)
00091 {
00092   ACE_TRACE ("ACE_DEV_Addr::ACE_DEV_Addr");
00093 
00094   this->set (devname);
00095 }
00096 
00097 ACE_DEV_Addr &
00098 ACE_DEV_Addr::operator= (const ACE_DEV_Addr &sa)
00099 {
00100   ACE_TRACE ("ACE_DEV_Addr::operator=");
00101 
00102   if (this != &sa)
00103     this->set (sa);
00104 
00105   return *this;
00106 }
00107 
00108 ACE_END_VERSIONED_NAMESPACE_DECL

Generated on Thu Nov 9 09:41:50 2006 for ACE by doxygen 1.3.6