Drag[en]gine Script Module DragonScript  1.23
Dragengine.Service Class Reference

Service. More...

Inheritance diagram for Dragengine.Service:

Public Member Functions

Constructors
Service new (String name)
 Create named service. More...
 
Service new (String name, ServiceObject data)
 Create named service with additional creation data. More...
 

Management

String getName ()
 Service name. More...
 
ServiceListener getListener ()
 Get listener or null. More...
 
void setListener (ServiceListener listener)
 Set listener or null. More...
 
void startRequest (ServiceObject request)
 Start service request. More...
 
void startRequest (UniqueID id, ServiceObject request)
 Start service request. More...
 
void cancelRequest (UniqueID id)
 Cancel service request if running. More...
 
ServiceObject runAction (ServiceObject action)
 Run action returning result immediately. More...
 
static UniqueID nextId ()
 Next request identifier. More...
 

Detailed Description

Service.

Version
1.23

Services provide various platform or community functionality not handled by other modules. Such services are typically queried infrequently and take a certain time time complete. For this reason service request are asynchronous. Data is carried in a generic deServiceObject object. Users have to know the interface of the service. There is no support to query interface structure unless a service desires to provide these using a special service query.

Each service has a unique name across the entire game engine instance. If the name of services of different service modules collide it is undefined which service the user receives.

This is a native class.

Member Function Documentation

◆ cancelRequest()

void Dragengine.Service.cancelRequest ( UniqueID  id)

Cancel service request if running.

Parameters
idIdentifier of request to cancel.

◆ getListener()

ServiceListener Dragengine.Service.getListener ( )

Get listener or null.

◆ getName()

String Dragengine.Service.getName ( )

Service name.

◆ new() [1/2]

Service Dragengine.Service.new ( String  name)

Create named service.

Exceptions
EInvalidParamNamed service not supported by any loaded service module.
Parameters
nameUnique name of service to create.

◆ new() [2/2]

Service Dragengine.Service.new ( String  name,
ServiceObject  data 
)

Create named service with additional creation data.

Exceptions
EInvalidParamNamed service not supported by any loaded service module.
Parameters
nameUnique name of service to create.
dataAdditional data required for creating service.

◆ nextId()

static UniqueID Dragengine.Service.nextId ( )
static

Next request identifier.

Call this method to obtain the next global request identifier to use for calling startRequest(UniqueID,ServiceObject). The returned identifier is unique across all services for until the application is shut down.

◆ runAction()

ServiceObject Dragengine.Service.runAction ( ServiceObject  action)

Run action returning result immediately.

Can return nullptr if action has no return value.

◆ setListener()

void Dragengine.Service.setListener ( ServiceListener  listener)

Set listener or null.

◆ startRequest() [1/2]

void Dragengine.Service.startRequest ( ServiceObject  request)

Start service request.

Assigned service listener will be called with the received answer. Depending on the service one or more responses can be received. Use this call if you are only interested in the response not which request it belongs to and if you do not need to cancel the request later on.

Parameters
requestRequest to send. Content depends on service and function to invoke.

◆ startRequest() [2/2]

void Dragengine.Service.startRequest ( UniqueID  id,
ServiceObject  request 
)

Start service request.

Assigned service listener will be called with the received answer. Depending on the service one or more responses can be received. Call nextId() to obtain the next unique identifier to use for the request. This allows to identify which response has been triggered by which request by matching the identifier in the response against the identifier used in the request. Using this call is required if you have the need to potentially cancel the request.

Parameters
idIdentifier to use to match responses.
requestRequest to send. Content depends on service and function to invoke.

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