31 ObjectPin() =
default;
39 ObjectPin(
ObjectPin&& other) noexcept : object_(other.object_), handle_(other.handle_) {
40 other.object_ =
nullptr;
42 ObjectPin& operator=(ObjectPin&& other)
noexcept {
45 object_ = other.object_;
46 handle_ = other.handle_;
47 other.object_ =
nullptr;
51 ~ObjectPin() { Reset(); }
53 explicit operator bool() const noexcept {
return object_ !=
nullptr; }
55 [[nodiscard]] ObjectType GetType()
const {
return object_->GetType(); }
57 [[nodiscard]]
ObjectData& GetData()
const {
return object_->data; }
59 [[nodiscard]] KernelObject& GetKernelObject()
const {
return *object_; }
66 [[nodiscard]] X_HANDLE
GetHandle() const noexcept {
return handle_; }
71 void Reset() noexcept {
72 if (object_ !=
nullptr) {
81 KernelObject* object_ =
nullptr;
133 auto* xam = std::get_if<XAMObject>(&slot_.GetData());
134 if (xam !=
nullptr && xam->body && xam->body->GetTag() == T::kTag) {
135 value_ =
static_cast<T*
>(xam->body.get());
138 value_ = std::get_if<typename ObjectViewOf<T>::Type>(&slot_.GetData());
140 if (value_ ==
nullptr) {
146 explicit operator bool() const noexcept {
return value_ !=
nullptr; }
148 T* operator->() const noexcept {
return value_; }
150 T& operator*() const noexcept {
return *value_; }
152 [[nodiscard]] X_HANDLE GetHandle() const noexcept {
return slot_.GetHandle(); }
154 [[nodiscard]] u32 GetGuestAddress()
const {
return slot_.GetGuestAddress(); }
156 [[nodiscard]]
const ObjectPin& GetSlot() const noexcept {
return slot_; }
Definition event_object.h:44
Definition module_object.h:129
Definition notify_listener_object.h:43
Definition file_object.h:104
Definition object_pin.h:29
ObjectPin(KernelObject *object, X_HANDLE handle) noexcept
Definition object_pin.h:37
X_HANDLE GetHandle() const noexcept
Definition object_pin.h:66
u32 GetGuestAddress() const
Definition object_pin.h:69
bool Unpin() noexcept
Definition object.h:159
Pinned(ObjectPin pin)
Definition object_pin.h:130
Definition xam_object.h:40
std::variant< EventObject, SemaphoreObject, MutantObject, TimerObject, FileObject, NotifyListenerObject, IOCompletionObject, SymbolicLinkObject, ModuleObject, ThreadRef, XAMObject > ObjectData
Definition kernel_object.h:39
Definition event_object.h:59
Definition file_object.h:161
Definition kernel_object.h:44
void(*) destroy(KernelObject *object) noexcept
Definition kernel_object.h:72
PinCount pins
Definition kernel_object.h:70
Definition module_object.h:189
Definition notify_listener_object.h:68
Definition object_pin.h:91
T Type
Definition object_pin.h:92
Integer types, byte order wrappers and size literals.
Move only function, const propagating pointer and scope guard.