next up previous contents
Next: MIT widgets Up: No Title Previous: The application programmers

Objects In C

Very early during the design phases of the Device Server Model (DSM) it was recognised that the problem of device access is well-suited to Object Oriented Programming (OOP). The definition of a generic device which unifies all devices can be implemented with a root device class from which all other new classes can be derived. The root device class implements the basic functionality of the DSM while the device classes implement the device specific functionality. This means that for each new device class the device server programmer implements, only the new device related code has to be developed - the basic DSM functionalities (like network access, a command handler and so on) are automatically inherited by deriving the new class from the root class.

Although the advantages of OOP are obvious the choice of an OOP language is not always so obvious. Any choice made had to be compatible with the operating systems SunOS, HP-UX and OS9 (the operating systems being used presently at the ESRF). The lowest common denominator in this list is OS9. Operating system compatibility means compatibility with the OS9 C language compiler from Microware (the authors of OS9). This reduces the choice to a C-like OOP language (e.g. C++ or Objective C) or developing an OOP programming technique in C. Seeing as at the time the choice for an OOP language was made (1990) , none of the C-like OOP languages available on OS9 were compatible with the Microware C compiler the only solution left was to use OOP programming technique in C.

OOP programming techniques are numerous. This is partly due to the fact that C lends itself to OOP by its ability to support new types via the typedef construct. OOP techniques in C are 90% discipline and 10% implementation. The technique which has been developed for the DSM is called Objects in C or OIC. OIC is based on the MIT Widget programming model. This chapter will describe OIC and how to program in it. No prior knowledge is assumed about Widget programming. The reader is assumed to be conversant in C however.





next up previous contents
Next: MIT widgets Up: No Title Previous: The application programmers



Andy Goetz
Tue Jan 28 13:58:13 MET 1997