feat: finish pipe operator
This commit is contained in:
37
BasaltPresenter/Shared/pipe_operator.hpp
Normal file
37
BasaltPresenter/Shared/pipe_operator.hpp
Normal 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
|
||||
Reference in New Issue
Block a user