#include <bikes.h>
Public Member Functions | |
Bikes () | |
int | getTotalGears () const |
int | getTotalCapacity () const |
void | print (ostream &out=cout) const |
void | read (string filename) throw ( logic_error, invalid_argument ) |
unsigned | size () const |
~Bikes () | |
Private Attributes | |
vector< Bike * > | bikes |
The Bikes class. vector class, stores information about bikes. The vector stores pointers to these objects, and provides methods for destructing, reading, printing, and totaling the volume of such objects.
Bikes::Bikes | ( | ) |
Default class constructor.
Bikes::~Bikes | ( | ) |
Class destructor.
int Bikes::getTotalCapacity | ( | ) | const |
Computes and returns the total capacity of the bikes stored in the vector.
int Bikes::getTotalGears | ( | ) | const |
Computes and returns the total number of gears of the bikes stored in the vector.
void Bikes::print | ( | ostream & | out = cout | ) | const |
Prints to the ostream out this object's bikes. The ostream defaults to cout.
out | an ostream for printing (defaults to cout) |
void Bikes::read | ( | string | filename | ) | |
throw | ( | logic_error, | |||
invalid_argument | |||||
) |
Uses the BikeFactory to read and make Bike objects from the file named filename
, storing them the bikes vector. Throws an exception if the file does open successfully. Throws an exception if the read operation encounters an invalid argument.
filename | a string containing the make of the file to read |
logic_error | if the file does not open successfully |
invalid_argument | if the read operation encounters an invalid argument |
unsigned Bikes::size | ( | ) | const |
Returns the number of bikes.
|
private |