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

Descrition :

    To be used by DIM clients - implements DIM service subscription and reception
    DimInfo constructors subscribe to DIM services.
    DimInfo Services can be requested to be updated when the contents change and/or at regular time intervals.
    The services are received at startup, when the server updates them or after a timeout limit if the parameter "time" is specified.
    This gives the following possibilities:

        - Receive the service at startup and then
        - Receive the service only when the server updates it
              - no "time" parameter
        - Receive the service at regular time intervals (if the server doesn't update it) or
        - Receive the service at regular intervals and also when the server updates it
              - some "time" parameter
        - Receive the service when the server updates it, but also after a timeout (to make sure the server is alive)
              - longish "time" parameter

    Note: The parameter "time" is sent to the server. It is the server that updates the services even on the time basis

    Please refer to Usage for examples.

Constructors :

    Constructors for Services updated only by the server

    Constructors for Services updated (also) on a time basis     Constructors for Services with a Handler for multiple Services (without time)     Constructors for Services with a Handler for multiple Services (with time) Destructors : Public Functions : Usage : DIM Client Services (DimInfo) can be used in several ways:   - The user variable is of type DimInfo 
    Example : The Service is received when the Server updates it
  main()
{
        DimInfo runNumber("DELPHI/RUN_NUMBER", -1);
        while(1)
        {
                ...
                cout << runNumber.getInt() << endl;
        }
}
 
    Example : The Service is received when the Server updates it and every 30 seconds otherwise
  main()
{
        DimInfo runNumber("DELPHI/RUN_NUMBER", 30, -1);
        while(1)
        {
                ...
                cout << runNumber.getInt() << endl;
        }
}

    Example : The Service is received at regular intervals of 5 seconds (the  Server does not explicitly update it)
 

main()
{
        DimInfo triggerRate("DELPHI/TRIGGER_RATE", 5, -1.0);
        while(1)
        {
                ...
                cout << triggerRate.getFloat() << endl;
        }
}

- Inheritance: The user class inherits from DimInfo
    Example:
 

class RunNumber: public DimInfo
{
public:
         // subscribe to service with handler
        RunNumber(): DimInfo("DELPHI/RUN_NUMBER", -1) {}
        void infoHandler( ) {cout << getInt() << endl;} // update handler
};
 
A class subscribes to many DimServices with only one handler
    Example:
  class RumVars : public DimClient // inheritance necessary because a handler is to be used
{
        DimInfo runNumber;
        DimInfo runType;
public:
        RunVars:
                runNumber("DELPHI/RUN_NUMBER", -1, this), // subscribe with handler
                runType("DELPHI/RUN_TYPE", "not available", this), // subscribe with handler
                {}
        void infoHandler( ) {
                DimInfo *curr = getInfo() // get current DimInfo address
                if(curr == &runNumber) { int run = curr->getInt( ) };
                else { char *type = curr->getString( ) };
                //etc.
        }
};


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