The QRemoteServiceClassRegister class manages the various remote service classes which can be instantiated. More...
#include <QRemoteServiceClassRegister>
enum | InstanceType { SharedInstance, UniqueInstance } |
QList<QRemoteServiceIdentifier> | types () const |
bool | registerType ( QRemoteServiceClassRegister::InstanceType type = UniqueInstance ) |
Q_SERVICE ( T, name, interface, version ) |
The QRemoteServiceClassRegister class manages the various remote service classes which can be instantiated.
Defines the possible service instanciation methodologies.
Constant | Value | Description |
---|---|---|
QRemoteServiceClassRegister::SharedInstance | 0 | Each new request for this service receives a reference to the same service object instance. This can be compared with a singleton pattern. |
QRemoteServiceClassRegister::UniqueInstance | 1 | A new service object instance is created for each new client requesting a reference to the service. |
This template function registers the provided template class as remote service and returns true if the registration was successfull. The type specifies the method used for service class instanciation.
QRemoteServiceClassRegister::registerType<ServiceClass>();
Every service class must be marked via the Q_SERVICE() macro.
Returns the list of all registered service types.
This macro marks a class as remote service and should be placed next to the Q_OBJECT macro. T represents the name of the class implementing the service, name specifies name under which the service is registered, interface name and version represents the interface version. All parameters must match the interface information provided by the associated service XML file.
class ServiceClass : public QObject { Q_OBJECT Q_SERVICE(ServiceClass, "ServiceName", "com.nokia.qt.interfacename", "1.2"); public: ServiceClass(QObject* parent) : QObject(parent) {}; public slots: void serviceCall(); };