AuboStudio SDK  0.6.3
variable_model.h
浏览该文件的文档.
1#ifndef AUBO_SCOPE_VARIABLE_MODEL_H
2#define AUBO_SCOPE_VARIABLE_MODEL_H
3
4#include <vector>
5#include <functional>
9
10namespace arcs {
11namespace aubo_scope {
13
14/**
15 * @ingroup ApplicationApi
16 * \chinese
17 * 变量模型
18 * 提供返回系统中当前已注册变量的方法。变量在存储到 {@link DataModel} 实例中或
19 * 用于配置内置 AuboScope 程序节点时即被注册。
20 * \endchinese
21 * \english
22 * VariableModel
23 * Provides methods that returns the variables that currently are registered in
24 * the system. A variable is registered if it has been stored in a {@link
25 * DataModel} instance or used for the configuration of a built-in AuboScope
26 * program node.
27 * \endenglish
28 */
30{
31public:
35
36 /**
37 * @ingroup VariableModel
38 * \chinese
39 * 获取系统中当前已注册的所有变量
40 * @return 已注册变量的集合。
41 * \endchinese
42 * \english
43 * Returns the collection of all variables that currently are registered in
44 * the system.
45 * @return the collection of all registered variables.
46 * \endenglish
47 */
48 std::vector<VariablePtr> getAll();
49
50 VariablePtr get(const std::string &name);
51
52 /**
53 * @ingroup VariableModel
54 * \chinese
55 * 使用过滤器获取已注册变量的子集
56 * @param filter 过滤器。
57 * @return 被过滤器接受的变量集合。
58 * \endchinese
59 * \english
60 * Get a subset of all the variables registered in the system using a filter.
61 *
62 * @param filter see {@link VariableFilterFactory} for examples.
63 * @return the collection of Variables that are accepted by the filter.
64 * \endenglish
65 */
66 std::vector<VariablePtr> get(std::function<bool(VariablePtr)> filter =
67 [](VariablePtr) { return true; });
68
69 /**
70 * @ingroup VariableModel
71 * \chinese
72 * 获取变量工厂,用于创建变量对象
73 * @return 变量工厂。
74 * \endchinese
75 * \english
76 * Returns a {@link VariableFactory} to create variable objects.
77 * @return a {@link VariableFactory} to create variable objects.
78 * \endenglish
79 */
80 VariableFactoryPtr getVariableFactory();
81
82 /**
83 * @ingroup VariableModel
84 * \chinese
85 * 获取特征对应的特征变量
86 * @param feature 带有变量的特征。
87 * @return 特征的变量。
88 * @throws IllegalArgumentException 如果特征不在安装中或特征没有变量。
89 * \endchinese
90 * \english
91 * Get the feature variable for a {@link Feature}.
92 *
93 * @param feature the feature with a variable.
94 * @return the variable for the feature.
95 * @throws IllegalArgumentException If feature not is present in the
96 * installation or feature has no variable, see {@link Feature#isVariable()}.
97 * \endenglish
98 */
99 FeatureVariablePtr getFeatureVariable(FeaturePtr feature);
100
101 /**
102 * @ingroup VariableModel
103 * \chinese
104 * 注册变更回调
105 * @param receiver 接收者标识。
106 * @param slot 回调函数。
107 * @return 连接标识符。
108 * \endchinese
109 * \english
110 * Register callback for changed.
111 *
112 * @param receiver the receiver identifier.
113 * @param slot the callback function.
114 * @return the connection identifier.
115 * \endenglish
116 */
117 std::string connectedTo(const std::string &receiver,
118 const std::function<void(VariableModel *)> &slot);
119 /**
120 * @ingroup VariableModel
121 * \chinese
122 * 断开回调连接
123 * @param receiver 接收者标识。
124 * \endchinese
125 * \english
126 * Disconnect a callback.
127 * @param receiver the receiver identifier.
128 * \endenglish
129 */
130 void disconnectFrom(const std::string &receiver);
131
132private:
133 friend class DataSwitch;
135 void *d_{ nullptr };
136};
137
138} // namespace aubo_scope
139} // namespace arcs
140#endif // AUBO_SCOPE_VARIABLE_MODEL_H
#define ARCS_ABI_EXPORT
#define ARCS_CLASS_FORWARD(C)
Macro that forward declares a class and defines the respective smartpointers through ARCS_DECLARE_PTR...
\chinese 变量模型 提供返回系统中当前已注册变量的方法。变量在存储到 DataModel 实例中或 用于配置内置 AuboScope 程序节点时即被注册。 \endchinese \englis...
VariableModel(VariableModel &&f)
FeatureVariablePtr getFeatureVariable(FeaturePtr feature)
\chinese 获取特征对应的特征变量
std::vector< VariablePtr > get(std::function< bool(VariablePtr)> filter=[](VariablePtr) { return true;})
\chinese 使用过滤器获取已注册变量的子集
VariableFactoryPtr getVariableFactory()
\chinese 获取变量工厂,用于创建变量对象
void disconnectFrom(const std::string &receiver)
\chinese 断开回调连接
VariableModel(VariableModel &f)
std::string connectedTo(const std::string &receiver, const std::function< void(VariableModel *)> &slot)
\chinese 注册变更回调
VariablePtr get(const std::string &name)
std::vector< VariablePtr > getAll()
\chinese 获取系统中当前已注册的所有变量