QJsonChannelCore
QJsonChannelServiceRepository Class Reference

The main entity of QJsonChannel represents service repository and provides API for a JSON-RPC method invokation. More...

#include <QJsonChannelServiceRepository.h>

Collaboration diagram for QJsonChannelServiceRepository:
Collaboration graph

Public Member Functions

 QJsonChannelServiceRepository ()
 
 ~QJsonChannelServiceRepository ()
 
bool addService (const QSharedPointer< QJsonChannelService > &service)
 Adds service to the repository. More...
 
bool addService (const QByteArray &name, const QByteArray &version, const QByteArray &description, QSharedPointer< QObject > obj)
 Adds service to the repository. More...
 
bool addThreadSafeService (const QByteArray &name, const QByteArray &version, const QByteArray &description, QSharedPointer< QObject > obj)
 Adds thread-safe service to the repository. Service will be not locker during the methods invocation. More...
 
QSharedPointer< QJsonChannelServicegetService (const QByteArray &serviceName)
 Return service by name. More...
 
QSharedPointer< QObject > getServiceObject (const QByteArray &serviceName)
 Return service object by name. More...
 
bool removeService (const QByteArray &serviceName)
 Removes service from the repository. More...
 
QJsonChannelMessage processMessage (const QJsonChannelMessage &message) const
 Process a JSON-RPC message. In general it means the invocation of a requested function of a requested service. More...
 

Detailed Description

The main entity of QJsonChannel represents service repository and provides API for a JSON-RPC method invokation.

Definition at line 15 of file QJsonChannelServiceRepository.h.

Constructor & Destructor Documentation

◆ QJsonChannelServiceRepository()

QJsonChannelServiceRepository::QJsonChannelServiceRepository ( )

◆ ~QJsonChannelServiceRepository()

QJsonChannelServiceRepository::~QJsonChannelServiceRepository ( )

Member Function Documentation

◆ addService() [1/2]

bool QJsonChannelServiceRepository::addService ( const QSharedPointer< QJsonChannelService > &  service)

Adds service to the repository.

Parameters
serviceA service to attach to the repository
Returns
true in case the sevice was added
false in case of failure

◆ addService() [2/2]

bool QJsonChannelServiceRepository::addService ( const QByteArray &  name,
const QByteArray &  version,
const QByteArray &  description,
QSharedPointer< QObject >  obj 
)

Adds service to the repository.

Parameters
nameService name
versionService version
descriptionService description
objService object
Returns
true In case the sevice was added
false In case of failure

◆ addThreadSafeService()

bool QJsonChannelServiceRepository::addThreadSafeService ( const QByteArray &  name,
const QByteArray &  version,
const QByteArray &  description,
QSharedPointer< QObject >  obj 
)

Adds thread-safe service to the repository. Service will be not locker during the methods invocation.

Parameters
nameService name
versionService version
descriptionService description
objService object
Returns
true In case the sevice was added
false In case of failure

◆ getService()

QSharedPointer<QJsonChannelService> QJsonChannelServiceRepository::getService ( const QByteArray &  serviceName)

Return service by name.

Parameters
serviceNamea service name to search
Returns
QSharedPointer <QJsonChannelService> a found sevice

◆ getServiceObject()

QSharedPointer<QObject> QJsonChannelServiceRepository::getServiceObject ( const QByteArray &  serviceName)

Return service object by name.

Parameters
serviceNamea service name to search
Returns
QSharedPointer<QObject> a found sevice

◆ removeService()

bool QJsonChannelServiceRepository::removeService ( const QByteArray &  serviceName)

Removes service from the repository.

Parameters
serviceNameA service name to remove from the repository
Returns
true in case the sevice was removed
false in case of failure

◆ processMessage()

QJsonChannelMessage QJsonChannelServiceRepository::processMessage ( const QJsonChannelMessage message) const

Process a JSON-RPC message. In general it means the invocation of a requested function of a requested service.

Parameters
messageJSON-RPC message
Returns
QJsonChannelMessage JSON-RPC response message

The documentation for this class was generated from the following file: