SUMO - Simulation of Urban MObility
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
AGPerson.cpp
Go to the documentation of this file.
1 /****************************************************************************/
9 // Parent object of every person, contains age and any natural characteristic
10 /****************************************************************************/
11 // SUMO, Simulation of Urban MObility; see http://sumo.sourceforge.net/
12 // Copyright (C) 2001-2012 DLR (http://www.dlr.de/) and contributors
13 // activitygen module
14 // Copyright 2010 TUM (Technische Universitaet Muenchen, http://www.tum.de/)
15 /****************************************************************************/
16 //
17 // This file is part of SUMO.
18 // SUMO is free software: you can redistribute it and/or modify
19 // it under the terms of the GNU General Public License as published by
20 // the Free Software Foundation, either version 3 of the License, or
21 // (at your option) any later version.
22 //
23 /****************************************************************************/
24 
25 
26 // ===========================================================================
27 // included modules
28 // ===========================================================================
29 #ifdef _MSC_VER
30 #include <windows_config.h>
31 #else
32 #include <config.h>
33 #endif
34 
35 #include "AGPerson.h"
37 #include <iostream>
38 
39 
40 // ===========================================================================
41 // used namespaces
42 // ===========================================================================
43 using namespace std;
44 
45 
46 // ===========================================================================
47 // method definitions
48 // ===========================================================================
49 AGPerson::AGPerson(int age) : age(age) {}
50 
51 /****************************************************************************/
52 
54 
55 /****************************************************************************/
56 
57 void
58 AGPerson::print() const {
59  cout << "- Person: Age=" << age << endl;
60 }
61 
62 /****************************************************************************/
63 
64 int
66  return age;
67 }
68 
69 /****************************************************************************/
70 
71 bool
72 AGPerson::decide(SUMOReal proba) const {
73  return (RandHelper::rand(1000) < static_cast<int>(1000.0f * proba));
74 }
75 
76 /****************************************************************************/