#pragma once /* * PS4Delta : PS4 emulation and research project * * Copyright 2019-2020 Force67. * For information regarding licensing see LICENSE * in the root of the source tree. */ #include #include #include #include #include namespace kern { class process; class object { public: using handleList = std::vector; enum class kind { file, device, namedobj, dynlib }; explicit object(kind); void retain(); void release(); void retainHandle(); void releaseHandle(); handleList& handles() { return handleCollection; } uint32_t handle() const { return handleCollection[0]; } public: kind type; std::string name; private: handleList handleCollection; std::atomic refCount; }; template utl::object_ref retain_object(T* ptr) { if (ptr) ptr->retain(); return utl::object_ref(ptr); } }