Hazelcast C++ Client
Hazelcast C++ Client Library
Loading...
Searching...
No Matches
hazelcast::client::address Class Reference

Represents an address of a client or member in the cluster. More...

#include <address.h>

Public Member Functions

 address (std::string hostname, int port, unsigned long scope_id)
 address ()
 Constructor.
 address (std::string url, int port)
bool operator== (const address &address) const
bool operator!= (const address &address) const
int get_port () const
bool is_ip_v4 () const
const std::string & get_host () const
unsigned long get_scope_id () const
bool operator< (const address &rhs) const
std::string to_string () const

Static Public Attributes

static constexpr int ID = 0

Friends

struct serialization::hz_serializer< address >
struct std::hash< hazelcast::client::address >

Detailed Description

Represents an address of a client or member in the cluster.

Definition at line 36 of file address.h.

Constructor & Destructor Documentation

◆ address() [1/3]

hazelcast::client::address::address ( std::string hostname,
int port,
unsigned long scope_id )

Definition at line 549 of file client_impl.cpp.

550 : host_(std::move(hostname))
551 , port_(port)
552 , type_(IPV6)
553 , scope_id_(scope_id)
554{}

◆ address() [2/3]

hazelcast::client::address::address ( )

Constructor.

Definition at line 536 of file client_impl.cpp.

537 : host_("localhost")
538 , type_(IPV4)
539 , scope_id_(0)
540{}

◆ address() [3/3]

hazelcast::client::address::address ( std::string url,
int port )

Definition at line 542 of file client_impl.cpp.

543 : host_(std::move(url))
544 , port_(port)
545 , type_(IPV4)
546 , scope_id_(0)
547{}

Member Function Documentation

◆ get_host()

const std::string & hazelcast::client::address::get_host ( ) const
Returns
host address as string

Definition at line 576 of file client_impl.cpp.

577{
578 return host_;
579}

◆ get_port()

int hazelcast::client::address::get_port ( ) const
Returns
port number.

Definition at line 570 of file client_impl.cpp.

571{
572 return port_;
573}

◆ get_scope_id()

unsigned long hazelcast::client::address::get_scope_id ( ) const

Definition at line 606 of file client_impl.cpp.

607{
608 return scope_id_;
609}

◆ is_ip_v4()

bool hazelcast::client::address::is_ip_v4 ( ) const
Returns
true if the address is ip V4 address, false otherwise.

Definition at line 600 of file client_impl.cpp.

601{
602 return type_ == IPV4;
603}

◆ operator!=()

bool hazelcast::client::address::operator!= ( const address & address) const
Parameters
addressto be compared.

Definition at line 564 of file client_impl.cpp.

565{
566 return !(*this == rhs);
567}

◆ operator<()

bool hazelcast::client::address::operator< ( const address & rhs) const

Definition at line 581 of file client_impl.cpp.

583{
584 if (host_ < rhs.host_) {
585 return true;
586 }
587 if (rhs.host_ < host_) {
588 return false;
589 }
590 if (port_ < rhs.port_) {
591 return true;
592 }
593 if (rhs.port_ < port_) {
594 return false;
595 }
596 return type_ < rhs.type_;
597}

◆ operator==()

bool hazelcast::client::address::operator== ( const address & address) const
Parameters
addressto be compared.

Definition at line 557 of file client_impl.cpp.

558{
559 return rhs.port_ == port_ && rhs.type_ == type_ &&
560 0 == rhs.host_.compare(host_);
561}

◆ to_string()

std::string hazelcast::client::address::to_string ( ) const

Definition at line 612 of file client_impl.cpp.

613{
614 std::ostringstream out;
615 out << "Address[" << get_host() << ":" << get_port() << "]";
616 return out.str();
617}
const std::string & get_host() const

◆ serialization::hz_serializer< address >

friend struct serialization::hz_serializer< address >
friend

Definition at line 108 of file address.h.

◆ std::hash< hazelcast::client::address >

friend struct std::hash< hazelcast::client::address >
friend

Definition at line 108 of file address.h.

Member Data Documentation

◆ ID

int hazelcast::client::address::ID = 0
staticconstexpr

Definition at line 44 of file address.h.


The documentation for this class was generated from the following files: