Porovnávané verzie

Kľúč

  • Tento riadok sa pridal
  • Riadok je odstránený.
  • Formátovanie sa zmenilo.

A The meaning of object the ESL Interface object is to give provide a survey and visualization to way to clarify and tidy up the relations among ESL scripts in an application (a parent of the object of ESL Interface type is a system object ESLINTERFACES).
Relations among scripts are formed by the calling of the RPC or RPCX procedure procedures. This callings 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 procedureprocedures. It defines a group of RPC procedureprocedures. The name of the object ESL Interface can be used in the definition of ESL script after key word keyword IMPLEMENTATION.

Example:

IMPLEMENTATION I.MsgServer

The name of one or more object objects of ESL Interface type must follow the key word keyword IMPLEMENTATION. Any No 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 key word keyword IMPLEMENTATION (it means that the ESL script implements the interface).
From 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 surveyclarify) the logical relations among ESL scripts that are generated by the mutual calling of RPC procedures. The meaning of interface is in the dictation of procedures which that the particular ESL script must implement - it implements them in fact.

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

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


Interfaces implemented by scripts

E.MSGServer - interface I.MsgServer:

Blok kódu
languageesl
themeRDark
 ;***********************************************************************************
 ; 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)
 ;*********************************************************************************** 

...

Blok kódu
languageesl
themeRDark
 ; 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 by key word 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:

Blok kódu
languageesl
themeRDark
;***********************************************************************************
 ; 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 server server's point of view (E.MSGServer), communication side (scheme it is not important who communicates with the server (S.MSGClient picture or other another object) 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 interface I.MsgClientMsgClient interface.

Info
titleRelated pages:

ESL Interface configuration
PROCEDURE action
IMPLEMENTATION action
Fill procedures in the ESL script editor