#include <Truck.h>
Public Member Functions | |
Truck () | |
Default constructor. | |
virtual | ~Truck () |
Default destructor. | |
void | setAW (int i, double w) |
Sets the weight of a given axle. | |
void | setAS (int i, double s) |
Sets the spacing of a given axle. | |
int | getNoAxles () |
Gets the vehicle's number of axles. | |
double | getAS (int i) |
Gets the spacing of a given axle. | |
double | getAW (int i) |
Gets the weight of a given axle. | |
bool | operator== (Truck &x) |
bool | operator< (const Truck &x) |
void | returnTruckData (int truckData[]) |
Parses the Truck's data into an array. | |
void | doSAFTData (char *pTruck) |
void | doCASTORData (char *pTruck) |
void | createSAFTVehicle (std::string data) |
Creates a truck from a given SAFT string. | |
void | createCASTORVehicle (std::string data) |
Creates a truck from a given CASTOR string. | |
void | setDriver () |
void | setGVW (double weight) |
Sets the GVW of the vehicle to a given weight. | |
Private Member Functions | |
int | getID () |
Gets the class of the Vehicle. | |
Private Attributes | |
std::vector< Axle * > | axles |
double | m_OverhangFront |
double | m_OverhangBack |
Definition at line 22 of file Truck.h.
Truck::Truck | ( | ) |
Truck::~Truck | ( | ) | [virtual] |
void Truck::setAW | ( | int | i, | |
double | w | |||
) |
Sets the weight of a given axle.
i | the axle to operate upon | |
w | the desired weight |
Reimplemented from Vehicle.
void Truck::setAS | ( | int | i, | |
double | s | |||
) |
Sets the spacing of a given axle.
The space of a given axle to the next axle
i | the axle to operate upon | |
s | the desired spacing |
Reimplemented from Vehicle.
int Truck::getNoAxles | ( | ) |
Gets the vehicle's number of axles.
Reimplemented from Vehicle.
double Truck::getAS | ( | int | i | ) |
Gets the spacing of a given axle.
The space of a given axle to the next axle
i | the axle to operate upon |
Reimplemented from Vehicle.
double Truck::getAW | ( | int | i | ) |
Gets the weight of a given axle.
i | the axle to operate upon |
Reimplemented from Vehicle.
bool Truck::operator== | ( | Truck & | x | ) |
Definition at line 65 of file Truck.cpp.
References returnTruckData().
00066 { 00067 const int N = 33; 00068 int truck1[N]; int truck2[N]; 00069 returnTruckData(truck1); 00070 x.returnTruckData(truck2); 00071 00072 bool same = true; int i = 0; 00073 while(same && i < N) 00074 { 00075 if(truck1[i] != truck2[i]) 00076 same = false; 00077 i++; 00078 } 00079 return same; 00080 }
bool Truck::operator< | ( | const Truck & | x | ) |
Definition at line 58 of file Truck.cpp.
References Vehicle::getTime().
void Truck::returnTruckData | ( | int | truckData[] | ) |
Parses the Truck's data into an array.
Definition at line 33 of file Truck.cpp.
References Vehicle::m_Day, Vehicle::m_GVW, Vehicle::m_Head, Vehicle::m_Hndt, Vehicle::m_Hour, Vehicle::m_intDir, Vehicle::m_Lane, Vehicle::m_Length, Vehicle::m_Min, Vehicle::m_Month, Vehicle::m_NoAxles, Vehicle::m_Sec, Vehicle::m_Trns, Vehicle::m_Velocity, and Vehicle::m_Year.
Referenced by operator==().
00034 { 00035 00036 truckData[0] = m_Head; 00037 truckData[1] = m_Day; 00038 truckData[2] = m_Month; 00039 truckData[3] = m_Year; 00040 truckData[4] = m_Hour; 00041 truckData[5] = m_Min; 00042 truckData[6] = m_Sec; 00043 truckData[7] = m_Hndt; 00044 truckData[8] = m_Velocity; // must change to dm/s 00045 truckData[9] = m_GVW; // change to kg/100 00046 truckData[10] = m_Length; // change to dm 00047 truckData[11] = m_NoAxles; 00048 truckData[12] = m_intDir; //m_DirPointsToRight == true ? 1 : 2; 00049 truckData[13] = m_Lane; 00050 truckData[14] = m_Trns; 00051 00052 for(int i = 0; i <= 33; i++) 00053 { 00054 if( (truckData[i] < 0) || (truckData[i] > 9999) ) truckData[i] = 0; 00055 } 00056 }
void Truck::doSAFTData | ( | char * | pTruck | ) |
void Truck::doCASTORData | ( | char * | pTruck | ) |
void Truck::createSAFTVehicle | ( | std::string | data | ) |
Creates a truck from a given SAFT string.
data | The SAFT string of data |
Reimplemented from Vehicle.
Definition at line 89 of file Truck.cpp.
References Vehicle::createSAFTVehicle(), m_OverhangBack, and m_OverhangFront.
00090 { 00091 Vehicle::createSAFTVehicle(data); 00092 m_OverhangFront = 0.0; 00093 m_OverhangBack = 0.0; 00094 }
void Truck::createCASTORVehicle | ( | std::string | data | ) |
Creates a truck from a given CASTOR string.
data | The CASTOR string of data |
Reimplemented from Vehicle.
Definition at line 103 of file Truck.cpp.
References Vehicle::createCASTORVehicle(), m_OverhangBack, and m_OverhangFront.
00104 { 00105 Vehicle::createCASTORVehicle(data); 00106 m_OverhangFront = 0.0; 00107 m_OverhangBack = 0.0; 00108 }
void Truck::setDriver | ( | ) |
void Truck::setGVW | ( | double | weight | ) |
Sets the GVW of the vehicle to a given weight.
weight | the desired GVW |
Reimplemented from Vehicle.
int Truck::getID | ( | ) | [private] |
std::vector<Axle*> Truck::axles [private] |
double Truck::m_OverhangFront [private] |
Definition at line 52 of file Truck.h.
Referenced by createCASTORVehicle(), and createSAFTVehicle().
double Truck::m_OverhangBack [private] |
Definition at line 53 of file Truck.h.
Referenced by createCASTORVehicle(), and createSAFTVehicle().