home *** CD-ROM | disk | FTP | other *** search
/ High Voltage Shareware / high1.zip / high1 / DIR9 / WIZTOO.ZIP / ROSWIZ.TXT < prev    next >
Text File  |  1993-09-22  |  5KB  |  102 lines

  1. //  File:   ROSWIZ.TXT
  2.  
  3. //                                                   September 20, 1993
  4. //                                                   Fairfield, Iowa
  5.  
  6. //          Aerosoft  (R)  Roster Wizard   Version 1.0
  7. //          Copyright (c)  Aerosoft 1993     All rights reserved.
  8.  
  9. //          This software source code is FREEWARE.  You may be use the
  10. //          source code or redistribute the source code free of charge.
  11. //          However, you cannot sell this source code or any alteration of
  12. //          the source code.
  13.  
  14. This file documents some design notes about the program.  See file ROSWIZ.MAN 
  15. for a description of the operation of the ROSWIZ program.  Before reviewing 
  16. this document please read ROSWIZ.MAN for an explanation of the concept of a 
  17. Roster.  Note that an object listening to a channel is called a server while 
  18. an object calling on a channel is called a client. 
  19.  
  20. ROSWIZ reads an input file specifying roster servers and it generates
  21. four files that can be used to implement these channels.
  22.  
  23. This translation is done in two steps:  the server specs are deciphered and 
  24. stored in a database.  The server specs database is then used to generate the 
  25. output files. 
  26.  
  27. ROSWIZ uses two principle objects to decipher the channel specs: InStream 
  28. and ChannelSpecs.  InStream reads each channel spec entry into a buffer
  29. and provides parsing member functions for extracting tokens from an entry.
  30. There are three kinds of tokens: numbers, labels, and 1-char delimiters.
  31. ChannelSpecs provides a database holding each deciphered channel entry.
  32.  
  33. A deciphered channel spec consists of six parts:
  34.  
  35.     return type specifier  (only int, long, float, double, and void are legal)
  36.     function name
  37.     proto-list             (the argument list including the arguments' type
  38.                             specifiers)
  39.     arg-list               (a list of argument names without type specifiers)
  40.     default return value
  41.     max receivers          (the max number of objects that can be connected to
  42.                             the channel)
  43.                             
  44. Member function GetNextChannelSpec deciphers a spec.  It relies upon the
  45. parsing functions of InStream to do this.  It scans left to right looking for
  46. each component of a channel spec. 
  47.  
  48. NOTE: InStream skips nested parenthesis that may be found inside and argument list.
  49.       This simplifies the work that GetNextChannelSpec must do.
  50.       
  51. Once the channel specs have been deciphered, code generation is a simple matter
  52. of taking each spec and generating "cookbook" code.  This code is as follows:
  53.  
  54.     1) CHNNLDEF.H declares a class for every channel specified.  Each class
  55.        declares a pure-virtual member function.  This approach lets C++'s
  56.        polymorphism route channel messages to the appropriate objects.
  57.        
  58.     2) ROSTER.H declares the class Roster and a global object, oRoster.
  59.        All roster messages are routed thru object oRoster.  For each
  60.        channel there are five member functions:
  61.        
  62.             Connect, Disconnect, ChannelStatus, First<channel name>,
  63.             Next<channel name>
  64.             
  65.        Connect and Disconnect are used by servers to control message
  66.        routing to themselves.  First<>/Next<> is used by a client to scan
  67.        the roster.  Anyone can use ChannelStatus -- examples are checking whether
  68.        a connect or disconnect was successful or checking whether a channel has
  69.        anyone connected.
  70.        
  71.        Roster uses function overloading to map from a channel class to
  72.        the corresponding channel list.  This is done for Connect, Disconnect, and 
  73.        ChannelStatus.
  74.        
  75.        There is a separate ChannelList object for each channel.  This is done for
  76.        future enhancement when templates are supported.  Then, channel list pointers
  77.        can refer to channel classes rather than being "void" pointers.
  78.        
  79.     3) ROSTER.CPP defines object oRoster and it's member functions.
  80.     
  81.     4) APP.CPP contains code templates.  It is available to assist programmers in
  82.        writing code for clients and servers.
  83.  
  84. There are two static support files that augment the above four files:
  85.  
  86.     1) CHANNEL.H declares class ChannelList.  It is used by ROSTER.H
  87.     
  88.     2) CHANNEL.CPP defines the member functions of class ChannelList.                                         
  89.  
  90.  
  91. When writing code for a client or server, include file CHNNLDEF.H
  92. Classes that define objects servers must be derived from the corresponding
  93. roster's class.  If an object receives data from more than one channel,
  94. then use multiple inheritance.
  95.  
  96. Build your application by including modules ROSTER.CPP and CHANNEL.CPP in your 
  97. project.
  98.  
  99. Review the example program provided to get a better understanding about the use
  100. of the Roster Wizard.
  101.  
  102.