fipa_services
Address.hpp
Go to the documentation of this file.
1 #ifndef FIPA_SERVICES_TRANSPORTS_ADDRESS_HPP
2 #define FIPA_SERVICES_TRANSPORTS_ADDRESS_HPP
3 
4 #include <string>
5 #include <stdint.h>
6 
7 namespace fipa {
8 namespace services {
9 namespace transports {
10 
15 struct Address
16 {
17  std::string ip;
18  uint16_t port;
19  std::string protocol;
20 
21  Address() {}
22 
23  // Default protocol is udt.
24  Address(const std::string& ip, uint16_t port, const std::string& protocol = "udt");
25 
30  std::string toString() const;
31 
36  static Address fromString(const std::string& address);
37 
42  bool operator==(const Address& other) const;
43 
44  bool operator!=(const Address& other) const { return !this->operator==(other); }
45 
50  bool operator<(const Address& other) const;
51 };
52 
53 } // end namespace transports
54 } // end namespace services
55 } // end namespace fipa
56 #endif // FIPA_SERVICES_TRANSPORTS_ADDRESS_HPP
std::string ip
Definition: Address.hpp:17
uint16_t port
Definition: Address.hpp:18
Communication address specified by IP, port, and protocol.
Definition: Address.hpp:15
static Address fromString(const std::string &address)
Definition: Address.cpp:22
Address()
Definition: Address.hpp:21
std::string toString() const
Definition: Address.cpp:17
bool operator<(const Address &other) const
Definition: Address.cpp:42
bool operator==(const Address &other) const
Definition: Address.cpp:37
bool operator!=(const Address &other) const
Definition: Address.hpp:44
std::string protocol
Definition: Address.hpp:19
Definition: DistributedServiceDirectory.cpp:5