Vidíte historickú verziu tejto stránky. Pozrite si aktuálnu verziu.

Porovnať s aktuálnou verziou Zobraziť históriu stránky

« Predchádzajúce Verzia 2 Aktuálny »

A meaning of object ESL Interface is to give a survey and visualization to the relations among ESL scripts in an application (a parent of the object of ESL Interface type is system object).
Relations among scripts are formed by the calling of the RPC or RPCX procedure. This calling identifies the procedure name by text string in the target script. The text string is not checked at saving of script.

The object ESL Interface represents a definition of one or more ESL procedures. It defines a group of RPC procedures. The name of the object ESL Interface can be used in the definition of ESL script after keyword IMPLEMENTATION.

Example:

IMPLEMENTATION I.MsgServer

The name of one or more objects of ESL Interface type must follow the keyword IMPLEMENTATION. Any action is not allowed before it (e.g. definition of procedure, variable or other action).
ESL script must implement all procedures of each ESL Interface which follows the keyword IMPLEMENTATION (it means that the ESL script implements the interface).
On the other side, it is possible to call the procedures of ESL script which is implemented by some interface through the name of the proper interface. This enables to formalize (also to make survey) the logical relations among ESL scripts that are generated by the mutual calling of RPC procedures. The meaning of interface is in dictation of procedures which the particular ESL script must implement - it implements them in fact.

The following example describes the use of the ESL interface in the design of simple action - sending the messages among users. On the user side, there is simple scheme S.MSGClient and on the server side there is the object of Event E.MSGServer type.

E.MSGServer represents the server that offers some services. These services are assured by ESL Interface I.MsgServer and server ensure the existence (implementation) of all necessary procedures (declared on the interface). The interface I.MsgServer provides the procedure RegisterClient. Each client who wants to send the messages is checked in by this procedure and gets the unique identifier. Primary demand is receiving messages asynchronously by registered client. E.MSGServer supplies this action and implements the procedure SendMessage which calls registered client internally. This client must implement interface I.MsgClient which ensures the procedure  ReceivMessage.


Interfaces implemented by scripts

E.MSGServer - interface I.MsgServer:

 ;***********************************************************************************
 ; Object name: I.MsgServer
 ; Interface of MSG Server
 ; Each MSG Server must implement following procedures

 ; Obligatory client registration
 ; Registration assigns the unique _clientUID
 RPC PROCEDURE RegisterClient(IN TEXT _clientName, IN INT _clientHOBJ, IN INT _clientProcessHOBJ, INT _clientUID)
 ; Displacing of the client
 RPC PROCEDURE UnRegistrateClient(INT _clientUID) 
 
 ; Procedure will return the list of all registered clients
 RPC PROCEDURE  GetClientList(RECORD NOALIAS (SD.Public_ClientList) _clients)
 
 ; Procedure will send the message _msg to registered client _dstClientUID
 ; Return code _retCode
 ; 0 - OK
 ; 1 - client _dstClientUID has not been registered
 RPC PROCEDURE SendMessage(IN INT _dstClientUID, IN TEXT _msg, INT _retCode)
 ;*********************************************************************************** 


Minimal (nonfunctional) implementation in ESL script:

 ; Interface of MSG Server
 IMPLEMENTATION I.MsgServer
 
 ; Client registration
 IMPLEMENTATION RPC PROCEDURE I.MsgServer^RegisterClient(IN TEXT _clientName, IN INT _clientHOBJ, IN INT _clientProcessHOBJ, INT _clientUID)
 END RegisterClient
 
 ; Displacing of the client
 IMPLEMENTATION RPC PROCEDURE I.MsgServer^UnRegistrateClient(INT _clientUID)
 END UnRegistrateClient
 
 ; Procedure will return the list of all registered clients
 IMPLEMENTATION RPC PROCEDURE I.MsgServer^GetClientList(RECORD NOALIAS (SD.Public_ClientList) _clients)
 END GetClientList
 
 ; Procedure will send the message _msg to registered client _dstClientUID
 ; Return code _retCode
 ;   0 - OK
 ;   1 - client _dstClientUID has not been registered
 IMPLEMENTATION RPC PROCEDURE I.MsgServer^SendMessage(IN INT _srcClientUID, _dstClientUID, IN TEXT  _msg, INT _retCode)
 END SendMessage


The implementation of the interface procedure starts with the keyword IMPLEMENTATION. Its name consists of the interface name and a symbol '^'. ESL script must implement all prescribed procedures.

S.MSGClient - interface I.MsgClient:

;***********************************************************************************
 ; Object name: I.MsgClient
 ; Interface of MSG Client
 ; Each MSG Client must implement following procedures
 
 ; Receiving the message _msg from client _srcClientUID
 RPC PROCEDURE ReceivMessage(IN INT _srcClientUID, IN TEXT _msg)
 ;***********************************************************************************
 


From the side of the server (E.MSGServer), communication side (scheme S.MSGClient or other objects) is not important, but important is the implementation of the required interface. That is why the client can be represented by another scheme (or objects of Event type) in the real application. Important is to implement the interface I.MsgClient.

  • Žiadne štítky