1
0

feat: finish pipe operator

This commit is contained in:
2025-11-27 20:48:35 +08:00
parent 89b7afb33f
commit 9af21b514a
6 changed files with 223 additions and 31 deletions

View File

@@ -0,0 +1,37 @@
#include "basalt_char.hpp"
#include <string_view>
#if defined(BASALT_OS_WINDOWS)
#include <Windows.h>
#else
#endif
namespace Basalt::Shared {
class PipeOperator {
public:
#if defined(BASALT_OS_WINDOWS)
using Handle = HANDLE;
static constexpr Handle BAD_PIPE_HANDLE = INVALID_HANDLE_VALUE;
#else
using Handle = int;
static constexpr Handle BAD_PIPE_HANDLE = -1;
#endif
public:
PipeOperator(const std::basic_string_view<BSCHAR> name);
~PipeOperator();
// Delete copy ctor
PipeOperator(const PipeOperator&) = delete;
PipeOperator& operator=(const PipeOperator&) = delete;
// Implement move ctor
PipeOperator(PipeOperator&&) noexcept;
PipeOperator& operator=(PipeOperator&& other) noexcept;
void Read(void* buffer, size_t size);
void Write(const void* buffer, size_t size);
private:
Handle m_Handle;
};
} // namespace Basalt::Shared