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

  1. //    File:    BCWIZ.TXT
  2.  
  3. //                                                   September 20, 1993
  4. //                                                   Fairfield, Iowa
  5.  
  6. //          Aerosoft  (R)  Broadcast Channel 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 BCWIZ.MAN 
  15. for a description of the operation of the BCWIZ program.  Before reviewing
  16. this document please read BCWIZ.MAN for an explanation of the concept of a
  17. Broadcast Channel.  Note that an object listening to a channel is called a
  18. consumer while an object sending data is called a producer.
  19.  
  20. BCWIZ reads an input file specifying broadcast channels and it generates
  21. four files that can be used to implement these channels.
  22.  
  23. This translation is done in two steps:  the broadcast channel specs are
  24. deciphered and stored in a database.  The channel specs database is then
  25. used to generate the output files.
  26.  
  27. BCWIZ 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) BRDCASTR.H declares the class Broadcaster and a global object, oBroadcaster.
  59.        All broadcast messages are routed thru object oBroadcaster.  For each
  60.        channel there are four member functions:
  61.        
  62.                Connect, Disconnect, ChannelStatus, Broadcast<channel name>
  63.                
  64.        Connect and Disconnect are used by broadcast consumers to control message
  65.        routing to themselves.  Broadcast<> is used by a producer to forward
  66.        a message.  Anyone can use ChannelStatus -- examples are checking whether
  67.        a connect or disconnect was successful or checking whether a channel has
  68.        anyone connected.
  69.        
  70.        Broadcaster uses function overloading to map from a channel class to
  71.        the corresponding channel list.  This is done for Connect, Disconnect, and 
  72.        ChannelStatus.
  73.        
  74.        There is a separate ChannelList object for each channel.  This is done for
  75.        future enhancement when templates are supported.  Then, channel list pointers
  76.        can refer to channel classes rather than being "void" pointers.
  77.        
  78.     3) BRDCASTR.CPP defines object oBroadcaster and it's member functions.
  79.     
  80.     4) APP.CPP contains code templates.  It is available to assist programmers in
  81.        writing code for producers and consumers.
  82.  
  83. There are two static support files that augment the above four files:
  84.  
  85.     1) CHANNEL.H declares class ChannelList.  It is used by BRDCASTR.H
  86.     
  87.     2) CHANNEL.CPP defines the member functions of class ChannelList.                                                   
  88.  
  89.  
  90. When writing code for a producer or consumer, include file CHNNLDEF.H
  91. Classes that define objects consumers must be derived from the corresponding
  92. broadcast channel's class.  If an object receives data from more than one channel,
  93. then use multiple inheritance.
  94.  
  95. Build your application by including modules BRDCASTR.CPP and CHANNEL.CPP in your 
  96. project.
  97.  
  98. Review the example program provided to get a better understanding about the use
  99. of the Broadcast Channel Wizard.
  100.  
  101.