🛰️航天仿真算法库 SpaceAST 0.0.1
载入中...
搜索中...
未找到
WasmRuntimeProtocol.hpp
1
20
21#pragma once
22
23#include "AstGlobal.h"
24#include "AstUtil/StringView.hpp"
25#include "AstAI/AgentInit.hpp"
26#include <string>
27#include <string_view>
28#include <optional>
29#include <vector>
30
31AST_NAMESPACE_BEGIN
32
38#define _WASM_OBJ_CALL static
39
42{
43 ObjectId id;
44 std::optional<ObjectId> parent;
45 std::string type;
46 std::string name;
47 std::vector<ObjectId> children;
48};
49
52{
53 std::string name;
54 std::string parent;
55};
56
57
60{
61public:
67 _WASM_OBJ_CALL errc_t setAttrString(ObjectId id, const std::string& name, const std::string& value);
68 _WASM_OBJ_CALL errc_t setAttrDouble(ObjectId id, const std::string& name, double value);
69 _WASM_OBJ_CALL errc_t setAttrInt(ObjectId id, const std::string& name, int value);
70 _WASM_OBJ_CALL errc_t setAttrBool(ObjectId id, const std::string& name, bool value);
71 _WASM_OBJ_CALL errc_t setAttrObject(ObjectId id, const std::string& name, ObjectId value);
72
77 _WASM_OBJ_CALL std::optional<std::string> getAttrString(ObjectId id, const std::string& name);
78 _WASM_OBJ_CALL std::optional<double> getAttrDouble(ObjectId id, const std::string& name);
79 _WASM_OBJ_CALL std::optional<int> getAttrInt(ObjectId id, const std::string& name);
80 _WASM_OBJ_CALL std::optional<bool> getAttrBool(ObjectId id, const std::string& name);
81 _WASM_OBJ_CALL std::optional<ObjectId> getAttrObject(ObjectId id, const std::string& name);
82
86 _WASM_OBJ_CALL std::optional<std::string> objectType(ObjectId id);
87
91 _WASM_OBJ_CALL std::optional<WasmObjectInfo> objectInfo(ObjectId id);
92
93
97 _WASM_OBJ_CALL std::vector<ObjectId> allObjects();
98
102 _WASM_OBJ_CALL std::vector<WasmObjectInfo> allObjectInfoList();
103
108 _WASM_OBJ_CALL std::optional<ObjectId> newObject(const std::string& typeName, std::optional<ObjectId> parentId = std::nullopt);
109
113 _WASM_OBJ_CALL errc_t removeObject(ObjectId id);
114
115
119 _WASM_OBJ_CALL std::optional<std::string> objectToJsonStr(ObjectId id);
120
121
125 _WASM_OBJ_CALL std::optional<std::string> classJsonSchemaStr(const std::string& typeName);
126
127
131 _WASM_OBJ_CALL std::vector<std::string> getAllClassNames();
132
133
135 _WASM_OBJ_CALL std::string handleToolCall(const std::string& toolCallJsonStr);
136};
137
140AST_NAMESPACE_END
141
142
WASM模块运行时协议,与对象管理相关的接口集合
定义 WasmRuntimeProtocol.hpp:60
WASM模块类信息
定义 WasmRuntimeProtocol.hpp:52
std::string name
类名
定义 WasmRuntimeProtocol.hpp:53
std::string parent
父类名
定义 WasmRuntimeProtocol.hpp:54
WASM模块对象信息
定义 WasmRuntimeProtocol.hpp:42
std::vector< ObjectId > children
子对象ID列表
定义 WasmRuntimeProtocol.hpp:47
std::optional< ObjectId > parent
父对象ID
定义 WasmRuntimeProtocol.hpp:44
std::string name
名称
定义 WasmRuntimeProtocol.hpp:46
ObjectId id
对象ID
定义 WasmRuntimeProtocol.hpp:43
std::string type
类型
定义 WasmRuntimeProtocol.hpp:45