#include <OutputDetector.h>
Public Member Functions | |
OutputDetector (int loc, bool DirPos, FileHandler *fh) | |
Constructor. | |
virtual | ~OutputDetector () |
Default Desctructor. | |
void | setFileHandler (FileHandler *fh) |
Sets the OutputDetector's filehandler. | |
void | WriteVehiclesToFile () |
Writes the OutputDetector's vehicles to file. | |
std::vector< Vehicle * > | getVehicles () |
void | addVehicle (Vehicle *pVeh, double curTime) |
Adds a vehicle to the OutputDetector. | |
Private Member Functions | |
void | clear () |
Private Attributes | |
FileHandler * | m_pFileHandler |
Definition at line 19 of file OutputDetector.h.
OutputDetector::OutputDetector | ( | int | loc, | |
bool | DirPos, | |||
FileHandler * | fh | |||
) |
Constructor.
loc | The location of the OutputDetector | |
DirPos | Whether or not the OutputDetector is in the positive direction | |
fh | The filehandler to use |
Definition at line 24 of file OutputDetector.cpp.
References Detector::m_DirPos, Detector::m_Location, and m_pFileHandler.
00025 { 00026 m_Location = loc; 00027 m_DirPos = DirPos; 00028 m_pFileHandler = fh; 00029 }
OutputDetector::~OutputDetector | ( | ) | [virtual] |
void OutputDetector::setFileHandler | ( | FileHandler * | fh | ) |
Sets the OutputDetector's filehandler.
fh | The filehandler to use |
Definition at line 64 of file OutputDetector.cpp.
References m_pFileHandler.
00065 { 00066 m_pFileHandler = fh; 00067 }
void OutputDetector::WriteVehiclesToFile | ( | ) |
Writes the OutputDetector's vehicles to file.
Definition at line 52 of file OutputDetector.cpp.
References m_pFileHandler, Detector::m_vVehicles, and FileHandler::writeLine().
Referenced by Direction::update().
00053 { 00054 for(int i = 0; i < m_vVehicles.size(); i++) 00055 m_pFileHandler->writeLine(m_vVehicles.at(i)); 00056 // once written, they must be deleted 00057 m_vVehicles.clear(); 00058 }
std::vector<Vehicle*> OutputDetector::getVehicles | ( | ) |
void OutputDetector::addVehicle | ( | Vehicle * | pVeh, | |
double | curTime | |||
) | [virtual] |
Adds a vehicle to the OutputDetector.
pVeh | The vehicle to add | |
curTime | The current simulation time |
Reimplemented from Detector.
Definition at line 42 of file OutputDetector.cpp.
References Detector::FindDetectorArrivalTime(), Detector::m_vVehicles, and Vehicle::setTime().
Referenced by Lane::CheckDetectors().
00043 { 00044 // set the vehicle time to the arrival time at the detector 00045 double ArrivalTime = FindDetectorArrivalTime(pVeh, curTime); 00046 pVeh->setTime(ArrivalTime); 00047 // now add to vector prior to writing 00048 m_vVehicles.push_back(pVeh); 00049 }
void OutputDetector::clear | ( | ) | [private] |
Definition at line 69 of file OutputDetector.cpp.
References Detector::m_vVehicles.
00070 { 00071 m_vVehicles.clear(); 00072 }
FileHandler* OutputDetector::m_pFileHandler [private] |
Definition at line 33 of file OutputDetector.h.
Referenced by OutputDetector(), setFileHandler(), and WriteVehiclesToFile().