84 lines
2.8 KiB
C++
84 lines
2.8 KiB
C++
//
|
|
// Created by Kirill Zhukov on 20.04.2025.
|
|
//
|
|
|
|
#include "Command.h"
|
|
|
|
namespace usub::core
|
|
{
|
|
// Command::Command() : op(OperationType::UNKNOWN), value_size(0), response_ready(0), response_size(0)
|
|
// {
|
|
// std::memset(value, 0, sizeof(value));
|
|
// std::memset(response, 0, sizeof(response));
|
|
// }
|
|
//
|
|
// Command::Command(const Command& other)
|
|
// : op(other.op),
|
|
// key(other.key),
|
|
// value_size(0),
|
|
// response_ready(false),
|
|
// response_size(0)
|
|
// {
|
|
// if (other.value_size > 0 && other.value_size <= sizeof(value))
|
|
// {
|
|
// value_size = other.value_size;
|
|
// std::memcpy(value, other.value, value_size);
|
|
// }
|
|
// if (other.response_size > 0 && other.response_size <= sizeof(response))
|
|
// {
|
|
// response_size = other.response_size;
|
|
// std::memcpy(response, other.response, response_size);
|
|
// }
|
|
// response_ready.store(other.response_ready.load(std::memory_order_relaxed), std::memory_order_relaxed);
|
|
// }
|
|
//
|
|
//
|
|
// Command::Command(Command&& other) noexcept
|
|
// : op(other.op),
|
|
// key(other.key),
|
|
// value_size(other.value_size),
|
|
// response_ready(other.response_ready.load(std::memory_order_relaxed)),
|
|
// response_size(other.response_size)
|
|
// {
|
|
// if (value_size > 0)
|
|
// std::memcpy(value, other.value, value_size);
|
|
// if (response_size > 0)
|
|
// std::memcpy(response, other.response, response_size);
|
|
// }
|
|
//
|
|
// Command& Command::operator=(const Command& other)
|
|
// {
|
|
// if (this != &other)
|
|
// {
|
|
// op = other.op;
|
|
// key = other.key;
|
|
// value_size = other.value_size;
|
|
// response_ready.store(other.response_ready.load(std::memory_order_relaxed), std::memory_order_relaxed);
|
|
// response_size = other.response_size;
|
|
//
|
|
// if (value_size > 0)
|
|
// std::memcpy(value, other.value, value_size);
|
|
// if (response_size > 0)
|
|
// std::memcpy(response, other.response, response_size);
|
|
// }
|
|
// return *this;
|
|
// }
|
|
//
|
|
// Command& Command::operator=(Command&& other) noexcept
|
|
// {
|
|
// if (this != &other)
|
|
// {
|
|
// op = other.op;
|
|
// key = other.key;
|
|
// value_size = other.value_size;
|
|
// response_ready.store(other.response_ready.load(std::memory_order_relaxed), std::memory_order_relaxed);
|
|
// response_size = other.response_size;
|
|
// if (value_size > 0)
|
|
// std::memcpy(value, other.value, value_size);
|
|
// if (response_size > 0)
|
|
// std::memcpy(response, other.response, response_size);
|
|
// }
|
|
// return *this;
|
|
// }
|
|
}
|