[style] main namespace renamed to SCORE

based on new suggested project name
This commit is contained in:
Artur Mukhamadiev 2026-03-11 16:37:39 +03:00
parent 46cf56196e
commit e0295f21b5
20 changed files with 34 additions and 34 deletions

View File

@ -3,7 +3,7 @@
#include <iostream> #include <iostream>
#include <string> #include <string>
#include "export.h" #include "export.h"
namespace cloud_point_rpc { namespace score {
/** /**
* @brief Runs the CLI client. * @brief Runs the CLI client.

View File

@ -6,7 +6,7 @@
#include <vector> #include <vector>
#include <yaml-cpp/yaml.h> #include <yaml-cpp/yaml.h>
namespace cloud_point_rpc { namespace score {
struct ServerConfig { struct ServerConfig {
std::string ip; std::string ip;

View File

@ -6,7 +6,7 @@
#include <jsonrpccxx/client.hpp> #include <jsonrpccxx/client.hpp>
#include <nlohmann/json.hpp> #include <nlohmann/json.hpp>
#include <vector> #include <vector>
namespace cloud_point_rpc { namespace score {
class RpcClient : public jsonrpccxx::JsonRpcClient { class RpcClient : public jsonrpccxx::JsonRpcClient {
public: public:

View File

@ -16,7 +16,7 @@ struct rpc_string {
}; };
} }
namespace cloud_point_rpc { namespace score {
class CRPC_EXPORT RpcServer { class CRPC_EXPORT RpcServer {
public: public:

View File

@ -5,7 +5,7 @@
#include <type_traits> #include <type_traits>
#include <vector> #include <vector>
namespace cloud_point_rpc { namespace score {
template <typename T> template <typename T>
concept NumericType = requires(T param) { concept NumericType = requires(T param) {

View File

@ -3,7 +3,7 @@
#include "cloud_point_rpc/config.hpp" #include "cloud_point_rpc/config.hpp"
#include <vector> #include <vector>
#include "export.h" #include "export.h"
namespace cloud_point_rpc { namespace score {
class CRPC_EXPORT Service { class CRPC_EXPORT Service {
public: public:

View File

@ -6,7 +6,7 @@
#include <glog/logging.h> #include <glog/logging.h>
#include <string> #include <string>
#include "export.h" #include "export.h"
namespace cloud_point_rpc { namespace score {
/** /**
* TCPConnector main purpose is to implement jsonrpccxx::IClientConnector Send * TCPConnector main purpose is to implement jsonrpccxx::IClientConnector Send
* method As an internal implementation, TCPConnector adds to the beginning of * method As an internal implementation, TCPConnector adds to the beginning of

View File

@ -3,7 +3,7 @@
#include <asio.hpp> #include <asio.hpp>
#include <cloud_point_rpc/serialize.hpp> #include <cloud_point_rpc/serialize.hpp>
#include <glog/logging.h> #include <glog/logging.h>
namespace cloud_point_rpc { namespace score {
static inline std::string tcp_read(asio::ip::tcp::socket &socket, static inline std::string tcp_read(asio::ip::tcp::socket &socket,
std::string_view prefix) { std::string_view prefix) {

View File

@ -10,7 +10,7 @@
#include "export.h" #include "export.h"
#include <list> #include <list>
#include <ranges> #include <ranges>
namespace cloud_point_rpc { namespace score {
class CRPC_EXPORT TcpServer { class CRPC_EXPORT TcpServer {
public: public:

View File

@ -3,7 +3,7 @@
#include <glog/logging.h> #include <glog/logging.h>
#include <string> #include <string>
namespace cloud_point_rpc { namespace score {
void print_menu(std::ostream &output) { void print_menu(std::ostream &output) {
output << "\n=== Cloud Point RPC CLI ===" << std::endl; output << "\n=== Cloud Point RPC CLI ===" << std::endl;

View File

@ -24,8 +24,8 @@ int main(int argc, char *argv[]) {
f.close(); f.close();
try { try {
auto config = cloud_point_rpc::ConfigLoader::load(config_path); auto config = score::ConfigLoader::load(config_path);
return cloud_point_rpc::run_cli(std::cin, std::cout, config.server.ip, return score::run_cli(std::cin, std::cout, config.server.ip,
config.server.port); config.server.port);
} catch (const std::exception &e) { } catch (const std::exception &e) {
std::cerr << "Failed to start CLI: " << e.what() << std::endl; std::cerr << "Failed to start CLI: " << e.what() << std::endl;

View File

@ -2,7 +2,7 @@
#include <glog/logging.h> #include <glog/logging.h>
using json = nlohmann::json; using json = nlohmann::json;
namespace cloud_point_rpc { namespace score {
namespace { namespace {
json create_error(int code, const std::string &message, json create_error(int code, const std::string &message,

View File

@ -9,8 +9,8 @@
#include <list> #include <list>
static std::list<std::unique_ptr<rpc_string>> gc; static std::list<std::unique_ptr<rpc_string>> gc;
cloud_point_rpc::RpcServer rpc_server; score::RpcServer rpc_server;
std::unique_ptr<cloud_point_rpc::TcpServer> server = nullptr; std::unique_ptr<score::TcpServer> server = nullptr;
extern "C" { extern "C" {
@ -40,10 +40,10 @@ void crpc_init(const char* config_path) {
LOG(INFO) << "config_path was not provided"; LOG(INFO) << "config_path was not provided";
} }
try { try {
auto config = cloud_point_rpc::ConfigLoader::load(config_path); auto config = score::ConfigLoader::load(config_path);
LOG(INFO) << "Loaded config from " << config_path; LOG(INFO) << "Loaded config from " << config_path;
server = std::make_unique<cloud_point_rpc::TcpServer>(config.server.ip, config.server.port, server = std::make_unique<score::TcpServer>(config.server.ip, config.server.port,
[&](const std::string &request) { [&](const std::string &request) {
return rpc_server.process( return rpc_server.process(
request); request);

View File

@ -20,12 +20,12 @@ int main(int argc, char *argv[]) {
LOG(INFO) << "Starting Cloud Point RPC Server (Test Mock)..."; LOG(INFO) << "Starting Cloud Point RPC Server (Test Mock)...";
try { try {
auto config = cloud_point_rpc::ConfigLoader::load(config_path); auto config = score::ConfigLoader::load(config_path);
LOG(INFO) << "Loaded config from " << config_path; LOG(INFO) << "Loaded config from " << config_path;
// Inject test data into service // Inject test data into service
cloud_point_rpc::Service service(config.test_data); score::Service service(config.test_data);
cloud_point_rpc::RpcServer rpc_server; score::RpcServer rpc_server;
rpc_server.register_method("get-intrinsic-params", [&](const json &) { rpc_server.register_method("get-intrinsic-params", [&](const json &) {
return service.get_intrinsic_params(); return service.get_intrinsic_params();
@ -39,7 +39,7 @@ int main(int argc, char *argv[]) {
return service.get_cloud_point(); return service.get_cloud_point();
}); });
cloud_point_rpc::TcpServer server(config.server.ip, config.server.port, score::TcpServer server(config.server.ip, config.server.port,
[&](const std::string &request) { [&](const std::string &request) {
return rpc_server.process( return rpc_server.process(
request); request);

View File

@ -1,6 +1,6 @@
#include "cloud_point_rpc/service.hpp" #include "cloud_point_rpc/service.hpp"
namespace cloud_point_rpc { namespace score {
Service::Service(const TestData &data) : data_(data) {} Service::Service(const TestData &data) : data_(data) {}

View File

@ -121,7 +121,7 @@ class TestThread {
calls_queue = std::queue<std::string>(); calls_queue = std::queue<std::string>();
methods.clear(); methods.clear();
state.store(true, std::memory_order_relaxed); state.store(true, std::memory_order_relaxed);
server = cloud_point_rpc::RpcServer(); server = score::RpcServer();
} }
private: private:
@ -131,7 +131,7 @@ class TestThread {
std::set<std::string> methods{}; std::set<std::string> methods{};
std::jthread thr; std::jthread thr;
std::mutex mtx; std::mutex mtx;
cloud_point_rpc::RpcServer server; score::RpcServer server;
std::chrono::duration<int64_t, std::milli> thr_sleep{50}; std::chrono::duration<int64_t, std::milli> thr_sleep{50};
} test; } test;

View File

@ -9,7 +9,7 @@
#include "cloud_point_rpc/rpc_server.hpp" #include "cloud_point_rpc/rpc_server.hpp"
#include "cloud_point_rpc/tcp_server.hpp" #include "cloud_point_rpc/tcp_server.hpp"
using namespace cloud_point_rpc; using namespace score;
class CliTest : public ::testing::Test { class CliTest : public ::testing::Test {
public: public:

View File

@ -11,7 +11,7 @@
#include <fstream> #include <fstream>
using namespace cloud_point_rpc; using namespace score;
class IntegrationTest : public ::testing::Test { class IntegrationTest : public ::testing::Test {
protected: protected:

View File

@ -7,7 +7,7 @@
#include <vector> #include <vector>
using json = nlohmann::json; using json = nlohmann::json;
using namespace cloud_point_rpc; using namespace score;
class RpcServerTest : public ::testing::Test { class RpcServerTest : public ::testing::Test {
protected: protected:

View File

@ -15,11 +15,11 @@ class TcpTest : public ::testing::Test {
protected: protected:
void SetUp() override { void SetUp() override {
server_ = std::make_unique<cloud_point_rpc::TcpServer>( server_ = std::make_unique<score::TcpServer>(
"127.0.0.1", 12345, [this](const std::string &request) { "127.0.0.1", 12345, [this](const std::string &request) {
EXPECT_EQ(request, expected_); EXPECT_EQ(request, expected_);
std::string msg = "Echo: " + request; std::string msg = "Echo: " + request;
auto v = cloud_point_rpc::serialize(msg.length()); auto v = score::serialize(msg.length());
std::string res(v.begin(), v.end()); std::string res(v.begin(), v.end());
res += msg; res += msg;
return res; return res;
@ -33,19 +33,19 @@ class TcpTest : public ::testing::Test {
} }
std::string expected_; std::string expected_;
std::unique_ptr<cloud_point_rpc::TcpServer> server_; std::unique_ptr<score::TcpServer> server_;
}; };
TEST(SerializeTest, Base) { TEST(SerializeTest, Base) {
uint64_t value{123}; uint64_t value{123};
auto res = cloud_point_rpc::serialize(value); auto res = score::serialize(value);
EXPECT_EQ(value, cloud_point_rpc::deserialize<uint64_t>(res)); EXPECT_EQ(value, score::deserialize<uint64_t>(res));
} }
TEST_F(TcpTest, EchoTest) { TEST_F(TcpTest, EchoTest) {
constexpr std::string_view msg = "Hello, TCP Server!"; constexpr std::string_view msg = "Hello, TCP Server!";
ExpectedResponse(msg.data()); ExpectedResponse(msg.data());
cloud_point_rpc::TCPConnector connector("127.0.0.1", 12345); score::TCPConnector connector("127.0.0.1", 12345);
auto res = connector.Send(msg.data()); auto res = connector.Send(msg.data());
} }
@ -53,6 +53,6 @@ TEST_F(TcpTest, HugeBuffer) {
static constexpr uint64_t w = 1280, h = 720, c = 3; static constexpr uint64_t w = 1280, h = 720, c = 3;
std::string data(w * h * c, 77); std::string data(w * h * c, 77);
ExpectedResponse(data); ExpectedResponse(data);
cloud_point_rpc::TCPConnector connector("127.0.0.1", 12345); score::TCPConnector connector("127.0.0.1", 12345);
auto res = connector.Send(data); auto res = connector.Send(data);
} }