The principle goal of MOOC is to simplify the development of front-end software, by reducing the amount of code which has to be written from scratch for each front-end. The current MOOC has achieved this goal quite well. It has made it possible to reuse code which implements the functionality common to all front-ends. This common functionality is handling the RETDAT/SETDAT protocols, echoing settings to the central database, handling the FTP and snapshot plot protocols, connecting to AEOLUS, handling big clears from AEOLUS, handling alarm block downloads, scanning for alarms, and reporting alarms to AEOLUS. The only demand that MOOC makes on the front-end programmer is that methods be provided for reading and setting the basic device proporties, i.e., basic status, basic control, reading, and setting, and that some functions be written for initialization/construction of the objects.
Use of MOOC
The MOOC primitives
1. MOOC initialization
This routine intializes static variables in kernel.c. It should
be called before any other MOOC kernel routines.
Arguments:
cln is a unique class number, aka, device type,
to be associated with the class. A class number is an index into
the static array of
pointers to class information.
nscl is the number of classes from which this new
class will inherit instance variables and methods.
scl is an array of nscl elements. Each element
is to contain the class number of a fully initialized class.
nmt is the maximum number of methods this class
can have excluding inherited methods.
livs is the bytes required per object of this class
to store instance variables excluding inherited instance variables.
short name_class(short cln,char name[]);
Initializes the name of the class with class number cln. The name be upto 11 bytes long counting the terminating '\0' byte.
short add_class_msg(short cln,short mt, PMETHOD meth);
Sets the method which is to be invoked when the indicated message is sent to an object with class number cln. This new method will override the existing method, if any, for this message.
Arguments:
cln is the class number.
mt is the message type. The value should/must
be chosen from the enumeration constants in mtdefs.h.
meth is a pointer to the method function.
This routine instaniates/constructs an object by allocating storage
for the object and then sending the object the Init message if the object
has established an Init method. The Init method must initialize
all instance variables of the class, including
inherited instance variables.
Arguments:
oid is a unique object id to be associated with
the object. An object id is an index into the static array of pointers
to
object information
and instance variables.
cln is a class number
params is a pointer to an area of memory.
This pointer will be passed to the object's Init method, so the memory
it points to
should contain any
data that the object will need to intialize itself. The object should
not expect this storage to remain
allocated to the object
after the call to the Init method has completed. Data which must
be kept for the lifetime of
the object should
be stored in the object's instance variables.
name is the name of the object. The name
may be upto 12 bytes long including the terminating '\0' byte.
This function returns information about the method established for a
particular message and object. To actuallly send the
message one must call the method function, i.e., (*worker)(*pfc,<message
arguments>,*ppivs). The message arguments
are typically two pointers to void.
Arguments:
oid is the object id of the object.
mt is the type of the message.
pfc is set to the class number of class which provided
the method.
worker is set to point to the method function
ppivs is set to point to the section of this object's
instance variables which contain the instance variables of the class
which provided
the method.
1. Alarm
2. FTP
3. Snapshot plot
The MOOC protocol handling code
1. RETDAT
2. SETDAT
3. WRITER
4. FTPMAN
5. ALARMR
6. SLAM
MOOC internals
The MOOC kernel
The figure below presents the data structures used by the MOOC kernel
to maintain class and object information.
Structure members