Class: DimRpcInfo 
Library: DIM
Author: C. Gaspar  
Version: v1.0 Update :Thu Feb 11 15:52:46 1999

Description :

    To be used by DIM clients - implements RPC subscription (blocking or non-blocking)
        Required Parameters: the Service Name and the value (nolink) to receive when RPC service not available
    The methods set() and get() are used to send and receive data to and from the server.
    Please refer to Usage for examples on how to use DimRpcInfo.

Constructors :

Destructors : Public Functions :

   Set Methods: To be used  to send the RPC request (data) to the Server 

   Handler: If the user implements it, it gets Called when an RPC answer is received (DimRpc)     Get Methods: To get the data received from the server: Can be used for blocking reception of RPCs or
                             inside rpcInfoHandler in order to get the data received from the server Usage :

    DimRpcInfo non-blocking example:

        #include "dic.hxx"

        class Rpc : public DimRpcInfo
        {
            void rpcInfoHandler() {
                int valin;
                valin = getInt();
                cout << "Callback RPC Received : " << valin << endl;
        }
        public:
            Rpc(char *name) : DimRpcInfo(name, -1) { };
        };

        main()
        {
             int rpcCBValue = 0;
             Rpc rpcCB("TESTRPC/INT");
 
             while(1)
             {
                    rpcCB.setData(rpcCBValue);
                    sleep(5);
             }
        }

    DimRpcInfo non-blocking example with timeout:
   
//When/if the timeout fires the handler will be called with the nolink value as contents 

        #include "dic.hxx"

        class Rpc : public DimRpcInfo
        {
            void rpcInfoHandler() {
                int valin;
                valin = getInt();
                cout << "Callback RPC Received : " << valin << endl;
        }
        public:
            Rpc(char *name, int timeout) : DimRpcInfo(name, timeout, -1) { };
        };

        main()
        {
             int rpcCBValue = 0;
             Rpc rpcCB("TESTRPC/INT", 10);
 
             while(1)
             {
                    rpcCB.setData(rpcCBValue);
                    sleep(5);
             }
        }

    DimRpcInfo blocking example:

        #include "dic.hxx"

        main()
        {
             int rpcValue = 0;
             DimRpcInfo rpc("TESTRPC/INT",-1);

             while(1)
             {
                  rpc.setData(rpcValue);
                  rpcValue = rpc.getInt();
                  sleep(5);
            }
        }
 
 


Last update : 02/11/99 15:53:02 by MkHelp 1.1.0