Code Overview

 

The ORCA design follows the Model-View-Controller design pattern with heavy borrowing of the design patterns in Vermont Recipes for Mac OS X by Bill Cheeseman.

In the Model-View-Controller pattern there are three types of objects: models, views, and controllers.


Models


In ORCA, the model objects usually represent a piece of hardware. They hold the hardware's state and define the logic that manipulates that state. They are also responsible with storing the persistent state of the object and reloading that state when the application is started. In general, ORCA model objects have no connection to the user interface used to present and edit that object's state. There is always a one-to-one correspondence between a piece of hardware and the software model that represents that hardware. Click here for a look at a simple ORCA Model.


Views


In general, there is no code associated with the views in ORCA. All of the dialogs are built graphically using Interface Builder that results in a nib file that is loaded on demand whenever a dialog is opened. The only exceptions are a few specialized NSView subclasses that do special custom drawing, such as plotting.


Controllers


The controller object acts as glue code between the model and the view. They are in charge of making sure that the view has access to the model data that needs to be displayed and are the conduit through which view learns about changes to the model. They also funnel user initiated changes back to the model. One model may actually have many controllers displaying many aspects of its data in multiple views. Click here for a look at a simple ORCA Controller.

ORCA Implementation of the MVC pattern

In ORCA, you will notice that objects are consistently named. For example, the AD811 CAMAC object has the following files:


  1. ORAD811Model.m        --holds all of the AD811 state information and methods to access hw

  2. ORAD811Model.h

  3. ORAD811Controller.m   --this is the glue between the user dialog and the model

  4. ORAD811Controller.h

  5. AD811.nib             --generated by Interface Builder. It 's the GUI dialog.

  6. AD811Card.tif         --the object's icon


In addition, ORCA files that can produce data will have two additional files:

  1. ORAD811Decoder.m       --called for histogramming and record display

  2. ORAD811Decoder.h