Book a Demo!
CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutPoliciesSign UpSign In
eclipse
GitHub Repository: eclipse/sumo
Path: blob/main/src/activitygen/city/AGPerson.cpp
169678 views
1
/****************************************************************************/
2
// Eclipse SUMO, Simulation of Urban MObility; see https://eclipse.dev/sumo
3
// Copyright (C) 2010-2025 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 are made available under the
7
// terms of the Eclipse Public License 2.0 which is available at
8
// https://www.eclipse.org/legal/epl-2.0/
9
// This Source Code may also be made available under the following Secondary
10
// Licenses when the conditions for such availability set forth in the Eclipse
11
// Public License 2.0 are satisfied: GNU General Public License, version 2
12
// or later which is available at
13
// https://www.gnu.org/licenses/old-licenses/gpl-2.0-standalone.html
14
// SPDX-License-Identifier: EPL-2.0 OR GPL-2.0-or-later
15
/****************************************************************************/
16
/// @file AGPerson.cpp
17
/// @author Piotr Woznica
18
/// @author Walter Bamberger
19
/// @author Daniel Krajzewicz
20
/// @author Michael Behrisch
21
/// @date July 2010
22
///
23
// Parent object of every person, contains age and any natural characteristic
24
/****************************************************************************/
25
#include <config.h>
26
27
#include "AGPerson.h"
28
#include <utils/common/RandHelper.h>
29
#include <iostream>
30
31
32
// ===========================================================================
33
// method definitions
34
// ===========================================================================
35
AGPerson::AGPerson(int age) : age(age) {}
36
37
38
AGPerson::~AGPerson() {}
39
40
41
void
42
AGPerson::print() const {
43
std::cout << "- Person: Age=" << age << std::endl;
44
}
45
46
47
int
48
AGPerson::getAge() const {
49
return age;
50
}
51
52
53
bool
54
AGPerson::decide(double proba) const {
55
return (RandHelper::rand(1000) < static_cast<int>(1000.0f * proba));
56
}
57
58
59
/****************************************************************************/
60
61