parselink-old/source/client/client.h

49 lines
1.3 KiB
C++

//-----------------------------------------------------------------------------
// ___ __ _ _
// / _ \__ _ _ __ ___ ___ / /(_)_ __ | | __
// / /_)/ _` | '__/ __|/ _ \/ / | | '_ \| |/ /
// / ___/ (_| | | \__ \ __/ /__| | | | | <
// \/ \__,_|_| |___/\___\____/_|_| |_|_|\_\ .
//
//-----------------------------------------------------------------------------
// Author: Kurt Sassenrath
// Module: Client
//
// Client interface.
//
// Copyright (c) 2023 Kurt Sassenrath.
//
// License TBD.
//-----------------------------------------------------------------------------
#ifndef client_d7b353c402e38bfe
#define client_d7b353c402e38bfe
#include <concepts>
#include <cstdint>
#include <string>
#include <system_error>
namespace parselink {
namespace client {
struct config {
std::string server_address;
std::uint16_t server_port;
std::string websocket_address;
std::uint16_t websocket_port;
};
template <typename T>
concept interface =
std::is_constructible_v<T, config const&> && requires(T& client) {
{ client.run() } -> std::same_as<std::error_code>;
};
std::error_code create_and_run(config const& cfg) noexcept;
} // namespace client
} // namespace parselink
#endif // client_d7b353c402e38bfe