Fixed typos
[ACE_TAO.git] / ACE / ace / DEV_Addr.cpp
blobc5c2cc3bc53f7832266ef3af7f8bf5f068db2ab7
1 #include "ace/DEV_Addr.h"
2 #if !defined (__ACE_INLINE__)
3 #include "ace/DEV_Addr.inl"
4 #endif /* __ACE_INLINE__ */
6 #include "ace/Log_Category.h"
7 #include "ace/OS_NS_string.h"
8 #if defined (ACE_HAS_ALLOC_HOOKS)
9 # include "ace/Malloc_Base.h"
10 #endif /* ACE_HAS_ALLOC_HOOKS */
12 ACE_BEGIN_VERSIONED_NAMESPACE_DECL
14 ACE_ALLOC_HOOK_DEFINE(ACE_DEV_Addr)
16 // Transform the current address into string format.
18 int
19 ACE_DEV_Addr::addr_to_string (ACE_TCHAR *s, size_t len) const
21 ACE_TRACE ("ACE_DEV_Addr::addr_to_string");
23 ACE_OS::strsncpy (s, this->devname_, len);
24 return 0;
27 // Return a pointer to the address.
29 void *
30 ACE_DEV_Addr::get_addr (void) const
32 ACE_TRACE ("ACE_DEV_Addr::get_addr");
34 return (void *) &this->devname_;
37 void
38 ACE_DEV_Addr::dump (void) const
40 #if defined (ACE_HAS_DUMP)
41 ACE_TRACE ("ACE_DEV_Addr::dump");
43 ACELIB_DEBUG ((LM_DEBUG, ACE_BEGIN_DUMP, this));
44 ACELIB_DEBUG ((LM_DEBUG, ACE_TEXT ("devname_ = %s"), this->devname_));
45 ACELIB_DEBUG ((LM_DEBUG, ACE_END_DUMP));
46 #endif /* ACE_HAS_DUMP */
49 // Do nothing constructor.
51 ACE_DEV_Addr::ACE_DEV_Addr (void)
52 : ACE_Addr (AF_DEV, sizeof this->devname_)
54 ACE_TRACE ("ACE_DEV_Addr::ACE_DEV_Addr");
56 (void) ACE_OS::memset ((void *) &this->devname_,
57 0, sizeof this->devname_);
60 int
61 ACE_DEV_Addr::set (const ACE_DEV_Addr &sa)
63 this->base_set (sa.get_type (), sa.get_size ());
65 if (sa.get_type () == AF_ANY)
66 (void) ACE_OS::memset ((void *) &this->devname_,
68 sizeof this->devname_);
69 else
70 (void) ACE_OS::strsncpy (this->devname_,
71 sa.devname_,
72 ACE_DEV_Addr::DEVNAME_LENGTH);
73 return 0;
76 // Copy constructor.
78 ACE_DEV_Addr::ACE_DEV_Addr (const ACE_DEV_Addr &sa)
79 : ACE_Addr (AF_DEV, sizeof this->devname_)
81 ACE_TRACE ("ACE_DEV_Addr::ACE_DEV_Addr");
83 this->set (sa);
86 ACE_DEV_Addr::ACE_DEV_Addr (const ACE_TCHAR *devname)
87 : ACE_Addr (AF_DEV, sizeof this->devname_)
89 ACE_TRACE ("ACE_DEV_Addr::ACE_DEV_Addr");
91 this->set (devname);
94 ACE_DEV_Addr &
95 ACE_DEV_Addr::operator= (const ACE_DEV_Addr &sa)
97 ACE_TRACE ("ACE_DEV_Addr::operator=");
99 if (this != &sa)
100 this->set (sa);
102 return *this;
105 ACE_END_VERSIONED_NAMESPACE_DECL