CParameter Class Reference

A class represetning a single IDM parameter that can be saved to file. More...

#include <Parameter.h>

Collaboration diagram for CParameter:

Collaboration graph
[legend]

List of all members.

Public Member Functions

 CParameter ()
virtual ~CParameter ()
 CParameter (const CParameter &param)
void Serialize (CArchive &ar)
CParameteroperator= (const CParameter &param)
double GenKeepingCoV (double newLocation)
double Generate ()
void setID (WORD id)
WORD getID () const
void setDistribution (CDistribution *dist)
CDistributiongetDistribution ()

Private Member Functions

void SetDefaultParams ()

Private Attributes

CDistribution m_Distribution
WORD m_ID


Detailed Description

A class represetning a single IDM parameter that can be saved to file.

Definition at line 17 of file Parameter.h.


Constructor & Destructor Documentation

CParameter::CParameter (  ) 

Definition at line 19 of file Parameter.cpp.

00020 {
00021 
00022 }

CParameter::~CParameter (  )  [virtual]

Definition at line 24 of file Parameter.cpp.

00025 {
00026 
00027 }

CParameter::CParameter ( const CParameter param  ) 

Definition at line 29 of file Parameter.cpp.

References getID(), m_Distribution, and m_ID.

00030 {
00031         this->m_Distribution = param.m_Distribution;
00032         this->m_ID = param.getID();
00033 }

Here is the call graph for this function:


Member Function Documentation

void CParameter::Serialize ( CArchive &  ar  ) 

Definition at line 53 of file Parameter.cpp.

References m_Distribution, m_ID, and CDistribution::Serialize().

Referenced by CIDMParameterSet::Serialize().

00054 {
00055         m_Distribution.Serialize(ar);
00056         if (ar.IsStoring())
00057                 ar << m_ID;
00058         else
00059                 ar >> m_ID;
00060 }

Here is the call graph for this function:

CParameter & CParameter::operator= ( const CParameter param  ) 

Definition at line 140 of file Parameter.cpp.

References getID(), m_Distribution, and m_ID.

00141 {
00142         this->m_Distribution = param.m_Distribution;
00143         this->m_ID = param.getID();
00144 
00145         return *this;
00146 }

Here is the call graph for this function:

double CParameter::GenKeepingCoV ( double  newLocation  ) 

Definition at line 175 of file Parameter.cpp.

References CDistribution::GenKeepingCoV(), and m_Distribution.

00176 {
00177         return m_Distribution.GenKeepingCoV(newLocation);
00178 }

Here is the call graph for this function:

double CParameter::Generate (  ) 

Definition at line 170 of file Parameter.cpp.

References CDistribution::Generate(), and m_Distribution.

00171 {
00172         return m_Distribution.Generate();
00173 }

Here is the call graph for this function:

void CParameter::setID ( WORD  id  ) 

Definition at line 163 of file Parameter.cpp.

References m_ID, and SetDefaultParams().

Referenced by CIDMParameterSet::buildParamSet().

00164 {
00165         m_ID = id;
00166         SetDefaultParams();
00167 }

Here is the call graph for this function:

WORD CParameter::getID (  )  const

Definition at line 158 of file Parameter.cpp.

References m_ID.

Referenced by CParameter(), and operator=().

00159 {
00160         return m_ID;
00161 }

void CParameter::setDistribution ( CDistribution dist  ) 

Definition at line 153 of file Parameter.cpp.

References m_Distribution.

00154 {
00155         m_Distribution = *dist;
00156 }

CDistribution * CParameter::getDistribution (  ) 

Definition at line 148 of file Parameter.cpp.

References m_Distribution.

Referenced by SpeedLimit::addVehicle(), CTrafficConfigDlg::LoadRow(), and CTrafficConfigDlg::SetParamData().

00149 {
00150         return &m_Distribution;
00151 }

void CParameter::SetDefaultParams (  )  [private]

Definition at line 65 of file Parameter.cpp.

References DIST_CONST, IDM_PARAM_A, IDM_PARAM_B, IDM_PARAM_BIAS, IDM_PARAM_DELTA, IDM_PARAM_DELTAATH, IDM_PARAM_POLITE, IDM_PARAM_S0, IDM_PARAM_S1, IDM_PARAM_T, IDM_PARAM_V0, m_Distribution, m_ID, CDistribution::setDistributionID(), CDistribution::setLocation(), and CDistribution::setScale().

Referenced by setID().

00066 {
00067         // Here we set the default IDM properties based on ID
00068         // No set shapes since default distribvution is DIST_NORMAL
00069         switch(m_ID)
00070         {
00071                 case IDM_PARAM_T:
00072                         {
00073                                 m_Distribution.setLocation(1.2);
00074                                 m_Distribution.setScale(0.05);
00075                         }
00076                         break;
00077                 case IDM_PARAM_A:
00078                         {
00079                                 m_Distribution.setLocation(1.0);
00080                                 m_Distribution.setScale(0.05);                  
00081                         }
00082                         break;
00083                 case IDM_PARAM_B:
00084                         {
00085                                 m_Distribution.setLocation(2.0);
00086                                 m_Distribution.setScale(0.1);                   
00087                         }
00088                         break;
00089                 case IDM_PARAM_S0:
00090                         {
00091                                 m_Distribution.setLocation(1.0);
00092                                 m_Distribution.setScale(0.05);                  
00093                         }
00094                         break;
00095                 case IDM_PARAM_S1:
00096                         {
00097                                 m_Distribution.setLocation(10.0);
00098                                 m_Distribution.setScale(0.7);                   
00099                         }
00100                         break;
00101                 case IDM_PARAM_V0:
00102                         {       // Defined as km/h
00103                                 m_Distribution.setLocation(80);
00104                                 m_Distribution.setScale(3.0);                   
00105                         }
00106                         break;
00107                 case IDM_PARAM_DELTA:
00108                         {       // Leave as a constant
00109                                 m_Distribution.setDistributionID(DIST_CONST);
00110                                 m_Distribution.setLocation(4);
00111                         }
00112                         break;
00113                 case IDM_PARAM_POLITE:
00114                         {       // Leave as a constant
00115                                 m_Distribution.setDistributionID(DIST_CONST);
00116                                 m_Distribution.setLocation(0.0);
00117                         }
00118                         break;
00119                 case IDM_PARAM_BIAS:
00120                         {       // Leave as a constant
00121                                 m_Distribution.setDistributionID(DIST_CONST);
00122                                 m_Distribution.setLocation(0.1);
00123                         }
00124                         break;
00125                 case IDM_PARAM_DELTAATH:
00126                         {       // Leave as a constant
00127                                 m_Distribution.setDistributionID(DIST_CONST);
00128                                 m_Distribution.setLocation(0.3);
00129                         }
00130                         break;
00131                 default: // IDM_PARAM_V0:
00132                         {       // Defined as km/h
00133                                 m_Distribution.setLocation(80);
00134                                 m_Distribution.setScale(3.0);                   
00135                         }
00136                         break;
00137         }
00138 }

Here is the call graph for this function:


Member Data Documentation

WORD CParameter::m_ID [private]

Definition at line 52 of file Parameter.h.

Referenced by CParameter(), getID(), operator=(), Serialize(), SetDefaultParams(), and setID().


The documentation for this class was generated from the following files:

Generated on Wed Aug 20 00:48:45 2008 for EvolveTraffic by  doxygen 1.5.6