00001 // StatDetector.cpp: implementation of the CStatDetector class. 00002 // 00004 00005 #include "stdafx.h" 00006 #include "EvolveTraffic.h" 00007 #include "StatDetector.h" 00008 00009 #ifdef _DEBUG 00010 #undef THIS_FILE 00011 static char THIS_FILE[]=__FILE__; 00012 #define new DEBUG_NEW 00013 #endif 00014 00016 // Construction/Destruction 00018 00019 IMPLEMENT_SERIAL (CStatDetector, CObject, VERSION_NUMBER) 00020 00021 CStatDetector::CStatDetector() 00022 { 00023 m_DetectorType = METRICS_TYPE_FLOWDENSITY; 00024 m_DirPos = true; 00025 m_VehicleType = METRICS_VEH_ALL; 00026 m_TimeInterval = 60; 00027 m_Location = 1000; 00028 } 00029 00030 CStatDetector::~CStatDetector() 00031 { 00032 00033 } 00034 00035 void CStatDetector::Serialize(CArchive &ar) 00036 { 00037 if (ar.IsStoring()) 00038 { 00039 ar << m_DetectorType 00040 << static_cast<int>(m_DirPos) // because I read in an int below 00041 << m_VehicleType 00042 << m_TimeInterval 00043 << m_Location; 00044 } 00045 else 00046 { 00047 int temp; 00048 ar >> m_DetectorType 00049 >> temp 00050 >> m_VehicleType 00051 >> m_TimeInterval 00052 >> m_Location; 00053 00054 m_DirPos = temp == 0 ? false : true; 00055 } 00056 } 00057 00058 WORD CStatDetector::getDetectorType() 00059 { 00060 return m_DetectorType; 00061 } 00062 00063 bool CStatDetector::getDirPos() 00064 { 00065 return m_DirPos; 00066 } 00067 00068 WORD CStatDetector::getVehicleType() 00069 { 00070 return m_VehicleType; 00071 } 00072 00073 int CStatDetector::getTimeInterval() 00074 { 00075 return m_TimeInterval; 00076 } 00077 00078 int CStatDetector::getLocation() 00079 { 00080 return m_Location; 00081 } 00082 00083 void CStatDetector::setDetectorType(WORD type) 00084 { 00085 m_DetectorType = type; 00086 } 00087 00088 void CStatDetector::setDirPos(bool dirpos) 00089 { 00090 m_DirPos = dirpos; 00091 } 00092 00093 void CStatDetector::setVehicleType(WORD type) 00094 { 00095 m_VehicleType = type; 00096 } 00097 00098 void CStatDetector::setTimeInterval(int interval) 00099 { 00100 m_TimeInterval = interval; 00101 } 00102 00103 void CStatDetector::setLocation(int loc) 00104 { 00105 m_Location = loc; 00106 } 00107 00108 void CStatDetector::setMetricsDir(CString dir) 00109 { 00110 m_MetricsDir = dir; 00111 } 00112 00113 std::string CStatDetector::getStdStrMetricsDir() 00114 { 00115 std::string str = (LPCTSTR)m_MetricsDir; 00116 return str; 00117 }