OpenDDS  Snapshot(2023/04/28-20:55)
LogAddr.h
Go to the documentation of this file.
1 #ifndef OPENDDS_DCPS_LOGADDR_H
2 #define OPENDDS_DCPS_LOGADDR_H
3 
4 #include "dcps_export.h"
5 #include "PoolAllocator.h"
6 #include "NetworkAddress.h"
7 
9 
10 #include <ace/INET_Addr.h>
11 
12 #include <cstddef>
13 
15 
16 namespace OpenDDS {
17 namespace DCPS {
18 
20 public:
21  enum Option {Ip, Port, Host, IpPort, HostPort, IpPortHost};
22 
23  static const size_t BufSize;
24  static const String ip(const ACE_INET_Addr& addr);
25  static const String port(const ACE_INET_Addr& addr);
26  static const String host(const ACE_INET_Addr& addr);
27 
28  explicit LogAddr(const ACE_INET_Addr& addr, Option opt = IpPort);
29  explicit LogAddr(const NetworkAddress& addr, Option opt = IpPort);
30 
31  const String& str() const { return addr_; }
32  const char* c_str() const { return addr_.c_str(); }
33 
34 private:
35  void init_addr(const ACE_INET_Addr& addr, Option opt);
36 
38 };
39 
40 } // namespace DCPS
41 } // namespace OpenDDS
42 
44 
45 #endif // OPENDDS_DCPS_LOGADDR_H
std::string String
#define OpenDDS_Dcps_Export
Definition: dcps_export.h:24
static const size_t BufSize
Definition: LogAddr.h:23
const char * c_str() const
Definition: LogAddr.h:32
const String & str() const
Definition: LogAddr.h:31
#define OPENDDS_END_VERSIONED_NAMESPACE_DECL
The Internal API and Implementation of OpenDDS.
Definition: AddressCache.h:28