QRemoteObjectRegistryHost 类

Qt Remote Objects 网络 (主机/注册) 节点。 更多...

头: #include <QRemoteObjectRegistryHost>
CMake: find_package(Qt6 COMPONENTS RemoteObjects REQUIRED)
target_link_libraries(mytarget PRIVATE Qt6::RemoteObjects)
qmake: QT += remoteobjects
继承: QRemoteObjectHostBase

公共函数

  QRemoteObjectRegistryHost (const QUrl & registryAddress = QUrl(), QObject * parent = nullptr)

重实现公共函数

virtual bool setRegistryUrl (const QUrl & registryUrl ) override

详细描述

The QRemoteObjectRegistryHost class provides an entry point to a QtRemoteObjects network. A network can be as simple as two Nodes, or an arbitrarily complex set of processes and devices.

A QRemoteObjectRegistryHost has the same capability that a QRemoteObjectHost has (which includes everything a QRemoteObjectNode supports), and in addition is the owner of the Registry. Any QRemoteObjectHost node that connects to this Node will have all of their Source objects made available by the Registry.

Nodes only support connection to one registry ,调用 QRemoteObjectNode::setRegistryUrl when a Registry is already set is considered an error. For something like a secure and insecure network (where different Registries would be applicable), the recommendation is to create separate Nodes to connect to each, in effect creating two independent Qt Remote Objects networks.

节点可以相互直接连接使用 connectToNode ,或者它们可以使用 QRemoteObjectRegistry 以简化连接。

QRemoteObjectRegistry is a special Replica available to every Node that connects to the Registry Url. It knows how to connect to every QRemoteObjectSource object on the network.

另请参阅 QRemoteObjectNode and QRemoteObjectHost .

成员函数文档编制

QRemoteObjectRegistryHost:: QRemoteObjectRegistryHost (const QUrl & registryAddress = QUrl(), QObject * parent = nullptr)

Constructs a new QRemoteObjectRegistryHost Node with the given parent . RegistryHost Nodes have the same functionality as QRemoteObjectHost Nodes, except rather than being able to connect to a QRemoteObjectRegistry , the provided Host QUrl ( registryAddress ) becomes the address of the registry for other Nodes to connect to.

[override virtual] bool QRemoteObjectRegistryHost:: setRegistryUrl (const QUrl & registryUrl )

重实现访问函数为特性: QRemoteObjectNode::registryUrl .

This method can be used to set the address of this Node to registryUrl (used for other Nodes to connect to this one), if the QUrl isn't set in the constructor. Since this Node becomes the Registry, calling this setter method causes this Node to use the url as the host address. All other Node's use the QRemoteObjectNode::setRegistryUrl method initiate a connection to the Registry.

返回 true if the registry address is set, otherwise false .

另请参阅 QRemoteObjectRegistryHost () 和 QRemoteObjectNode::setRegistryUrl .