|
AuboStudio SDK
0.6.3
|
|
|
|
|
\chinese 数据模型 此接口用于存储和管理表示当前配置的数据,例如 ProgramNodeContribution 或 InstallationNodeContribution 的配置。提供了在字典中添加、删除、获取 和修改值的方法。
更多...
#include <data_model.h>
Public 成员函数 | |
| DataModel (DataModel &f) | |
| DataModel (DataModel &&f) | |
| ~DataModel () | |
| void | set (const std::string &key, bool value) |
\chinese 将bool值赋给指定键。 | |
| bool | get (const std::string &key, bool default_value) const |
\chinese 获取赋给指定键的bool值。 | |
| void | set (const std::string &key, int value) |
\chinese 将int值赋给指定键。 | |
| int | get (const std::string &key, int default_value) const |
\chinese 获取赋给指定键的int值。 | |
| void | set (const std::string &key, long value) |
\chinese 将long值赋给指定键。 \endchinese \english Assign a long value to the specified key. | |
| void | set (const std::string &key, uint64_t value) |
| long | get (const std::string &key, long default_value) const |
\chinese 获取赋给指定键的long值。 \endchinese \english Get the long value assigned to the specified key. | |
| uint64_t | get (const std::string &key, uint64_t default_value) const |
| void | set (const std::string &key, float value) |
\chinese 将float值赋给指定键。 \endchinese \english Assign a float value to the specified key. | |
| float | get (const std::string &key, float default_value) const |
\chinese 获取赋给指定键的float值。 \endchinese \english Get the float value assigned to the specified key. | |
| void | set (const std::string &key, double value) |
\chinese 将double值赋给指定键。 \endchinese \english Assign a double value to the specified key. | |
| double | get (const std::string &key, double default_value) const |
\chinese 获取赋给指定键的double值。 \endchinese \english Get the double value assigned to the specified key. | |
| void | set (const std::string &key, const std::string &value) |
\chinese 将std::string值赋给指定键。 \endchinese \english Assign a std::string value to the specified key. | |
| std::string | get (const std::string &key, const std::string &default_value) const |
\chinese 获取赋给指定键的std::string值。 \endchinese \english Get the std::string value assigned to the specified key. | |
| void | set (const std::string &key, VariablePtr value) |
\chinese 将Variable值赋给指定键。 \endchinese \english Assign a Variable value to the specified key. | |
| void | set (const std::string &key, ExpressionPtr value) |
| void | set (const std::string &key, PayloadPtr value) |
| void | set (const std::string &key, IoPtr value) |
| void | set (const std::string &key, WaypointPtr value) |
| VariablePtr | get (const std::string &key, VariablePtr default_value) const |
\chinese 获取赋给指定键的Variable值。 | |
| ExpressionPtr | get (const std::string &key, ExpressionPtr default_value) const |
| PayloadPtr | get (const std::string &key, PayloadPtr default_value) const |
| IoPtr | get (const std::string &key, IoPtr default_value) const |
| WaypointPtr | get (const std::string &key, WaypointPtr default_value) const |
| void | set (const std::string &key, const std::vector< bool > &value) |
\chinese 将bool[]数组赋给指定键。 \endchinese \english Assign a bool[] as value to the specified key. | |
| std::vector< bool > | get (const std::string &key, const std::vector< bool > &default_value) const |
\chinese 获取赋给指定键的bool[]数组。 \endchinese \english Get the bool[] as value assigned to the specified key. | |
| void | set (const std::string &key, const std::vector< int > &value) |
\chinese 将int[]数组赋给指定键。 \endchinese \english Assign a int[] as value to the specified key. | |
| std::vector< int > | get (const std::string &key, const std::vector< int > &default_value) const |
\chinese 获取赋给指定键的int[]数组。 \endchinese \english Get the int[] as value assigned to the specified key. | |
| void | set (const std::string &key, const std::vector< long > &value) |
\chinese 将long[]数组赋给指定键。 \endchinese \english Assign a long[] as value to the specified key. | |
| void | set (const std::string &key, const std::vector< uint64_t > &value) |
| std::vector< long > | get (const std::string &key, const std::vector< long > &default_value) const |
\chinese 获取赋给指定键的long[]数组。 \endchinese \english Get the long[] as value assigned to the specified key. | |
| std::vector< uint64_t > | get (const std::string &key, const std::vector< uint64_t > &default_value) const |
| void | set (const std::string &key, const std::vector< float > &value) |
\chinese 将float[]数组赋给指定键。 \endchinese \english Assign a float[] as value to the specified key. | |
| std::vector< float > | get (const std::string &key, const std::vector< float > &default_value) const |
\chinese 获取赋给指定键的float[]数组。 \endchinese \english Get the float[] as value assigned to the specified key. | |
| void | set (const std::string &key, const std::vector< double > &value) |
\chinese 将double[]数组赋给指定键。 \endchinese \english Assign a double[] as value to the specified key. | |
| std::vector< double > | get (const std::string &key, const std::vector< double > &default_value) const |
\chinese 获取赋给指定键的double[]数组。 \endchinese \english Get the double[] as value assigned to the specified key. | |
| void | set (const std::string &key, const std::vector< std::string > &value) |
\chinese 将std::string[]数组赋给指定键。 \endchinese \english Assign a std::string[] as value to the specified key. | |
| std::vector< std::string > | get (const std::string &key, const std::vector< std::string > &default_value) const |
\chinese 获取赋给指定键的std::string[]数组。 \endchinese \english Get the std::string[] as value assigned to the specified key. | |
| void | set (const std::string &key, TCPPtr value) |
\chinese 将TCP值赋给指定键。 \endchinese \english Assign a TCP value to the specified key. | |
| TCPPtr | get (const std::string &key, TCPPtr default_value) const |
\chinese 获取赋给指定键的TCP值。 \endchinese \english Get the TCP value assigned to the specified key.
| |
| void | set (const std::string &key, FeaturePtr value) |
\chinese 将Feature值赋给指定键。 \endchinese \english Assign a Feature value to the specified key. | |
| FeaturePtr | get (const std::string &key, FeaturePtr default_value) const |
\chinese 获取赋给指定键的Feature值。 \endchinese \english Get the Feature value assigned to the specified key. | |
| std::set< std::string > | getKeys () const |
| \chinese 获取数据模型中所有键的集合。 | |
| bool | isSet (const std::string &key) const |
| \chinese 检查数据模型中是否存在指定键。 | |
| bool | remove (const std::string &key) |
| \chinese 从数据模型中移除一个键值对。 | |
Private 成员函数 | |
| DataModel () | |
Private 属性 | |
| void * | d_ { nullptr } |
友元 | |
| class | DataSwitch |
\chinese 数据模型 此接口用于存储和管理表示当前配置的数据,例如 ProgramNodeContribution 或 InstallationNodeContribution 的配置。提供了在字典中添加、删除、获取 和修改值的方法。
为已使用的键设置新值将覆盖当前值。无论值的类型如何都会发生(例如,在键 myBool 下存储值 true,之后又在同一键下存储一个 Angle 对象,将会用提供的 Angle 对象覆盖 true 值)。
每个 AuboCap 安装画面都有一个底层的 DataModel 对象。该对象随每个 AuboScope 安装一起保存和加载。
同样,每个贡献的程序节点实例都有一个底层的 DataModel 对象。该对象随节点所在程序一起保存和加载。基于 HTML 的程序节点贡献中,对 DataModel 对象的所有修改都支持撤销/重做操作。基于 Qt 的 AuboStudio 插件必须使用 UndoRedoManager 将更改记录到撤销/重做栈中。
检索对象时,键和对象类型都必须与之前存储的匹配。这意味着如果使用键 myAngle 存储了一个 TCP 对象,然后尝试使用键 myAngle 通过 get(std::string key, Angle default_value) 检索它,将不会返回存储 的值,因为类型不匹配。相反,将返回提供的 default_value。 \endchinese \english DataModel This interface is used for storing and managing data that represents the current configuration of, e.g. a ProgramNodeContribution or InstallationNodeContribution. Methods for adding, removing, retrieving and changing values in a dictionary are provided.
Setting a new value for a key already in use, will overwrite the current value with the new value. This happens regardless of the type of value (e.g. storing the value true under the key myBool and afterwards storing an Angle object under the same key will overwrite the value true with the provided Angle object).
A auboCap installation screen has an underlying DataModel object. That object is saved and loaded along with each AuboScope installation.
Similarly, each contributed program node instance has an underlying DataModel object. That object is saved and loaded along with the program where the node occurs. Undo/redo actions are supported for all modifications to the DataModel object in HTML-based program node contributions. Qt-based aubo_studio plugins must use the UndoRedoManager to record the changes on the undo/redo stack.
When retrieving an object, both key and object type must match what was previously stored. This means that if a TCP object was stored using the key myAngle, then attempting to retrieve it using get(std::string key, Angle default_value) with the key myAngle will not return the stored value, since the types do not match. Instead the provided default_value will be returned. \endenglish
在文件 data_model.h 第 82 行定义.
| arcs::aubo_scope::DataModel::DataModel | ( | DataModel & | f | ) |
| arcs::aubo_scope::DataModel::DataModel | ( | DataModel && | f | ) |
| arcs::aubo_scope::DataModel::~DataModel | ( | ) |
|
private |
| bool arcs::aubo_scope::DataModel::get | ( | const std::string & | key, |
| bool | default_value ) const |
\chinese 获取赋给指定键的bool值。
| key | 数据模型中的键。 |
| default_value | 键不存在时返回的值。 |
bool value assigned to the specified key.| key | key in the data model. |
| default_value | value to be returned, if key does not exist. |
| std::string arcs::aubo_scope::DataModel::get | ( | const std::string & | key, |
| const std::string & | default_value ) const |
\chinese 获取赋给指定键的std::string值。 \endchinese \english Get the std::string value assigned to the specified key.
| key | key in the data model. |
| default_value | value to be returned, if key does not exist. |
| std::vector< bool > arcs::aubo_scope::DataModel::get | ( | const std::string & | key, |
| const std::vector< bool > & | default_value ) const |
\chinese 获取赋给指定键的bool[]数组。 \endchinese \english Get the bool[] as value assigned to the specified key.
| key | key in the data model. |
| default_value | value to be returned, if key does not exist. |
| std::vector< double > arcs::aubo_scope::DataModel::get | ( | const std::string & | key, |
| const std::vector< double > & | default_value ) const |
\chinese 获取赋给指定键的double[]数组。 \endchinese \english Get the double[] as value assigned to the specified key.
| key | key in the data model. |
| default_value | value to be returned, if key does not exist. |
| std::vector< float > arcs::aubo_scope::DataModel::get | ( | const std::string & | key, |
| const std::vector< float > & | default_value ) const |
\chinese 获取赋给指定键的float[]数组。 \endchinese \english Get the float[] as value assigned to the specified key.
| key | key in the data model. |
| default_value | value to be returned, if key does not exist. |
| std::vector< int > arcs::aubo_scope::DataModel::get | ( | const std::string & | key, |
| const std::vector< int > & | default_value ) const |
\chinese 获取赋给指定键的int[]数组。 \endchinese \english Get the int[] as value assigned to the specified key.
| key | key in the data model. |
| default_value | value to be returned, if key does not exist. |
| std::vector< long > arcs::aubo_scope::DataModel::get | ( | const std::string & | key, |
| const std::vector< long > & | default_value ) const |
\chinese 获取赋给指定键的long[]数组。 \endchinese \english Get the long[] as value assigned to the specified key.
| key | key in the data model. |
| default_value | value to be returned, if key does not exist. |
| std::vector< std::string > arcs::aubo_scope::DataModel::get | ( | const std::string & | key, |
| const std::vector< std::string > & | default_value ) const |
\chinese 获取赋给指定键的std::string[]数组。 \endchinese \english Get the std::string[] as value assigned to the specified key.
| key | key in the data model. |
| default_value | value to be returned, if key does not exist. |
| std::vector< uint64_t > arcs::aubo_scope::DataModel::get | ( | const std::string & | key, |
| const std::vector< uint64_t > & | default_value ) const |
| double arcs::aubo_scope::DataModel::get | ( | const std::string & | key, |
| double | default_value ) const |
\chinese 获取赋给指定键的double值。 \endchinese \english Get the double value assigned to the specified key.
| key | key in the data model. |
| default_value | value to be returned, if key does not exist. |
| ExpressionPtr arcs::aubo_scope::DataModel::get | ( | const std::string & | key, |
| ExpressionPtr | default_value ) const |
| FeaturePtr arcs::aubo_scope::DataModel::get | ( | const std::string & | key, |
| FeaturePtr | default_value ) const |
| float arcs::aubo_scope::DataModel::get | ( | const std::string & | key, |
| float | default_value ) const |
\chinese 获取赋给指定键的float值。 \endchinese \english Get the float value assigned to the specified key.
| key | key in the data model. |
| default_value | value to be returned, if key does not exist. |
| int arcs::aubo_scope::DataModel::get | ( | const std::string & | key, |
| int | default_value ) const |
\chinese 获取赋给指定键的int值。
| key | 数据模型中的键。 |
| default_value | 键不存在时返回的值。 |
int value assigned to the specified key.| key | key in the data model. |
| default_value | value to be returned, if key does not exist. |
| IoPtr arcs::aubo_scope::DataModel::get | ( | const std::string & | key, |
| IoPtr | default_value ) const |
| long arcs::aubo_scope::DataModel::get | ( | const std::string & | key, |
| long | default_value ) const |
\chinese 获取赋给指定键的long值。 \endchinese \english Get the long value assigned to the specified key.
| key | key in the data model. |
| default_value | value to be returned, if key does not exist. |
| PayloadPtr arcs::aubo_scope::DataModel::get | ( | const std::string & | key, |
| PayloadPtr | default_value ) const |
| TCPPtr arcs::aubo_scope::DataModel::get | ( | const std::string & | key, |
| TCPPtr | default_value ) const |
| uint64_t arcs::aubo_scope::DataModel::get | ( | const std::string & | key, |
| uint64_t | default_value ) const |
| VariablePtr arcs::aubo_scope::DataModel::get | ( | const std::string & | key, |
| VariablePtr | default_value ) const |
| WaypointPtr arcs::aubo_scope::DataModel::get | ( | const std::string & | key, |
| WaypointPtr | default_value ) const |
| std::set< std::string > arcs::aubo_scope::DataModel::getKeys | ( | ) | const |
\chinese 获取数据模型中所有键的集合。
| bool arcs::aubo_scope::DataModel::isSet | ( | const std::string & | key | ) | const |
\chinese 检查数据模型中是否存在指定键。
| key | 数据模型中的键。 |
true,否则返回false。 \endchinese \english Check if a key is present in the data model.| key | key in the data model (not null and not an empty std::string). |
true, if key exist, otherwise false. \endenglish | bool arcs::aubo_scope::DataModel::remove | ( | const std::string & | key | ) |
\chinese 从数据模型中移除一个键值对。
| key | 数据模型中的键。 |
true,否则返回false。 | IllegalStateException | 如果在Qt-based AuboCap程序节点中调用时不在 UndoableChanges范围内。 \endchinese \english Remove a key-value pair from the data model. |
| key | key in the data model (not null and not an empty std::string). |
true, if succeed, otherwise false. | IllegalStateException | if called from a Qt-based AuboCap program node outside of an UndoableChanges scope (see also UndoRedoManager). \endenglish |
| void arcs::aubo_scope::DataModel::set | ( | const std::string & | key, |
| bool | value ) |
\chinese 将bool值赋给指定键。
| key | 数据模型中的键(不可为null或空std::string)。 |
| value | 赋给键的值。 |
| IllegalArgumentException | 如果键为null或空std::string。 |
| IllegalStateException | 如果在Qt-based AuboCap程序节点中调用时不在 UndoableChanges范围内(另见UndoRedoManager)。 \endchinese \english Assign a bool value to the specified key. |
| key | key in the data model (not null and not an empty std::string). |
| value | value assigned to key. |
| IllegalArgumentException | if the key is null or an empty std::string. |
| IllegalStateException | if called from a Qt-based AuboCap program node outside of an UndoableChanges scope (see also UndoRedoManager). \endenglish |
| void arcs::aubo_scope::DataModel::set | ( | const std::string & | key, |
| const std::string & | value ) |
\chinese 将std::string值赋给指定键。 \endchinese \english Assign a std::string value to the specified key.
| key | key in the data model (not null and not an empty std::string). |
| value | value assigned to key. |
| IllegalArgumentException | if the key is null or an empty std::string. |
| IllegalStateException | if called from a Qt-based AuboCap program node outside of an UndoableChanges scope (see also UndoRedoManager). \endenglish |
| void arcs::aubo_scope::DataModel::set | ( | const std::string & | key, |
| const std::vector< bool > & | value ) |
\chinese 将bool[]数组赋给指定键。 \endchinese \english Assign a bool[] as value to the specified key.
| key | key in the data model (not null) and not an empty std::string). |
| value | value assigned to key. |
| IllegalArgumentException | if the key is null or an empty std::string. |
| IllegalStateException | if called from a Qt-based AuboCap program node outside of an UndoableChanges scope (see also UndoRedoManager). \endenglish |
| void arcs::aubo_scope::DataModel::set | ( | const std::string & | key, |
| const std::vector< double > & | value ) |
\chinese 将double[]数组赋给指定键。 \endchinese \english Assign a double[] as value to the specified key.
| key | key in the data model (not null and not an empty std::string). |
| value | value assigned to key. |
| IllegalArgumentException | if the key is null or an empty std::string. |
| IllegalStateException | if called from a Qt-based AuboCap program node outside of an UndoableChanges scope (see also UndoRedoManager). \endenglish |
| void arcs::aubo_scope::DataModel::set | ( | const std::string & | key, |
| const std::vector< float > & | value ) |
\chinese 将float[]数组赋给指定键。 \endchinese \english Assign a float[] as value to the specified key.
| key | key in the data model (not null and not an empty std::string). |
| value | value assigned to key. |
| IllegalArgumentException | if the key is null or an empty std::string. |
| IllegalStateException | if called from a Qt-based AuboCap program node outside of an UndoableChanges scope (see also UndoRedoManager). \endenglish |
| void arcs::aubo_scope::DataModel::set | ( | const std::string & | key, |
| const std::vector< int > & | value ) |
\chinese 将int[]数组赋给指定键。 \endchinese \english Assign a int[] as value to the specified key.
| key | key in the data model (not null and not an empty std::string). |
| value | value assigned to key. |
| IllegalArgumentException | if the key is null or an empty std::string. |
| IllegalStateException | if called from a Qt-based AuboCap program node outside of an UndoableChanges scope (see also UndoRedoManager). \endenglish |
| void arcs::aubo_scope::DataModel::set | ( | const std::string & | key, |
| const std::vector< long > & | value ) |
\chinese 将long[]数组赋给指定键。 \endchinese \english Assign a long[] as value to the specified key.
| key | key in the data model (not null and not an empty std::string). |
| value | value assigned to key. |
| IllegalArgumentException | if the key is null} or an empty
|
| IllegalStateException | if called from a Qt-based AuboCap
program node outside of an |
| void arcs::aubo_scope::DataModel::set | ( | const std::string & | key, |
| const std::vector< std::string > & | value ) |
\chinese 将std::string[]数组赋给指定键。 \endchinese \english Assign a std::string[] as value to the specified key.
| key | key in the data model (not null and not an empty std::string). |
| value | value assigned to key. |
| IllegalArgumentException | if the key is null or an empty std::string. |
| IllegalStateException | if called from a Qt-based AuboCap program node outside of an UndoableChanges scope (see also UndoRedoManager). \endenglish |
| void arcs::aubo_scope::DataModel::set | ( | const std::string & | key, |
| const std::vector< uint64_t > & | value ) |
| void arcs::aubo_scope::DataModel::set | ( | const std::string & | key, |
| double | value ) |
\chinese 将double值赋给指定键。 \endchinese \english Assign a double value to the specified key.
| key | key in the data model (not null and not an empty std::string). |
| value | value assigned to key. |
| IllegalArgumentException | if the key is null or an empty std::string. |
| IllegalStateException | if called from a Qt-based AuboCap program node outside of an UndoableChanges scope (see also UndoRedoManager). \endenglish |
| void arcs::aubo_scope::DataModel::set | ( | const std::string & | key, |
| ExpressionPtr | value ) |
| void arcs::aubo_scope::DataModel::set | ( | const std::string & | key, |
| FeaturePtr | value ) |
\chinese 将Feature值赋给指定键。 \endchinese \english Assign a Feature value to the specified key.
| key | key in the data model (not null and not an empty std::string). |
| value | value assigned to key. |
| IllegalArgumentException | if the key is null or an empty std::string. |
| IllegalStateException | if called from a Qt-based AuboCap program node outside of an UndoableChanges scope (see also UndoRedoManager). \endenglish |
| void arcs::aubo_scope::DataModel::set | ( | const std::string & | key, |
| float | value ) |
\chinese 将float值赋给指定键。 \endchinese \english Assign a float value to the specified key.
| key | key in the data model (not null and not an empty std::string). |
| value | value assigned to key. |
| IllegalArgumentException | if the key is null or an empty std::string. |
| IllegalStateException | if called from a Qt-based AuboCap program node outside of an UndoableChanges scope (see also UndoRedoManager). \endenglish |
| void arcs::aubo_scope::DataModel::set | ( | const std::string & | key, |
| int | value ) |
\chinese 将int值赋给指定键。
| key | 数据模型中的键。 |
| value | 赋给键的值。 |
| IllegalArgumentException | 如果键为null或空字符串。 |
| IllegalStateException | 如果不在UndoableChanges范围内调用。 \endchinese \english Assign an int value to the specified key. |
| key | key in the data model (not null and not an empty std::string). |
| value | value assigned to key. |
| IllegalArgumentException | if the key is null or an empty std::string. |
| IllegalStateException | if called from a Qt-based AuboCap program node outside of an UndoableChanges scope (see also UndoRedoManager). \endenglish |
| void arcs::aubo_scope::DataModel::set | ( | const std::string & | key, |
| IoPtr | value ) |
| void arcs::aubo_scope::DataModel::set | ( | const std::string & | key, |
| long | value ) |
\chinese 将long值赋给指定键。 \endchinese \english Assign a long value to the specified key.
| key | key in the data model (not null and not an empty std::string). |
| value | value assigned to key. |
| IllegalArgumentException | if the key is null or an empty std::string. |
| IllegalStateException | if called from a Qt-based AuboCap program node outside of an UndoableChanges scope (see also UndoRedoManager). \endenglish |
| void arcs::aubo_scope::DataModel::set | ( | const std::string & | key, |
| PayloadPtr | value ) |
| void arcs::aubo_scope::DataModel::set | ( | const std::string & | key, |
| TCPPtr | value ) |
\chinese 将TCP值赋给指定键。 \endchinese \english Assign a TCP value to the specified key.
| key | key in the data model (not null and not an empty std::string). |
| value | value assigned to key. |
| IllegalArgumentException | if the key is null or an empty std::string. |
| IllegalStateException | if called from a Qt-based AuboCap program node outside of an UndoableChanges scope (see also UndoRedoManager). \endenglish |
| void arcs::aubo_scope::DataModel::set | ( | const std::string & | key, |
| uint64_t | value ) |
| void arcs::aubo_scope::DataModel::set | ( | const std::string & | key, |
| VariablePtr | value ) |
\chinese 将Variable值赋给指定键。 \endchinese \english Assign a Variable value to the specified key.
| key | key in the data model (not null and not an empty std::string). |
| value | value assigned to key. |
| IllegalArgumentException | if the key is null or an empty std::string. |
| IllegalStateException | if called from a Qt-based AuboCap program node outside of an UndoableChanges scope (see also UndoRedoManager). \endenglish |
| void arcs::aubo_scope::DataModel::set | ( | const std::string & | key, |
| WaypointPtr | value ) |
|
friend |
|
private |
在文件 data_model.h 第 710 行定义.