🛰️航天仿真算法库 SpaceAST 0.4.0
载入中...
搜索中...
未找到
ast::PluginRegistry类 参考

#include <PluginRegistry.hpp>

Public 成员函数

errc_t scanDirectory (StringView dir, StringView namePrefix=StringView())
 
errc_t scanDirectory (StringView dir, Span< const StringView > namePrefixes)
 
PluginInstance * find (StringView iid, StringView key)
 
template<class IFace >
IFace * find (StringView key)
 
void keys (StringView iid, std::vector< std::string > &keys) const
 
std::vector< std::string > keys (StringView iid) const
 
template<class IFace >
std::vector< std::string > keys () const
 
template<class IFace >
void keys (std::vector< std::string > &keys) const
 
size_t pluginCount () const
 
size_t entryCount () const
 
void clear ()
 

静态 Public 成员函数

static PluginRegistry * Instance ()
 

详细描述

插件注册表(进程级单例)

维护 (接口 ID, 索引键) → 插件库 的索引,已成功加载的插件库将常驻进程

成员函数说明

◆ clear()

void ast::PluginRegistry::clear ( )

清空索引

警告
已加载的动态库不会立即卸载(卸载推迟到进程退出)

◆ find()

PluginInstance * ast::PluginRegistry::find ( StringView iid,
StringView key )

按 (接口 ID, 索引键) 查找插件根对象

返回
根对象指针;未命中返回 nullptr。命中时才会构造根对象

◆ scanDirectory() [1/2]

errc_t ast::PluginRegistry::scanDirectory ( StringView dir,
Span< const StringView > namePrefixes )

扫描目录并建立索引,只处理文件名以任一前缀开头的库

参数
dir目录路径
namePrefixes前缀列表;为空表示不筛选。不持有视图指向的存储,调用期间需保持有效
返回
错误码
注解
同一目录仍只扫描一次;需要多前缀时必须一次传入,不能分多次调用

◆ scanDirectory() [2/2]

errc_t ast::PluginRegistry::scanDirectory ( StringView dir,
StringView namePrefix = StringView() )

扫描目录并建立索引

参数
dir目录路径
namePrefix只处理文件名以此前缀开头的库;为空表示不筛选
返回
错误码
注解
同一个目录只会被扫描一次,重复调用是幂等的

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