|
SUMO - Simulation of Urban MObility
|
00001 /****************************************************************************/ 00007 // Parent object of every person, contains age and any natural characteristic 00008 /****************************************************************************/ 00009 // SUMO, Simulation of Urban MObility; see http://sumo.sourceforge.net/ 00010 // Copyright (C) 2001-2011 DLR (http://www.dlr.de/) and contributors 00011 // activitygen module 00012 // Copyright 2010 TUM (Technische Universitaet Muenchen, http://www.tum.de/) 00013 /****************************************************************************/ 00014 // 00015 // This program is free software; you can redistribute it and/or modify 00016 // it under the terms of the GNU General Public License as published by 00017 // the Free Software Foundation; either version 2 of the License, or 00018 // (at your option) any later version. 00019 // 00020 /****************************************************************************/ 00021 00022 00023 // =========================================================================== 00024 // included modules 00025 // =========================================================================== 00026 #ifdef _MSC_VER 00027 #include <windows_config.h> 00028 #else 00029 #include <config.h> 00030 #endif 00031 00032 #include "AGPerson.h" 00033 #include <utils/common/RandHelper.h> 00034 #include <iostream> 00035 00036 00037 // =========================================================================== 00038 // used namespaces 00039 // =========================================================================== 00040 using namespace std; 00041 00042 00043 // =========================================================================== 00044 // method definitions 00045 // =========================================================================== 00046 AGPerson::AGPerson(int age) throw() : age(age) {} 00047 00048 /****************************************************************************/ 00049 00050 AGPerson::~AGPerson() throw() {} 00051 00052 /****************************************************************************/ 00053 00054 void 00055 AGPerson::print() const throw() { 00056 cout << "- Person: Age=" << age << endl; 00057 } 00058 00059 /****************************************************************************/ 00060 00061 int 00062 AGPerson::getAge() const throw() { 00063 return age; 00064 } 00065 00066 /****************************************************************************/ 00067 00068 bool 00069 AGPerson::decide(SUMOReal proba) const throw() { 00070 return (RandHelper::rand(1000) < static_cast<int>(1000.0f * proba)); 00071 } 00072 00073 /****************************************************************************/