Eclipse SUMO - Simulation of Urban MObility
AGAdult.h
Go to the documentation of this file.
1 /****************************************************************************/
2 // Eclipse SUMO, Simulation of Urban MObility; see https://eclipse.dev/sumo
3 // Copyright (C) 2010-2024 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 /****************************************************************************/
23 // Person in working age: can be linked to a work position.
24 /****************************************************************************/
25 #pragma once
26 #include <config.h>
27 
28 #include <vector>
29 #include <stdexcept>
30 #include "AGPerson.h"
31 
32 
33 // ===========================================================================
34 // class declarations
35 // ===========================================================================
36 class AGWorkPosition;
37 
38 
39 // ===========================================================================
40 // class definitions
41 // ===========================================================================
48 class AGAdult : public AGPerson {
49 public:
54  AGAdult(int age);
55 
58  void print() const;
59 
64  bool isWorking() const;
65 
78  void tryToWork(double employmentRate, std::vector<AGWorkPosition>* wps);
79 
86  void lostWorkPosition();
87 
94 
103  const AGWorkPosition& getWorkPosition() const;
104 
105 private:
111 
117  static AGWorkPosition* randomFreeWorkPosition(std::vector<AGWorkPosition>* wps);
118 };
An adult person who can have a job.
Definition: AGAdult.h:48
void print() const
Puts out a summary of the attributes.
Definition: AGAdult.cpp:57
void tryToWork(double employmentRate, std::vector< AGWorkPosition > *wps)
Tries to get a new work position.
Definition: AGAdult.cpp:63
bool isWorking() const
States whether this person occupies a work position at present.
Definition: AGAdult.cpp:86
AGAdult(int age)
Initialises the base class and the own attributes.
Definition: AGAdult.cpp:52
static AGWorkPosition * randomFreeWorkPosition(std::vector< AGWorkPosition > *wps)
Randomly selects a free work position from the list.
Definition: AGAdult.cpp:38
const AGWorkPosition & getWorkPosition() const
Provides the work position of the adult.
Definition: AGAdult.cpp:106
void lostWorkPosition()
Called when the adult has lost her job.
Definition: AGAdult.cpp:92
AGWorkPosition * work
Definition: AGAdult.h:110
void resignFromWorkPosition()
Called when the adult should resign her job.
Definition: AGAdult.cpp:98
Base class of every person in the city (adults and children)
Definition: AGPerson.h:39
int age
Definition: AGPerson.h:62