Skip to content

Commit

Permalink
re organize code (#15)
Browse files Browse the repository at this point in the history
  • Loading branch information
fpelliccioni committed May 31, 2023
1 parent 6994741 commit 8ae56b7
Show file tree
Hide file tree
Showing 2 changed files with 52 additions and 8 deletions.
16 changes: 16 additions & 0 deletions include/kth/node/executor/executor.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,22 @@

namespace kth::node {


static constexpr
std::string_view march_names();

static constexpr
std::string_view node_version();

static constexpr
std::string_view currency_symbol();

static constexpr
std::string_view currency();

static constexpr
std::string_view db_type();

class executor {
public:
executor(kth::node::configuration const& config, bool stdout_enabled = true);
Expand Down
44 changes: 36 additions & 8 deletions src/executor/executor.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,42 @@ static constexpr int directory_exists = 0;
static constexpr int directory_not_found = 2;
static auto const mode = std::ofstream::out | std::ofstream::app;


static constexpr
std::string_view microarchitecture() {
return KTH_MICROARCHITECTURE_STR;
}

static constexpr
std::string_view march_names() {
#if defined(KTH_MARCH_NAMES_FULL_STR)
return KTH_MARCH_NAMES_FULL_STR;
#else
return "unknown";
#endif
}

static constexpr
std::string_view node_version() {
return KTH_NODE_VERSION;
}

static constexpr
std::string_view currency_symbol() {
return KTH_CURRENCY_SYMBOL_STR;
}

static constexpr
std::string_view currency() {
return KTH_CURRENCY_STR;
}

static constexpr
std::string_view db_type() {
return KTH_DB_TYPE;
}


std::promise<kth::code> executor::stopping_; //NOLINT

executor::executor(kth::node::configuration const& config, bool stdout_enabled /*= true*/)
Expand Down Expand Up @@ -115,14 +151,6 @@ executor::executor(kth::node::configuration const& config, bool stdout_enabled /
//handle_stop(initialize_stop);
}

static constexpr std::string_view march_names() {
#if defined(KTH_MARCH_NAMES_FULL_STR)
return KTH_MARCH_NAMES_FULL_STR;
#else
return "unknown";
#endif
}

void executor::print_version(std::string_view extra) {
std::cout << fmt::format(KTH_VERSION_MESSAGE, KTH_NODE_VERSION, extra, KTH_CURRENCY_SYMBOL_STR, KTH_MICROARCHITECTURE_STR, march_names(), KTH_DB_TYPE) << std::endl;
}
Expand Down

0 comments on commit 8ae56b7

Please sign in to comment.