🛰️航天仿真算法库 SpaceAST 0.4.0
载入中...
搜索中...
未找到
PluginLoader.hpp
浏览该文件的文档.
1
20
21#pragma once
22
23#include "AstGlobal.h"
24#include "AstUtil/StringView.hpp"
25#include "PluginInterface.hpp"
26#include <string>
27#include <vector>
28#include <mutex>
29
30AST_NAMESPACE_BEGIN
31
41class AST_UTIL_API PluginLoader
42{
43public:
44 PluginLoader() = default;
45 ~PluginLoader() = default;
46
47 A_DISABLE_COPY(PluginLoader)
48
49
52 errc_t load(StringView filepath);
53
55 bool isPlugin() const { return handle_ != nullptr; }
56
58 const std::vector<PluginEntry>& entries() const { return entries_; }
59
61 const std::string& filepath() const { return filepath_; }
62
65 PluginInstance* instance();
66
67private:
68 void* handle_{nullptr};
69 std::string filepath_{};
70 std::vector<PluginEntry> entries_{};
71 PluginInstance* instance_{nullptr};
72};
73
76AST_NAMESPACE_END
通用插件接口定义
插件根对象基类
定义 PluginInterface.hpp:43
单个插件动态库加载器
定义 PluginLoader.hpp:42
const std::string & filepath() const
动态库文件路径
定义 PluginLoader.hpp:61
const std::vector< PluginEntry > & entries() const
已解析的 (接口, 索引键) 声明
定义 PluginLoader.hpp:58
bool isPlugin() const
是否为已验证的插件库
定义 PluginLoader.hpp:55