00001 // MetricsDetector.h: interface for the MetricsDetector class. 00002 // 00004 00005 #if !defined(AFX_METRICSDETECTOR_H__06A2EEA5_6E1B_4581_BB61_6FEC99FBABCC__INCLUDED_) 00006 #define AFX_METRICSDETECTOR_H__06A2EEA5_6E1B_4581_BB61_6FEC99FBABCC__INCLUDED_ 00007 00008 #if _MSC_VER > 1000 00009 #pragma once 00010 #endif // _MSC_VER > 1000 00011 00012 #include "stdafx.h" 00013 #include "Detector.h" 00014 00015 typedef std::vector< std::vector<double> > M2Ddbl; 00016 00019 class MetricsDetector : public Detector 00020 { 00021 public: 00022 MetricsDetector(std::string dir, WORD DetType, bool DirPos, int nLanes, WORD VehType, int timeInterval, int loc, int RoadLength); 00023 virtual ~MetricsDetector(); 00024 00025 virtual void EndOutput(); 00026 00027 virtual void addVehicle(Vehicle* pVeh, double curTime); 00028 00029 private: 00030 virtual void InitOutputFiles(); 00031 virtual void doIntervalOutput(); 00032 virtual void ReInit(); 00033 00034 void InitCompositionFile(); 00035 void InitHeadwayFile(); 00036 void InitFlowDensityFile(); 00037 00038 void doCompositionOutput(); 00039 void doHeadwayOutput(); 00040 void doFlowDensityOutput(); 00041 00042 void AddCurrentVehicle(Vehicle* pVeh, const double curTime); 00043 void initVectors(); 00044 std::string intToString(int d); 00045 00046 double m_AvgVel; 00047 std::ofstream m_OutFile; 00048 std::vector<WORD> m_vVehicleTypes; 00049 M2Ddbl m_vVelocities; 00050 M2Ddbl m_vHeadways; 00051 std::vector<double> m_vTimeOfLastArrival; 00052 std::vector<int> m_vNoVehicles; 00053 }; 00054 00055 #endif // !defined(AFX_METRICSDETECTOR_H__06A2EEA5_6E1B_4581_BB61_6FEC99FBABCC__INCLUDED_)