slot 0.0.1
A real time UI render framework
载入中...
搜索中...
未找到
Public 成员函数 | Public 属性 | Private 属性 | 静态 Private 属性 | 所有成员列表
z8::ResourceRef< ResourceTy > 模板类 参考

资源的强类型引用,同时覆盖持久化 ID 与运行时索引两种边界。 更多...

#include <ResourceRef.h>

类 z8::ResourceRef< ResourceTy > 继承关系图:
Inheritance graph
[图例]

Public 成员函数

 ResourceRef ()=default
 
 ResourceRef (uint32_t index)
 
 ResourceRef (std::string_view id)
 
const std::string & GetId () const
 
bool IsResolved () const
 
bool IsValid () const
 
bool operator== (const ResourceRef &other) const
 
bool operator!= (const ResourceRef &other) const
 

Public 属性

uint32_t Index = Invalid
 

Private 属性

std::string Id
 

静态 Private 属性

static constexpr uint32_t Invalid = std::numeric_limits<uint32_t>::max()
 

详细描述

template<typename ResourceTy>
class z8::ResourceRef< ResourceTy >

资源的强类型引用,同时覆盖持久化 ID 与运行时索引两种边界。

场景和材质使用 Asset ID 构造待解析引用;ResourceManager::Resolve 将其转换为 只携带稳定池索引的已解析引用,供渲染热路径和 GPU 缓存使用。资源池当前只追加且 不复用槽位,因此索引在 Manager 生命周期内稳定,不需要额外的版本字段。

构造及析构函数说明

◆ ResourceRef() [1/3]

template<typename ResourceTy >
z8::ResourceRef< ResourceTy >::ResourceRef ( )
default

构造既没有 Asset ID 也没有池索引的空引用。

这是这个函数的调用关系图:

◆ ResourceRef() [2/3]

template<typename ResourceTy >
z8::ResourceRef< ResourceTy >::ResourceRef ( uint32_t index)
inlineexplicit

构造供资源访问和缓存使用的已解析引用。

◆ ResourceRef() [3/3]

template<typename ResourceTy >
z8::ResourceRef< ResourceTy >::ResourceRef ( std::string_view id)
inlineexplicit

构造供场景、材质和序列化边界保存的待解析引用。

成员函数说明

◆ GetId()

template<typename ResourceTy >
const std::string & z8::ResourceRef< ResourceTy >::GetId ( ) const
inline

返回待解析 Asset ID;已解析引用不继续携带字符串。

这是这个函数的调用关系图:

◆ IsResolved()

template<typename ResourceTy >
bool z8::ResourceRef< ResourceTy >::IsResolved ( ) const
inline

只有获得池索引后,引用才可用于资源访问和后端缓存。

这是这个函数的调用关系图:

◆ IsValid()

template<typename ResourceTy >
bool z8::ResourceRef< ResourceTy >::IsValid ( ) const
inline

Asset ID 或池索引任一存在时,引用都具有可继续处理的有效状态。

函数调用图:
这是这个函数的调用关系图:

◆ operator!=()

提供与相等运算一致的否定比较。

函数调用图:

◆ operator==()

同时比较引用状态与载荷,避免不同待解析 ID 被视为同一引用。

类成员变量说明

◆ Id

template<typename ResourceTy >
std::string z8::ResourceRef< ResourceTy >::Id
private

◆ Index

◆ Invalid

template<typename ResourceTy >
constexpr uint32_t z8::ResourceRef< ResourceTy >::Invalid = std::numeric_limits<uint32_t>::max()
staticconstexprprivate

该类的文档由以下文件生成: