载入中...
搜索中...
未找到
Resource.h
浏览该文件的文档.
184 [[nodiscard("resource lookup ownership must be retained or explicitly handled")]] Resource* get(std::string key);
250 [[nodiscard("resource wait outcome must be checked")]] ResultRef<Resource> waitFor(std::string key);
331 [[nodiscard]] Resource* borrowLocked(const ResourceRef& reference) { return registry_.resolve(reference).get(); }
339 uint64_t epoch_ = 1;
Vocabulary aliases for nullable and checked borrowed references.
Move-only, checked operation results for the common layer.
Tag-free slot registry: handles, borrows, unique ownership and keep-alive pins.
ResourceManager is a singleton that manages all resources in the game. It provides a way to load,...
Definition Resource.h:152
Resource * load(const std::string &key) override
Cache provider entry point; this implementation does not claim keys.
Definition Resource.h:296
const char * reloadKind() const override
Stable capability name for the cache reloader.
Definition Resource.h:281
std::unordered_map< std::string, std::shared_ptr< AsyncLoad > > pending_
Definition Resource.h:336
Resource * borrowLocked(const ResourceRef &reference)
Borrows the live resource behind a cache entry.
Definition Resource.h:331
script::RuntimeObjectRegistry< Resource, ResourceCacheTag > registry_
Registry that exclusively owns every cached resource.
Definition Resource.h:334
std::map< std::string, ResourceRef > resources
Definition Resource.h:335
Resource is a game object that is managed by the ResourceManager. It can be loaded from a file or gen...
Definition Resource.h:51
virtual void adopt(eve::Resource &replacement)=0
Replace this instance's contents with replacement's. The ResourceManager keeps instance identity stab...
Resource(const Resource &)=delete
Resources own keep-alive pins, so they are not copyable.
void setUri(std::string value)
Set the resource URI (the cache key). Used by ResourceManager.
Definition Resource.h:117
EVENGINE_API_FOUNDATION std::vector< Resource * > getDependencies() const
Borrowed views of the resources this instance keeps alive.
Definition Resource.cpp:504
EVENGINE_API_FOUNDATION eve::Result< void > addDependency(Resource &dependency)
Keeps dependency alive for as long as this instance lives.
Definition Resource.cpp:511
std::vector< ResourcePin > dependencies
Keep-alive pins; see getDependencies()/addDependency().
Definition Resource.h:123
Resource & operator=(const Resource &)=delete
Slot/generation registry whose objects are exclusively unique-owned.
Definition RuntimeRegistry.h:359
RAII keep-alive for one RuntimeObjectRegistry entry.
Definition RuntimeRegistry.h:276
@ Resource
std::optional< std::reference_wrapper< T > > OptionalRef
Optional borrowed reference; it does not extend T's lifetime.
Definition BorrowedRef.h:24
Handle plus owner-lifetime epoch for a non-ECS registry object.
Definition RuntimeRegistry.h:91