home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
High Voltage Shareware
/
high1.zip
/
high1
/
DIR9
/
WIZTOO.ZIP
/
ROSWIZ.TXT
< prev
next >
Wrap
Text File
|
1993-09-22
|
5KB
|
102 lines
// File: ROSWIZ.TXT
// September 20, 1993
// Fairfield, Iowa
// Aerosoft (R) Roster Wizard Version 1.0
// Copyright (c) Aerosoft 1993 All rights reserved.
// This software source code is FREEWARE. You may be use the
// source code or redistribute the source code free of charge.
// However, you cannot sell this source code or any alteration of
// the source code.
This file documents some design notes about the program. See file ROSWIZ.MAN
for a description of the operation of the ROSWIZ program. Before reviewing
this document please read ROSWIZ.MAN for an explanation of the concept of a
Roster. Note that an object listening to a channel is called a server while
an object calling on a channel is called a client.
ROSWIZ reads an input file specifying roster servers and it generates
four files that can be used to implement these channels.
This translation is done in two steps: the server specs are deciphered and
stored in a database. The server specs database is then used to generate the
output files.
ROSWIZ uses two principle objects to decipher the channel specs: InStream
and ChannelSpecs. InStream reads each channel spec entry into a buffer
and provides parsing member functions for extracting tokens from an entry.
There are three kinds of tokens: numbers, labels, and 1-char delimiters.
ChannelSpecs provides a database holding each deciphered channel entry.
A deciphered channel spec consists of six parts:
return type specifier (only int, long, float, double, and void are legal)
function name
proto-list (the argument list including the arguments' type
specifiers)
arg-list (a list of argument names without type specifiers)
default return value
max receivers (the max number of objects that can be connected to
the channel)
Member function GetNextChannelSpec deciphers a spec. It relies upon the
parsing functions of InStream to do this. It scans left to right looking for
each component of a channel spec.
NOTE: InStream skips nested parenthesis that may be found inside and argument list.
This simplifies the work that GetNextChannelSpec must do.
Once the channel specs have been deciphered, code generation is a simple matter
of taking each spec and generating "cookbook" code. This code is as follows:
1) CHNNLDEF.H declares a class for every channel specified. Each class
declares a pure-virtual member function. This approach lets C++'s
polymorphism route channel messages to the appropriate objects.
2) ROSTER.H declares the class Roster and a global object, oRoster.
All roster messages are routed thru object oRoster. For each
channel there are five member functions:
Connect, Disconnect, ChannelStatus, First<channel name>,
Next<channel name>
Connect and Disconnect are used by servers to control message
routing to themselves. First<>/Next<> is used by a client to scan
the roster. Anyone can use ChannelStatus -- examples are checking whether
a connect or disconnect was successful or checking whether a channel has
anyone connected.
Roster uses function overloading to map from a channel class to
the corresponding channel list. This is done for Connect, Disconnect, and
ChannelStatus.
There is a separate ChannelList object for each channel. This is done for
future enhancement when templates are supported. Then, channel list pointers
can refer to channel classes rather than being "void" pointers.
3) ROSTER.CPP defines object oRoster and it's member functions.
4) APP.CPP contains code templates. It is available to assist programmers in
writing code for clients and servers.
There are two static support files that augment the above four files:
1) CHANNEL.H declares class ChannelList. It is used by ROSTER.H
2) CHANNEL.CPP defines the member functions of class ChannelList.
When writing code for a client or server, include file CHNNLDEF.H
Classes that define objects servers must be derived from the corresponding
roster's class. If an object receives data from more than one channel,
then use multiple inheritance.
Build your application by including modules ROSTER.CPP and CHANNEL.CPP in your
project.
Review the example program provided to get a better understanding about the use
of the Roster Wizard.