#ifndef BALLANE_H #define BALLANE_H // balllane.h Interface file for the LaneType class /******************************************************************************* // MODULE NAME: LaneType // INTERFACE FILE: ballane.h // IMPLEMENTATION FILE: ballane.cpp // // PURPOSE: To provide a LaneType useful in implementing the BAL program, // allowing the user to create a new LaneType object, store new values into it, // test those values for validity, and print the current or default value of // the object // // FUNCTIONS: Name Purpose // LaneType Parameterless Constructor // LaneType Constructor w/specified lane numbers // isValid Test whether lane numbers are valid // isDefault Test whether lane numbers contain default values // Print Print out the current values // valueIs Print out the current values // Default Print out the default values // Limits Report the limits on lane number values // Store Store 2 new int values into the lane numbers // Store Store a string of int values into the object // Reset Change the values of the lane numbers to their // defaults // // AUTHOR: Amy Langill *2B DATE: 3/20/1999 *******************************************************************************/ #include // For strings & string functions #include // For string streams (string to int conversion) using namespace std; const int LANE_FLD_WIDTH=2; // Width of each lane # const int LANE_WDTH=5; // Total width of lanes field const int DEFAULT_LANE=99; // Default lane # const int LANE_MIN=1; // Limits on lane values const int LANE_MAX=99; // const char LANE_FILLER='0'; // For formatting output const char LANE_DELIMITER='-'; // class LaneType { public: // Constructors LaneType(); // parameter-less LaneType(int lane1,int lane2); // w/specified lane values // Observers bool isValid(); // Does the object contain valid values? bool isDefault(); // Does the object contain the default value? string Print(); // Print the lanes as a formatted string string valueIs(); // Same as print, different name string Default(); // Print a string that contains the default values string Limits(); // Create a string that tells what the limits are for lanes // Transformers void Store(int lane1,int lane2); // Store two new ints into the lanes void Store(string laneString); // Store a new string into the lanes void Reset(); // Change the stored values to the defaults private: int firstLane; int secondLane; }; #endif