2014-05-27 20:16:13 -04:00
|
|
|
// Copyright 2014 Citra Emulator Project
|
2014-12-17 00:38:14 -05:00
|
|
|
// Licensed under GPLv2 or any later version
|
2014-11-19 03:49:13 -05:00
|
|
|
// Refer to the license.txt file included.
|
2014-05-27 20:16:13 -04:00
|
|
|
|
|
|
|
#pragma once
|
|
|
|
|
2018-08-01 22:40:00 -04:00
|
|
|
#include "core/hle/kernel/object.h"
|
2014-05-27 20:16:13 -04:00
|
|
|
|
|
|
|
namespace Kernel {
|
|
|
|
|
2018-08-28 12:30:33 -04:00
|
|
|
class KernelCore;
|
2018-11-26 18:31:22 -05:00
|
|
|
class ReadableEvent;
|
2018-11-27 09:18:29 -05:00
|
|
|
class WritableEvent;
|
2018-08-28 12:30:33 -04:00
|
|
|
|
2018-11-27 09:18:29 -05:00
|
|
|
struct EventPair {
|
|
|
|
SharedPtr<ReadableEvent> readable;
|
|
|
|
SharedPtr<WritableEvent> writable;
|
|
|
|
};
|
|
|
|
|
|
|
|
class WritableEvent final : public Object {
|
2015-01-23 00:11:25 -05:00
|
|
|
public:
|
2018-11-26 18:31:22 -05:00
|
|
|
~WritableEvent() override;
|
|
|
|
|
2015-01-23 00:11:25 -05:00
|
|
|
/**
|
|
|
|
* Creates an event
|
2018-08-28 12:30:33 -04:00
|
|
|
* @param kernel The kernel instance to create this event under.
|
2015-01-23 00:11:25 -05:00
|
|
|
* @param reset_type ResetType describing how to create event
|
|
|
|
* @param name Optional name of event
|
|
|
|
*/
|
2018-11-27 09:18:29 -05:00
|
|
|
static EventPair CreateEventPair(KernelCore& kernel, ResetType reset_type,
|
|
|
|
std::string name = "Unknown");
|
2015-01-23 00:11:25 -05:00
|
|
|
|
2016-09-17 20:38:01 -04:00
|
|
|
std::string GetTypeName() const override {
|
2018-11-26 18:31:22 -05:00
|
|
|
return "WritableEvent";
|
2016-09-17 20:38:01 -04:00
|
|
|
}
|
|
|
|
std::string GetName() const override {
|
|
|
|
return name;
|
|
|
|
}
|
2015-01-23 00:11:25 -05:00
|
|
|
|
2018-12-03 22:50:16 -05:00
|
|
|
static const HandleType HANDLE_TYPE = HandleType::WritableEvent;
|
2016-09-17 20:38:01 -04:00
|
|
|
HandleType GetHandleType() const override {
|
|
|
|
return HANDLE_TYPE;
|
|
|
|
}
|
2015-01-23 00:11:25 -05:00
|
|
|
|
2018-11-29 09:14:12 -05:00
|
|
|
SharedPtr<ReadableEvent> GetReadableEvent() const;
|
|
|
|
|
2018-11-27 09:18:29 -05:00
|
|
|
ResetType GetResetType() const;
|
2017-01-01 19:23:19 -05:00
|
|
|
|
2015-01-23 00:11:25 -05:00
|
|
|
void Signal();
|
|
|
|
void Clear();
|
2018-11-26 18:31:22 -05:00
|
|
|
bool IsSignaled() const;
|
2015-01-23 00:11:25 -05:00
|
|
|
|
|
|
|
private:
|
2018-11-26 18:31:22 -05:00
|
|
|
explicit WritableEvent(KernelCore& kernel);
|
2018-08-06 12:52:21 -04:00
|
|
|
|
2018-11-27 09:18:29 -05:00
|
|
|
SharedPtr<ReadableEvent> readable;
|
2018-08-06 12:52:21 -04:00
|
|
|
|
|
|
|
std::string name; ///< Name of event (optional)
|
2015-01-23 00:11:25 -05:00
|
|
|
};
|
2014-05-27 20:16:13 -04:00
|
|
|
|
2018-01-20 02:48:02 -05:00
|
|
|
} // namespace Kernel
|