// releserecord.cpp Implementation file for ReleaseRecord class /******************************************************************************* // MODULE NAME: ReleaseRecord // INTERFACE FILE: releaserecord.h // IMPLEMENTATION FILE: releaserecord.cpp // // PURPOSE: To provide a ReleaseRecord type useful in implementing the BAL // program, which allows the user to create a record, update a field in the // record, print the current value of a field in the record, test the validity // of a field in the record, compare one record to another to determine sorting // order, and produce strings with the record information in them which are // formatted for output either to standard output or to a BAM file. // // FUNCTIONS: Name Purpose // ReleaseRecord Paramterless constructor // ReleaseRecord Constructor w/specified Release Index // LessThan Test whether this record should precede another // GreaterThan Test whether this record should follow another // Equals Show whether this record has the same index as // another one // fieldOK Determine if anything is wrong with a field of // the record // FieldContains Print the contents of the field // FieldDefault Print the default contents of a field // FieldLimits Print the limits in effect on the field // FieldLabel Print the correct label for the field // FieldWidth Print the correct width for the field // IndexIs Indicate the index of the record // NewIndex Change the index of a record // Update Change the contents of a field // Reset Reset the value of a field to its default // Reset Reset all fields to their defaults // Replace Change all the fields of a record to the values // of all the fields of another record // List Create a string which holds the record's // contents formatted for on-screen viewing // BriefList Create abbreviated string record listing // Print Create a string which holds the record's // contents formatted for BAM file viewing // // // AUTHOR: Amy Langill *2B DATE: 3/23/1999 *******************************************************************************/ #include "releaserecord.h" /********************************CONSTRUCTORS**********************************/ /******************************************************************************* // FUNCTION NAME: ReleaseRecord // // DESCRIPTION OF FUNCTION: Parameterless Constructor // // DESCRIPTION OF ALGORITHM: Create an object of class ReleaseRecord with // default values in all the fields by initializing each field to the // appropriate defaults with the member functions of the field types // // CALLED BY: client // CALLS: LimitInt::setLimit,LimitInt::SetSize,setChar::setString, // LimitFloat::setLimit,LimitFloat::SetSize // // PARAMETERS: none // // PRECONDITIONS: none // // POSTCONDITIONS: A ReleaseRecord object has been created w/the appropriate // default field values // // AUTHOR: Amy Langill *2B DATE: 3/23/1999 *******************************************************************************/ ReleaseRecord::ReleaseRecord() { // Initialize rdex: rdex.setLimit(GREATERTHAN,R_RDEX_LIMIT); rdex.SetSize(R_RDEX_WIDTH); // Initialize release: release.setString(R_RELEASE_STRING); // Initialize foul: foul.setLimit(GREATERTHANEQUALS,R_FOUL_LOWER_LIMIT,LESSTHAN, R_FOUL_UPPER_LIMIT); foul.SetSize(R_FOUL_WIDTH); // Initialize slide: slide.setLimit(GREATERTHANEQUALS,R_SLIDE_LOWER_LIMIT,LESSTHAN, R_SLIDE_UPPER_LIMIT); slide.SetSize(R_SLIDE_WIDTH); // Initialize shuffle: shuffle.setString(R_SHUFFLE_STRING); // Initialize speed: speed.setLimit(GREATERTHANEQUALS,R_SPEED_LOWER_LIMIT,LESSTHAN, R_SPEED_UPPER_LIMIT); speed.SetSize(R_SPEED_WIDTH); // Initialize revolutions: revolutions.setLimit(GREATERTHANEQUALS,R_REVOLUTIONS_LIMIT); revolutions.SetSize(R_REVOLUTIONS_WIDTH); // Initialize lift: lift.setString(R_LIFT_STRING); // Initialize loft: loft.setLimit(GREATERTHANEQUALS,R_LOFT_LOWER_LIMIT,LESSTHAN, R_LOFT_UPPER_LIMIT); loft.SetSize(R_LOFT_WIDTH); } /******************************************************************************* // FUNCTION NAME: ReleaseRecord // // DESCRIPTION OF FUNCTION: Constructor w/specified Release Index // // DESCRIPTION OF ALGORITHM: Creates an object of class ReleaseRecord w/user- // specified index and default values for all other fields by calling the // appropriate member functions of each of the field types // // CALLED BY: client // CALLS: LimitInt::setLimit,LimitInt::SetSize,LimitInt::Store, // BALString::SetSize,setChar::setString,LimitFloat::setLimit, // LimitFloat::SetSize // // PARAMETERS: / in / releaseIndex - int value of desired index // // PRECONDITIONS: none // // POSTCONDITIONS: A new ReleaseRecord has been created such that the value of // rdex is the specified releaseIndex & all other fields contain default values // // AUTHOR: Amy Langill *2B DATE: 3/23/1999 *******************************************************************************/ ReleaseRecord::ReleaseRecord(int releaseIndex) { // Initialize rdex: rdex.setLimit(GREATERTHAN,R_RDEX_LIMIT); rdex.SetSize(R_RDEX_WIDTH); rdex.Store(releaseIndex); // Initialize release: release.setString(R_RELEASE_STRING); // Initialize foul: foul.setLimit(GREATERTHANEQUALS,R_FOUL_LOWER_LIMIT,LESSTHAN, R_FOUL_UPPER_LIMIT); foul.SetSize(R_FOUL_WIDTH); // Initialize slide: slide.setLimit(GREATERTHANEQUALS,R_SLIDE_LOWER_LIMIT,LESSTHAN, R_SLIDE_UPPER_LIMIT); slide.SetSize(R_SLIDE_WIDTH); // Initialize shuffle: shuffle.setString(R_SHUFFLE_STRING); // Initialize speed: speed.setLimit(GREATERTHANEQUALS,R_SPEED_LOWER_LIMIT,LESSTHAN, R_SPEED_UPPER_LIMIT); speed.SetSize(R_SPEED_WIDTH); // Initialize revolutions: revolutions.setLimit(GREATERTHANEQUALS,R_REVOLUTIONS_LIMIT); revolutions.SetSize(R_REVOLUTIONS_WIDTH); // Initialize lift: lift.setString(R_LIFT_STRING); // Initialize loft: loft.setLimit(GREATERTHANEQUALS,R_LOFT_LOWER_LIMIT,LESSTHAN, R_LOFT_UPPER_LIMIT); loft.SetSize(R_LOFT_WIDTH); }; /*********************************OBSERVERS************************************/ /******************************************************************************* // FUNCTION NAME: LessThan // // DESCRIPTION OF FUNCTION: Test whether this record should precede another // // DESCRIPTION OF ALGORITHM: Uses the LessThan member function of LimitInt to // compare the indices of the two records // // CALLED BY: client // CALLS: LimitInt::LessThan // // PARAMETERS: / in / another - ReleaseRecord this one is being compared to // // PRECONDITIONS: none // // POSTCONDITIONS: Returns true if the index of this record is less than that // of another record // // AUTHOR: Amy Langill *2B DATE: 3/23/1999 *******************************************************************************/ bool ReleaseRecord::LessThan(ReleaseRecord another) { return (rdex.LessThan(another.rdex)); } /******************************************************************************* // FUNCTION NAME: GreaterThan // // DESCRIPTION OF FUNCTION: Test whether this record should follow another one // // DESCRIPTION OF ALGORITHM: Using the GreaterThan member function of LimitInt, // compares the indices of the two records against each other. // // CALLED BY: client // CALLS: LimitInt::GreaterThan // // PARAMETERS: / in / another - ReleaseRecord this one is being compared to // // PRECONDITIONS: none // // POSTCONDITIONS: if the index of this record is greater than that of the // other record, returns true. Returns false otherwise. // // AUTHOR: Amy Langill *2B DATE: 3/23/1999 *******************************************************************************/ bool ReleaseRecord::GreaterThan(ReleaseRecord another) { return (rdex.GreaterThan(another.rdex)); } /******************************************************************************* // FUNCTION NAME: Equals // // DESCRIPTION OF FUNCTION: Test whether this record has the same index value // as another record // // DESCRIPTION OF ALGORITHM: Using the Equals member function of LimitInt, // compares the index of this record with the index of another // // CALLED BY: client // CALLS: LimitInt::Equals // // PARAMETERS: / in / another - ReleaseRecord this one is being compared to // // PRECONDITIONS: none // // POSTCONDITIONS: If the indices of the two records are exactly equal, returns // true. Returns false otherwise. // // AUTHOR: Amy Langill *2B DATE: 3/23/1999 *******************************************************************************/ bool ReleaseRecord::Equals(ReleaseRecord another) { return (rdex.Equals(another.rdex)); } /******************************************************************************* // FUNCTION NAME: fieldOK // // DESCRIPTION OF FUNCTION: Detect whether there's an error in a field // // DESCRIPTION OF ALGORITHM: Depending upon the fieldToCheck variable, function // calls the appropriate error-checking function for the type of field in // question and returns the type of error detected in the field // // CALLED BY: client // CALLS: LimitInt::isValid,LimitFloat::isValid,setChar::isValid, // // PARAMETERS: / in / fieldToCheck - ReleaseFieldType that indicates which // field is to be checked for errors // // PRECONDITIONS: none // // POSTCONDITIONS: Returns the type of error found in the given field, if any // // AUTHOR: Amy Langill *2B DATE: 3/23/1999 *******************************************************************************/ DataErrorType ReleaseRecord::fieldOK(ReleaseFieldType fieldToCheck) { DataErrorType error=NO_PROB; switch (fieldToCheck) // Check the appropriate field and set the error { // flag according to the type of error, if any case R_RDEX: if (!(rdex.isValid())) error=INDEX_RANGE_ERR; break; case R_RELEASE: if (!(release.isValid())) error=CHAR_ERR; break; case R_SHUFFLE: if (!(shuffle.isValid())) error=CHAR_ERR; break; case R_LIFT: if (!(lift.isValid())) error=CHAR_ERR; break; case R_FOUL: if (!(foul.isValid())) error=RANGE_ERR; break; case R_SLIDE: if (!(slide.isValid())) error=RANGE_ERR; break; case R_SPEED: if (!(speed.isValid())) error=RANGE_ERR; break; case R_REVOLUTIONS: if (!(revolutions.isValid())) error=RANGE_ERR; break; case R_LOFT: if (!(loft.isValid())) error=RANGE_ERR; break; } return error; // Tell calling function status of that field } /******************************************************************************* // FUNCTION NAME: FieldContains // // DESCRIPTION OF FUNCTION: Report the contents of a given field // // DESCRIPTION OF ALGORITHM: Depending on the value of fieldToPrint, calls the // Print member function of that field's type // // CALLED BY: Replace, client // CALLS: LimitInt::Print,setChar::Print,LimitFloat::Print // // PARAMETERS: / in / fieldToPrint - ReleaseFieldType that specifies what field // is to be printed to the output string // // PRECONDITIONS: none // // POSTCONDITIONS: A string is returned which contains the current value of the // specified field and is the same width as that field's print size // // AUTHOR: Amy Langill *2B DATE: 3/23/1999 *******************************************************************************/ string ReleaseRecord::FieldContains(ReleaseFieldType fieldToPrint) { string fieldString; // hold the string to report back switch (fieldToPrint) // Call the print function for the appropriate field { case R_RDEX: fieldString = rdex.Print(); break; case R_RELEASE: fieldString = release.Print(); break; case R_FOUL: fieldString = foul.Print(); break; case R_SLIDE: fieldString = slide.Print(); break; case R_SHUFFLE: fieldString = shuffle.Print(); break; case R_SPEED: fieldString = speed.Print(); break; case R_REVOLUTIONS: fieldString = revolutions.Print(); break; case R_LIFT: fieldString = lift.Print(); break; case R_LOFT: fieldString = loft.Print(); break; } return fieldString; // Return the string with the field info in it } /******************************************************************************* // FUNCTION NAME: FieldDefault // // DESCRIPTION OF FUNCTION: Print the default contents of the specified field // // DESCRIPTION OF ALGORITHM: Depending on the value of fieldToCheck, calls the // Default member function for that field's type // // CALLED BY: client // CALLS: LimitInt::Default,setChar::Default,LimitFloat::Default // // PARAMETERS: / in / fieldToCheck - ReleaseFieldType that indicates which // field's default string is to be returned // // PRECONDITIONS: none // // POSTCONDITIONS: A string containing the default value of the specified field // which has the appropriate width for that field is returned // // AUTHOR: Amy Langill *2B DATE: 3/23/1999 *******************************************************************************/ string ReleaseRecord::FieldDefault(ReleaseFieldType fieldToCheck) { string defaultString; switch (fieldToCheck) // Call the Default() function for the appropriate field { case R_RDEX: defaultString = rdex.Default(); break; case R_RELEASE: defaultString = release.Default(); break; case R_FOUL: defaultString = foul.Default(); break; case R_SLIDE: defaultString = slide.Default(); break; case R_SHUFFLE: defaultString = shuffle.Default(); break; case R_SPEED: defaultString = speed.Default(); break; case R_REVOLUTIONS: defaultString = revolutions.Default(); break; case R_LIFT: defaultString = lift.Default(); break; case R_LOFT: defaultString = loft.Default(); break; } return defaultString; // Return the string with the field info in it } /******************************************************************************* // FUNCTION NAME: FieldLimits // // DESCRIPTION OF FUNCTION: Create a string that has the info for a field's // constraints. // // DESCRIPTION OF ALGORITHM: Depending on the value of fieldToCheck, calls the // Limits member function of the appropriate field type. // // CALLED BY: client // CALLS: LimitInt::Limits,setChar::Limits,LimitFloat::Limits // // PARAMETERS: / in / fieldToCheck - ReleaseFieldType that indicates which // field's limits are to be output // // PRECONDITIONS: none // // POSTCONDITIONS: A string containing a message about the limits in effect // on the specified field is returned. // // AUTHOR: Amy Langill *2B DATE: 3/23/1999 *******************************************************************************/ string ReleaseRecord::FieldLimits(ReleaseFieldType fieldToCheck) { string limitString; switch (fieldToCheck) // Find the limit string for the appropriate field { case R_RDEX: limitString= rdex.Limits(); break; case R_RELEASE: limitString= release.Limits(); break; case R_FOUL: limitString= foul.Limits(); break; case R_SLIDE: limitString= slide.Limits(); break; case R_SHUFFLE: limitString= shuffle.Limits(); break; case R_SPEED: limitString= speed.Limits(); break; case R_REVOLUTIONS: limitString= revolutions.Limits(); break; case R_LIFT: limitString = lift.Limits(); break; case R_LOFT: limitString = loft.Limits(); break; } return limitString; // Report on the limits for that field } /******************************************************************************* // FUNCTION NAME: FieldLabel // // DESCRIPTION OF FUNCTION: Report the label of a given field // // DESCRIPTION OF ALGORITHM: Depending on the value of fieldToPrint, returns // the named constant which contains that field's label // // CALLED BY: client // CALLS: none // // PARAMETERS: / in / fieldToPrint - ReleaseFieldType that specifies which // field is being addressed // // PRECONDITIONS: none // // POSTCONDITIONS: A string is returned which contains the label as defined in // the record type's interface file. // // AUTHOR: Amy Langill *2B DATE: 3/28/1999 *******************************************************************************/ string ReleaseRecord::FieldLabel(ReleaseFieldType fieldToPrint) { string label; switch (fieldToPrint) { case R_RDEX: label = R_RDEX_LABEL; break; case R_RELEASE: label = R_RELEASE_LABEL; break; case R_FOUL: label = R_FOUL_LABEL; break; case R_SLIDE: label = R_SLIDE_LABEL; break; case R_SHUFFLE: label = R_SHUFFLE_LABEL; break; case R_SPEED: label = R_SPEED_LABEL; break; case R_REVOLUTIONS: label = R_REVOLUTIONS_LABEL; break; case R_LIFT: label = R_LIFT_LABEL; break; case R_LOFT: label = R_LOFT_LABEL; break; } return label; } /******************************************************************************* // FUNCTION NAME: FieldWidth // // DESCRIPTION OF FUNCTION: Reports the print size of the indicated field // // DESCRIPTION OF ALGORITHM: Depending on the value of fieldToCheck, returns // the named constant that represents that field's width // // CALLED BY: client // CALLS: none // // PARAMETERS: / in / fieldToCheck - ReleaseFieldType that indicates which part // of the record is being accessed // // PRECONDITIONS: none // // POSTCONDITIONS: An int is returned which indicates the defined width of the // desired field as specified by fieldToCheck. // // AUTHOR: Amy Langill *2B DATE: 3/28/1999 *******************************************************************************/ int ReleaseRecord::FieldWidth(ReleaseFieldType fieldToCheck) { int width=0; switch (fieldToCheck) { case R_RDEX: width = R_RDEX_WIDTH; break; case R_FOUL: width = R_FOUL_WIDTH; break; case R_SLIDE: width = R_SLIDE_WIDTH; break; case R_SPEED: width = R_SPEED_WIDTH; break; case R_REVOLUTIONS: width = R_REVOLUTIONS_WIDTH; break; case R_LOFT: width = R_LOFT_WIDTH; break; case R_RELEASE: case R_SHUFFLE: case R_LIFT: width = CHAR_WIDTH; break; } return width; } /******************************************************************************* // FUNCTION NAME: IndexIs // // DESCRIPTION OF FUNCTION: Reports the index of the record // // DESCRIPTION OF ALGORITHM: Calls the LimitInt::valueIs function for rdex // // CALLED BY: client // CALLS: LimitInt::valueIs // // PARAMETERS: none // // PRECONDITIONS: none // // POSTCONDITIONS: The current value of the record's index is returned. // // AUTHOR: Amy Langill *2B DATE: 3/23/1999 *******************************************************************************/ int ReleaseRecord::IndexIs() { return rdex.valueIs(); } /********************************TRANSFORMERS**********************************/ /******************************************************************************* // FUNCTION NAME: NewIndex // // DESCRIPTION OF FUNCTION: Changes the index of the record to a new value // // DESCRIPTION OF ALGORITHM: Assigns the newIndexValue to rdex with the // LimitInt::Store function // // CALLED BY: client // CALLS: LimitInt::Store // // PARAMETERS: / in / newIndexValue - int that tells what new index should be // // PRECONDITIONS: none // // POSTCONDITIONS: value of rdex has been changed to newIndexValue // // AUTHOR: Amy Langill *2B DATE: 3/28/1999 *******************************************************************************/ void ReleaseRecord::NewIndex(int newIndexValue) { rdex.Store(newIndexValue); return; } /******************************************************************************* // FUNCTION NAME: Update // // DESCRIPTION OF FUNCTION: Change the value of a specified field to the value // contained in the dataString // // DESCRIPTION OF ALGORITHM: Depending on the field to be updated, as indicated // by fieldToChange, function converts the string to a different type if // necessary and calls the Store member function of the field's type // // CALLED BY: Replace, client // CALLS: LimitInt::Store,LimitFloat::Store,setChar::Store, // // // PARAMETERS: / in / dataString - string that contains the value to be stored // in the field // / in / fieldToChange - ReleaseFieldType that indicates the field // to be changed to a new value // // PRECONDITIONS: dataString contains a value that can be converted to the // appropriate data type without difficulty // // POSTCONDITIONS: The field indicated by fieldToChange has been modified to // the value in dataString // // AUTHOR: Amy Langill *2B DATE: 3/23/1999 *******************************************************************************/ void ReleaseRecord::Update(string dataString,ReleaseFieldType fieldToChange) { istringstream data(dataString); // For converting from string type int newIntValue; // Hold converted int data char newCharValue; // Hold converted char data float newFloatValue; // Hold converted float data switch (fieldToChange) // Store the data based on the field to be changed { // Convert to int and store into the field: case R_RDEX: data >> newIntValue; rdex.Store(newIntValue); break; case R_REVOLUTIONS: data >> newIntValue; revolutions.Store(newIntValue); break; // Convert to char and store into the field: case R_RELEASE: data >> newCharValue; release.Store(newCharValue); break; case R_SHUFFLE: data >> newCharValue; shuffle.Store(newCharValue); break; case R_LIFT: data >> newCharValue; lift.Store(newCharValue); break; // Convert to float and store into the field case R_FOUL: data >> newFloatValue; foul.Store(newFloatValue); break; case R_SLIDE: data >> newFloatValue; slide.Store(newFloatValue); break; case R_SPEED: data >> newFloatValue; speed.Store(newFloatValue); break; case R_LOFT: data >> newFloatValue; loft.Store(newFloatValue); break; } return; } /******************************************************************************* // FUNCTION NAME: Reset // // DESCRIPTION OF FUNCTION: Reset the value of a specified field of the record // to its default value // // DESCRIPTION OF ALGORITHM: Depending on the value of fieldToChange, calls the // appropriate resetting member function of each field's type // // CALLED BY: client // CALLS: LimitInt::ResetValue,setChar::ResetValue,LimitFloat::ResetValue // // PARAMETERS: / in / fieldToChange - ReleaseFieldType that indicates which // field to change to its default value // // PRECONDITIONS: none // // POSTCONDITIONS: The value of the specified field has been changd to the // default value for that field // // AUTHOR: Amy Langill *2B DATE: 3/23/1999 *******************************************************************************/ void ReleaseRecord::Reset(ReleaseFieldType fieldToChange) { switch (fieldToChange) // depending on the field, call the function to change { // that element to its default value case R_RDEX: rdex.ResetValue(); break; case R_RELEASE: release.ResetValue(); break; case R_FOUL: foul.ResetValue(); break; case R_SLIDE: slide.ResetValue(); break; case R_SHUFFLE: shuffle.ResetValue(); break; case R_SPEED: speed.ResetValue(); break; case R_REVOLUTIONS: revolutions.ResetValue(); break; case R_LIFT: lift.ResetValue(); break; case R_LOFT: loft.ResetValue(); break; } return; } /******************************************************************************* // FUNCTION NAME: Reset // // DESCRIPTION OF FUNCTION: Reset the value of all the fields of the record to // their respective default values // // DESCRIPTION OF ALGORITHM: Calls the appropriate resetting member function of // each field type for each field in the record // // CALLED BY: client // CALLS: LimitInt::ResetValue,setChar::ResetValue,LimitFloat::ResetValue // // PARAMETERS: none // // PRECONDITIONS: none // // POSTCONDITIONS: The value of all of the fields have been changed to the // default values for those fields // // AUTHOR: Amy Langill *2B DATE: 3/23/1999 *******************************************************************************/ void ReleaseRecord::Reset() { // depending on the field, call the function to change // that element to its default value rdex.ResetValue(); release.ResetValue(); foul.ResetValue(); slide.ResetValue(); shuffle.ResetValue(); speed.ResetValue(); revolutions.ResetValue(); lift.ResetValue(); loft.ResetValue(); return; } /******************************************************************************* // FUNCTION NAME: Replace // // DESCRIPTION OF FUNCTION: Replaces the contents of the current record with // the contents of another record. // // DESCRIPTION OF ALGORITHM: Updates each field in this record with the field // contents of newRecord. // // CALLED BY: client // CALLS: Update,FieldContains // // PARAMETERS: / in / newRecord - ReleaseRecord whose contents are to be stored // into this record // // PRECONDITIONS: none // // POSTCONDITIONS: The field values of every field in newRecord have been // stored into the appropriate fields of this record // // AUTHOR: Amy Langill *2B DATE: 3/23/1999 *******************************************************************************/ void ReleaseRecord::Replace(ReleaseRecord newRecord) { ReleaseFieldType currFld; for (currFld=R_RDEX;currFld<=R_LOFT;currFld=ReleaseFieldType(currFld+1)) this->Update(newRecord.FieldContains(currFld),currFld); return; } /**********************************ITERATORS***********************************/ /******************************************************************************* // FUNCTION NAME: List // // DESCRIPTION OF FUNCTION: Generate a string that holds the record information // formatted for screen output // // DESCRIPTION OF ALGORITHM: Creates a string that holds field labels and // contents as created by the Print member functionof each field's type for // every field in the record, delimited with spaces between the fields. // // CALLED BY: client // CALLS: LimitInt::Print,LimitFloat::Print,setChar::Print, // // PARAMETERS: none // // PRECONDITIONS: none // // POSTCONDITIONS: A string has been created which contains the current data // stored in the record formatted for screen viewing // // AUTHOR: Amy Langill *2B DATE: 3/23/1999 *******************************************************************************/ string ReleaseRecord::List() { string outputString; // To hold formatted output // print out label, data, spacing character for each field outputString = R_RDEX_LABEL + rdex.Print() + R_FLD_SEPARATOR; outputString += R_RELEASE_LABEL + release.Print() + R_FLD_SEPARATOR; outputString += R_FOUL_LABEL + foul.Print() + R_FLD_SEPARATOR; outputString += R_SLIDE_LABEL + slide.Print() + R_FLD_SEPARATOR; outputString += R_SHUFFLE_LABEL + shuffle.Print() + R_FLD_SEPARATOR; outputString += R_SPEED_LABEL + speed.Print() + '\n'; // Screen is only 80 characters wide, so need to print on two lines outputString += R_REVOLUTIONS_LABEL + revolutions.Print() + R_FLD_SEPARATOR; outputString += R_LIFT_LABEL + lift.Print() + R_FLD_SEPARATOR; outputString += R_LOFT_LABEL + loft.Print(); return outputString; // send back the screen-formatted output } /******************************************************************************* // FUNCTION NAME: BriefList // // DESCRIPTION OF FUNCTION: Generate a string that holds abbreviated record // information formatted for screen // // DESCRIPTION OF ALGORITHM: Creates a string that holds field labels and // contents as created by the Print member function of each field's type for // some fields in the record, delimited with spaces between the fields. // // CALLED BY: client // CALLS: LimitInt::Print,LimitFloat::Print,setChar::Print // // PARAMETERS: none // // PRECONDITIONS: none // // POSTCONDITIONS: A string has been created which contains an abbreviated // version of the current data stored in the record formatted for viewing // // AUTHOR: Amy Langill *2B DATE: 3/29/1999 *******************************************************************************/ string ReleaseRecord::BriefList() { string outputString; // To hold formatted output // This stuff fits on one line of the screen: outputString = rdex.Print() + R_FLD_SEPARATOR; outputString += R_RELEASE_LABEL + release.Print() + R_FLD_SEPARATOR; outputString += R_FOUL_LABEL + foul.Print() + R_FLD_SEPARATOR; outputString += R_SLIDE_LABEL + slide.Print() + R_FLD_SEPARATOR; outputString += R_SHUFFLE_LABEL + shuffle.Print() + R_FLD_SEPARATOR; outputString += R_SPEED_LABEL + speed.Print() + R_FLD_SEPARATOR; outputString += R_REVOLUTIONS_LABEL + revolutions.Print(); return outputString; // send back the screen-formatted output } /******************************************************************************* // FUNCTION NAME: Print // // DESCRIPTION OF FUNCTION: Generate a string that holds the record formatted // for BAM file output // // DESCRIPTION OF ALGORITHM: Creates a string which contains the field labels // and contents for each field delimited by spaces through successive // assignment to the output string // // CALLED BY: client // CALLS: LimitInt::Print,LimitFloat::Print,setChar::Print, // // PARAMETERS: none // // PRECONDITIONS: none // // POSTCONDITIONS: A string has been created which contains the current data // stored in the record formatted for BAM file output // // AUTHOR: Amy Langill *2B DATE: 3/23/1999 *******************************************************************************/ string ReleaseRecord::Print() { string outputString; // To hold formatted output // for each field, printout label, data, space outputString = R_RDEX_LABEL + rdex.Print() + R_FLD_SEPARATOR; outputString += R_RELEASE_LABEL + release.Print() + R_FLD_SEPARATOR; outputString += R_FOUL_LABEL + foul.Print() + R_FLD_SEPARATOR; outputString += R_SLIDE_LABEL + slide.Print() + R_FLD_SEPARATOR; outputString += R_SHUFFLE_LABEL + shuffle.Print() + R_FLD_SEPARATOR; outputString += R_SPEED_LABEL + speed.Print() + R_FLD_SEPARATOR; outputString += R_REVOLUTIONS_LABEL + revolutions.Print() + R_FLD_SEPARATOR; outputString += R_LIFT_LABEL + lift.Print() + R_FLD_SEPARATOR; outputString += R_LOFT_LABEL + loft.Print(); return outputString; // send back the report-formatted output }