Service classifier overview

The capabilities of the Service classifier are made available when you code a service. The type is like a program that has multiple entry points.

The logic in an EGL-written service is stateless, which means that the value of each variable is specific to the invocation.

Any EGL logic type can request a service. When you code the requester, you declare a variable for service access, and that variable is based on a type. If the service was written in EGL, you can use the Service type as the type. Otherwise, you can only use an Interface type for that purpose.

For further details on service invocation, see details on the Interface classifier in “Classifiers for defining EGL prototype parts.”

Here is an example of a service:
Service MyService{}

   // variables and constants can be here

   function calculate(myScore INT[]) returns (BIN (4,2)) 

      numberOfScores, i, mySum INT;
      numberOfScores = myScore.getSize();
      	
      for (i from 1 to numberOfScores by 1)
         mySum = myScore[i] + mySum;	       
      end
    	      
      return(mySum/numberOfScores);
   end

   // other functions are here

end

A Service type does not include a stereotype.