chore(pool): add const& qual, #include stuff
All checks were successful
continuous-integration/drone/push Build is passing

This commit is contained in:
surtur 2022-01-17 07:49:03 +01:00
parent e78ac038db
commit e899c03da2
Signed by: wanderer
GPG Key ID: 19CE1EC1D9E0486D
2 changed files with 15 additions and 9 deletions

View File

@ -3,15 +3,23 @@
#include "pool.h"
#include <fmt/core.h>
namespace fortuna {
namespace accumulator {
auto Pool::set_id(unsigned int id) -> void {
pool_id = id;
auto Pool::set_id(const unsigned int& id) noexcept -> void {
this->pool_id = id;
}
auto Pool::initialize_pool(unsigned int id) -> void {
auto Pool::get_id() const noexcept -> unsigned int {
return this->pool_id;
}
auto Pool::initialize_pool(const unsigned int& id) -> void {
fmt::print("\tpool init: {}\n", id);
set_id(id);
fmt::print("\tid set to: {}\n", this->get_id());
}
auto Pool::add_entropy(const uint source, const std::vector<char>& event)
@ -72,7 +80,7 @@ auto Pool::append_s(const std::string& entropy_s) -> void {
(this->s).append(std::string(entropy_s));
}
catch (const std::exception& e) {
fmt::print("{}", e.what());
fmt::print("{}\n", e.what());
}
}

8
pool.h
View File

@ -3,8 +3,6 @@
#include "util.h"
#include <fmt/core.h>
#include <stdexcept>
namespace fortuna {
namespace accumulator {
@ -15,11 +13,11 @@ public:
Pool(const Pool& pool) = delete; // no copy
~Pool() noexcept = default;
auto set_id(unsigned int id) -> void;
auto set_id(const unsigned int& id) noexcept -> void;
auto get_id() const -> unsigned int;
auto get_id() const noexcept -> unsigned int;
auto initialize_pool(unsigned int id) -> void;
auto initialize_pool(const unsigned int& id) -> void;
// add entropy contained in a random event of 1 to 32 bytes
auto add_entropy(const uint source, const std::vector<char>& event) -> int;