From c2187ca6b61c701c281cc528db43f6b97c50f3d8 Mon Sep 17 00:00:00 2001 From: dec05eba Date: Thu, 7 Jun 2018 22:00:42 +0200 Subject: Add bootstrap node, listen method --- src/PubsubKey.cpp | 27 +++++++++++++++++++++++++++ 1 file changed, 27 insertions(+) create mode 100644 src/PubsubKey.cpp (limited to 'src/PubsubKey.cpp') diff --git a/src/PubsubKey.cpp b/src/PubsubKey.cpp new file mode 100644 index 0000000..dd807ce --- /dev/null +++ b/src/PubsubKey.cpp @@ -0,0 +1,27 @@ +#include "../include/sibs/PubsubKey.hpp" + +namespace sibs +{ + PubsubKey::PubsubKey() : + data({}) + { + + } + + PubsubKey::PubsubKey(const void *data, const usize size) + { + std::copy((char*)data, (char*)data + std::min(size, PUBSUB_KEY_LENGTH), this->data.begin()); + if(size < PUBSUB_KEY_LENGTH) + std::fill_n((char*)data + size, PUBSUB_KEY_LENGTH - size, 0); + } + + bool PubsubKey::operator == (const PubsubKey &other) const + { + return data == other.data; + } + + bool PubsubKey::operator != (const PubsubKey &other) const + { + return data != other.data; + } +} -- cgit v1.2.3