// parsefile.cpp Implementing the horribly difficult Parse File module #include "parsefile.h" /******************************************************************************* // FUNCTION NAME: ParseFile // // DESCRIPTION OF FUNCTION: Error-checks a BAM file, storing the records into // doubly-linked lists and writing a BAC error report file. // // DESCRIPTION OF ALGORITHM: Opens the BAC output file stream, calls the // functions to parse individual sections, closes the output file stream // // CALLED BY: OpenBAMFile // CALLS: GetAlleyInfo,GetEventInfo,GetToolsInfo,GetBallInfo,GetReleaseInfo, // GetConditionsInfo,GetGameInfo,GetFramesInfo // // PARAMETERS: / inout / inputFile - input filestream that has been opened to // the desired BAM file // / in / FileName - string that contains the full name, including // extension, of the BAM file // / inout / AlleyList - AlleyListType that contains no records // / inout / EventList - EventListType that contains no record // / inout / ToolsList - ToolsListType that contains no records // / inout / BallList - BallListType that contains no records // / inout / ReleaseList - empty ReleaseListType object // / inout / ConditionsList - empty ConditionsListType object // // PRECONDITIONS: inputFile has been properly initalized to the correct file, // the BAM file contains section label lines, the lists are empty // // POSTCONDITIONS: Any records which were properly-formatted in the BAM file // have been stored into the appropriate linked lists // // AUTHOR: Amy Langill *2B DATE: 3/28/1999 *******************************************************************************/ void ParseFile(ifstream& input,string Name,AlleyListType& Alleys, EventListType& Events,ToolsListType& Tools, BallListType& Balls,ReleaseListType& Releases, ConditionsListType& Conditions,GameListType& Games, FrameListType& Frames) { // First open the output file for the other functions ofstream errorFile; string errorName; // Chop the BAM extension off the file name for the error report file name errorName = Name.substr(0,Name.length()-INPUT_EXTENSION.length()); // Add the right extension on errorName += ERROR_EXTENSION; // Open the BAC report file: errorFile.open(errorName.c_str()); GetAlleyInfo(input,errorFile,Name,Alleys); GetEventInfo(input,errorFile,Name,Events); GetToolsInfo(input,errorFile,Name,Tools); GetBallInfo(input,errorFile,Name,Balls); GetReleaseInfo(input,errorFile,Name,Releases); GetConditionsInfo(input,errorFile,Name,Conditions); GetGameInfo(input,errorFile,Name,Games,Alleys,Events,Tools,Conditions); GetFrameInfo(input,errorFile,Name,Frames,Games,Balls,Releases); errorFile.close(); return; }