A ZGPeerID is a 128-bit integer that uniquely represents a particular peer in a ZG system. More...
#include <ZGPeerID.h>
Public Member Functions | |
ZGPeerID () | |
Default constructor – sets the ZGPeerID to its invalid state (all zeroes) More... | |
ZGPeerID (uint64 highBits, uint64 lowBits) | |
Explicit constructor. More... | |
bool | operator== (const ZGPeerID &rhs) const |
Equality operator; returns true iff this ZGPeerID is equal to (rhs) More... | |
bool | operator!= (const ZGPeerID &rhs) const |
Inequality operator; returns true iff this ZGPeerID is not equal to (rhs) More... | |
bool | operator< (const ZGPeerID &rhs) const |
Comparison operator; returns true iff this ZGPeerID is less than (rhs) More... | |
bool | operator>= (const ZGPeerID &rhs) const |
Comparison operator; returns true iff this ZGPeerID is greater than or equal to (rhs) More... | |
bool | operator> (const ZGPeerID &rhs) const |
Comparison operator; returns true iff this ZGPeerID is greater than (rhs) More... | |
bool | operator<= (const ZGPeerID &rhs) const |
Comparison operator; returns true iff this ZGPeerID is less than or equal to (rhs) More... | |
ZGPeerID & | operator= (const ZGPeerID &rhs) |
Assignment operator. More... | |
bool | IsValid () const |
Returns true iff the ZGPeerID has any non-zero bits in it. More... | |
void | FromString (const String &s) |
Sets this peer ID from the specified String representation (in the format used by ToString()), or to zero if the string isn't parsed. More... | |
String | ToString () const |
Returns a String representation of this peer ID (e.g. More... | |
uint32 | CalculateChecksum () const |
Returns a 32-bit checksum for this object. More... | |
void | Flatten (uint8 *buffer) const |
Copies this point into an endian-neutral flattened buffer. More... | |
status_t | Unflatten (const uint8 *buffer, uint32 size) |
Restores this point from an endian-neutral flattened buffer. More... | |
uint32 | HashCode () const |
This is implemented so that if ZGPeerID is used as the key in a Hashtable, the HashCode() method will be selected by the AutoChooseHashFunctor template logic, instead of the PODHashFunctor. More... | |
Static Public Member Functions | |
static MUSCLE_CONSTEXPR bool | IsFixedSize () |
Part of the Flattenable pseudo-interface: Returns true. More... | |
static MUSCLE_CONSTEXPR uint32 | TypeCode () |
Part of the Flattenable pseudo-interface: Returns ZG_PEER_ID_TYPE. More... | |
static MUSCLE_CONSTEXPR bool | AllowsTypeCode (uint32 tc) |
Returns true iff (tc) equals ZG_PEER_ID_TYPE. More... | |
static MUSCLE_CONSTEXPR uint32 | FlattenedSize () |
Part of the Flattenable pseudo-interface: 2*sizeof(uint64) More... | |
A ZGPeerID is a 128-bit integer that uniquely represents a particular peer in a ZG system.
A peer's ZGPeerID is assigned to at startup, and will never change over the course of the peer's lifetime. It will be different for each ZG peer process that is started.
Definition at line 18 of file ZGPeerID.h.
|
inline |
Default constructor – sets the ZGPeerID to its invalid state (all zeroes)
Definition at line 22 of file ZGPeerID.h.
|
inline |
Explicit constructor.
Definition at line 28 of file ZGPeerID.h.
|
inlinestatic |
Returns true iff (tc) equals ZG_PEER_ID_TYPE.
Definition at line 98 of file ZGPeerID.h.
References ZGPeerID::TypeCode().
|
inline |
Returns a 32-bit checksum for this object.
Definition at line 104 of file ZGPeerID.h.
Referenced by ZGPeerID::HashCode().
|
inline |
Copies this point into an endian-neutral flattened buffer.
buffer | Points to an array of at least FlattenedSize() bytes. |
Definition at line 109 of file ZGPeerID.h.
|
inlinestatic |
Part of the Flattenable pseudo-interface: 2*sizeof(uint64)
Definition at line 101 of file ZGPeerID.h.
Referenced by ZGPeerID::Unflatten().
|
inline |
Sets this peer ID from the specified String representation (in the format used by ToString()), or to zero if the string isn't parsed.
s | A human-readable string (e.g. "123A:432B") that we will set this ZGPeerID's state from |
Definition at line 71 of file ZGPeerID.h.
|
inline |
This is implemented so that if ZGPeerID is used as the key in a Hashtable, the HashCode() method will be selected by the AutoChooseHashFunctor template logic, instead of the PODHashFunctor.
Definition at line 134 of file ZGPeerID.h.
References ZGPeerID::CalculateChecksum().
|
inlinestatic |
Part of the Flattenable pseudo-interface: Returns true.
Definition at line 92 of file ZGPeerID.h.
|
inline |
Returns true iff the ZGPeerID has any non-zero bits in it.
(An all-zero ZGPeerID is considered an invalid/null ID)
Definition at line 66 of file ZGPeerID.h.
|
inline |
Inequality operator; returns true iff this ZGPeerID is not equal to (rhs)
rhs | The ZGPeerID to compare to |
Definition at line 38 of file ZGPeerID.h.
|
inline |
Comparison operator; returns true iff this ZGPeerID is less than (rhs)
rhs | The ZGPeerID to compare to |
Definition at line 43 of file ZGPeerID.h.
|
inline |
Comparison operator; returns true iff this ZGPeerID is less than or equal to (rhs)
rhs | The ZGPeerID to compare to |
Definition at line 58 of file ZGPeerID.h.
Assignment operator.
Sets (*this) to be the same as (rhs)
rhs | The ZGPeerID to copy the state of |
Definition at line 63 of file ZGPeerID.h.
|
inline |
Equality operator; returns true iff this ZGPeerID is equal to (rhs)
rhs | The ZGPeerID to compare to |
Definition at line 33 of file ZGPeerID.h.
|
inline |
Comparison operator; returns true iff this ZGPeerID is greater than (rhs)
rhs | The ZGPeerID to compare to |
Definition at line 53 of file ZGPeerID.h.
|
inline |
Comparison operator; returns true iff this ZGPeerID is greater than or equal to (rhs)
rhs | The ZGPeerID to compare to |
Definition at line 48 of file ZGPeerID.h.
|
inline |
Returns a String representation of this peer ID (e.g.
"123A:432B")
Definition at line 84 of file ZGPeerID.h.
|
inlinestatic |
Part of the Flattenable pseudo-interface: Returns ZG_PEER_ID_TYPE.
Definition at line 95 of file ZGPeerID.h.
References zg::ZG_PEER_ID_TYPE.
Referenced by ZGPeerID::AllowsTypeCode().
|
inline |
Restores this point from an endian-neutral flattened buffer.
buffer | Points to an array of (size) bytes |
size | The number of bytes (buffer) points to (should be at least FlattenedSize()) |
Definition at line 120 of file ZGPeerID.h.
References ZGPeerID::FlattenedSize().