Eclipse SUMO - Simulation of Urban MObility
AGPerson.cpp
Go to the documentation of this file.
1
/****************************************************************************/
2
// Eclipse SUMO, Simulation of Urban MObility; see https://eclipse.org/sumo
3
// Copyright (C) 2010-2019 German Aerospace Center (DLR) and others.
4
// activitygen module
5
// Copyright 2010 TUM (Technische Universitaet Muenchen, http://www.tum.de/)
6
// This program and the accompanying materials
7
// are made available under the terms of the Eclipse Public License v2.0
8
// which accompanies this distribution, and is available at
9
// http://www.eclipse.org/legal/epl-v20.html
10
// SPDX-License-Identifier: EPL-2.0
11
/****************************************************************************/
19
// Parent object of every person, contains age and any natural characteristic
20
/****************************************************************************/
21
22
23
// ===========================================================================
24
// included modules
25
// ===========================================================================
26
#include <
config.h
>
27
28
#include "
AGPerson.h
"
29
#include <
utils/common/RandHelper.h
>
30
#include <iostream>
31
32
33
// ===========================================================================
34
// method definitions
35
// ===========================================================================
36
AGPerson::AGPerson
(
int
age) : age(age) {}
37
38
39
AGPerson::~AGPerson
() {}
40
41
42
void
43
AGPerson::print
()
const
{
44
std::cout <<
"- Person: Age="
<<
age
<< std::endl;
45
}
46
47
48
int
49
AGPerson::getAge
()
const
{
50
return
age
;
51
}
52
53
54
bool
55
AGPerson::decide
(
double
proba)
const
{
56
return
(
RandHelper::rand
(1000) <
static_cast<
int
>
(1000.0f * proba));
57
}
58
59
/****************************************************************************/
AGPerson::~AGPerson
virtual ~AGPerson()
Cleans up everything.
Definition:
AGPerson.cpp:39
AGPerson.h
AGPerson::print
virtual void print() const
Puts out a summary of the class properties.
Definition:
AGPerson.cpp:43
AGPerson::decide
virtual bool decide(double probability) const
Lets the person make a decision.
Definition:
AGPerson.cpp:55
RandHelper::rand
static double rand(std::mt19937 *rng=0)
Returns a random real number in [0, 1)
Definition:
RandHelper.h:53
AGPerson::AGPerson
AGPerson(int age)
Initialises the class attributes.
Definition:
AGPerson.cpp:36
AGPerson::age
int age
Definition:
AGPerson.h:64
config.h
RandHelper.h
AGPerson::getAge
virtual int getAge() const
Provides the age of the person.
Definition:
AGPerson.cpp:49
src
activitygen
city
AGPerson.cpp
Generated on Sun Dec 13 2020 08:44:58 for Eclipse SUMO - Simulation of Urban MObility by
1.8.20