Removed redundant 'Bloom' namespace from entire codebase
This commit is contained in:
@@ -5,62 +5,59 @@
|
||||
#include <optional>
|
||||
#include <chrono>
|
||||
|
||||
namespace Bloom
|
||||
/**
|
||||
* RAII wrapper for an epoll instance.
|
||||
*
|
||||
* See https://man7.org/linux/man-pages/man7/epoll.7.html for more on the Linux epoll API.
|
||||
*/
|
||||
class EpollInstance
|
||||
{
|
||||
public:
|
||||
EpollInstance();
|
||||
|
||||
/**
|
||||
* RAII wrapper for an epoll instance.
|
||||
* Adds an entry to the epoll instance.
|
||||
*
|
||||
* See https://man7.org/linux/man-pages/man7/epoll.7.html for more on the Linux epoll API.
|
||||
* @param fileDescriptor
|
||||
* @param eventMask
|
||||
*/
|
||||
class EpollInstance
|
||||
{
|
||||
public:
|
||||
EpollInstance();
|
||||
void addEntry(int fileDescriptor, std::uint16_t eventMask);
|
||||
|
||||
/**
|
||||
* Adds an entry to the epoll instance.
|
||||
*
|
||||
* @param fileDescriptor
|
||||
* @param eventMask
|
||||
*/
|
||||
void addEntry(int fileDescriptor, std::uint16_t eventMask);
|
||||
/**
|
||||
* Removes an entry from the epoll instance.
|
||||
*
|
||||
* @param fileDescriptor
|
||||
*/
|
||||
void removeEntry(int fileDescriptor);
|
||||
|
||||
/**
|
||||
* Removes an entry from the epoll instance.
|
||||
*
|
||||
* @param fileDescriptor
|
||||
*/
|
||||
void removeEntry(int fileDescriptor);
|
||||
/**
|
||||
* Waits on the epoll instance until an event occurs for any of the registered files.
|
||||
*
|
||||
* @param timeout
|
||||
* Millisecond timeout. If not provided, no timeout will be applied and this function will block until an
|
||||
* event occurs.
|
||||
*
|
||||
* @return
|
||||
* The file descriptor of the file for which the event occurred, or std::nullopt if a timeout was reached.
|
||||
*/
|
||||
[[nodiscard]] std::optional<int> waitForEvent(
|
||||
std::optional<std::chrono::milliseconds> timeout = std::nullopt
|
||||
) const;
|
||||
|
||||
/**
|
||||
* Waits on the epoll instance until an event occurs for any of the registered files.
|
||||
*
|
||||
* @param timeout
|
||||
* Millisecond timeout. If not provided, no timeout will be applied and this function will block until an
|
||||
* event occurs.
|
||||
*
|
||||
* @return
|
||||
* The file descriptor of the file for which the event occurred, or std::nullopt if a timeout was reached.
|
||||
*/
|
||||
[[nodiscard]] std::optional<int> waitForEvent(
|
||||
std::optional<std::chrono::milliseconds> timeout = std::nullopt
|
||||
) const;
|
||||
/*
|
||||
* EpollInstance objects should not be copied.
|
||||
*/
|
||||
EpollInstance(EpollInstance& other) = delete;
|
||||
EpollInstance& operator = (EpollInstance& other) = delete;
|
||||
|
||||
/*
|
||||
* EpollInstance objects should not be copied.
|
||||
*/
|
||||
EpollInstance(EpollInstance& other) = delete;
|
||||
EpollInstance& operator = (EpollInstance& other) = delete;
|
||||
/*
|
||||
* TODO: Implement this. For now, use the move constructor.
|
||||
*/
|
||||
EpollInstance& operator = (EpollInstance&& other) = delete;
|
||||
|
||||
/*
|
||||
* TODO: Implement this. For now, use the move constructor.
|
||||
*/
|
||||
EpollInstance& operator = (EpollInstance&& other) = delete;
|
||||
EpollInstance(EpollInstance&& other) noexcept;
|
||||
~EpollInstance() noexcept;
|
||||
|
||||
EpollInstance(EpollInstance&& other) noexcept;
|
||||
~EpollInstance() noexcept;
|
||||
|
||||
private:
|
||||
std::optional<int> fileDescriptor;
|
||||
};
|
||||
}
|
||||
private:
|
||||
std::optional<int> fileDescriptor;
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user