HyperWag Programmer Manual
General Overview:
The hyperwag project follows a general input-processing-output format. The entire program is contained within a Hyperwag object that contains an instream and an outstream. Input is taken care of by a hierarchy of wagInputs, each of which overloads the input
operator in a different way to read in the desired language. Each line of input translates to an Appt object, representing an appointment with a start time, end time, duration, and a description. Appts are the basic units of hyperwag.
After inputting, all the Appt objects are pushed onto a large vector contained within the Application class. (The vector changes sizes depending on the constant NUM_DIVISIONS, explained in the comments of the code. ) The application class is inside Hyperwag and is responsible for the processing of the appts. All the appts are pushed back onto a large vector. Filter objects are created in a vector and the user is allowed to choose which Filters she would like to apply. Filters are another inheritance hierarchy, each of which uses a differently implemented
FilterVector class to filter out non-matching elements. The large appointment vector is run through the Filters (also contained in Appointment) and then added to the appropriate Day object. The Application class contains a vector of 7 Day objects meant to signify a week.
After the Appts have been added to the Day class, they are checked for conflicts. If a conflict occurs, the appt is modified to reflect that. Output then begins. Another inheritance hierarchy is used to output the file based on the output format. The output operator is overloaded differently for each output class. Finally, the Hyperwag class prompts the user if they would like to use a different set of filters on the same files. The vectors are cleared and the program jumps back to the beginning of processing.
Class Specific:
Inputters:
Inheritance hierarchy of inputters, the only difference being that the operator
is overloaded differently for each one. The text is parsed line by line and Appt objects are created accordingly. Incorrect input formats are caught here. Adding inputters simply involves overloading the
operator differently. Additional functions are added to check for comments and whitespace. Note: only one Appt is extracted with each call. In languages like wagalang that can delimit multiple appointments at a time, this means the inputter must buffer excess appointments.
Hyperwag:
A wrapper class that ties the entire process together. Contains an input, an output, and an application.
Application:
Takes care of the processing for the program. It contains a vector of all appointments, a vector of filtered appointments, a vector of filters, and a vector of Days that represent a week. The vector of all appointments is run through the filters one by one and then added to the Days vector. The input and output operators
and
are called to take care of input and output. Conflicts are also detected and updated in this class.
Filters:
Inheritance hierarchy that overloads the
FilterVector function differently for each one.
FilterVector takes in a vector, filters it, and returns a new one. Called by Application.
Outputters:
Output inheritance hierarchy. Similarly to inputters, these overload the
operator differently for each class. The HTML outputter contains helper functions that write headers and footers appropriately.
Improvements:
* Inputters could be improved to store comments and allow them to be outputted.
* Additional filters could be implemented.
* Multiple appointments could be stored in one time slot using a vector of vectors.
* Alternately, conflicts could be resolved at the time of detection using user input.
Specific steps to extend hyperwag
Input:
Derive a new class from
WagInput. Overload the extraction operator with your input code, using the buffer if necessary. Overload the filetype detector and add to the if-else section of hyperwag.cpp, following the examples there.
Output:
Derive a new class from
WagOutput. Overload the insertion operator with your output code. Extend the filetype checking in hyperwag.cpp as necessary.
Filter:
Derive a new class as before. From here it's probably easiest to cut/paste an existing xxfilter.cpp into your new file and tweak the inner loop.
Back to
HyperWag
There are no comments on this page. [Add comment]