summaryrefslogtreecommitdiff
path: root/cpp/src/qpid/cluster/Cpg.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'cpp/src/qpid/cluster/Cpg.cpp')
-rw-r--r--cpp/src/qpid/cluster/Cpg.cpp11
1 files changed, 11 insertions, 0 deletions
diff --git a/cpp/src/qpid/cluster/Cpg.cpp b/cpp/src/qpid/cluster/Cpg.cpp
index 96a5b3da43..2a77fa437a 100644
--- a/cpp/src/qpid/cluster/Cpg.cpp
+++ b/cpp/src/qpid/cluster/Cpg.cpp
@@ -183,4 +183,15 @@ ostream& operator<<(ostream& o, const ConnectionId& c) {
return o << c.first << "-" << c.second;
}
+std::string MemberId::str() const {
+ char s[8];
+ reinterpret_cast<uint32_t&>(s[0]) = htonl(first);
+ reinterpret_cast<uint32_t&>(s[4]) = htonl(second);
+ return std::string(s,8);
+}
+
+MemberId::MemberId(const std::string& s) {
+ first = ntohl(reinterpret_cast<const uint32_t&>(s[0]));
+ second = ntohl(reinterpret_cast<const uint32_t&>(s[4]));
+}
}} // namespace qpid::cluster