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.org/sumo
3 // Copyright (C) 2010-2018 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 /****************************************************************************/
20 // Person in working age: can be linked to a work position.
21 /****************************************************************************/
22 #ifndef AGADULT_H
23 #define AGADULT_H
24 
25 
26 // ===========================================================================
27 // included modules
28 // ===========================================================================
29 #include <config.h>
30 
31 #include <vector>
32 #include <stdexcept>
33 #include "AGPerson.h"
34 
35 
36 // ===========================================================================
37 // class declarations
38 // ===========================================================================
39 class AGWorkPosition;
40 
41 
42 // ===========================================================================
43 // class definitions
44 // ===========================================================================
51 class AGAdult : public AGPerson {
52 public:
57  AGAdult(int age);
58 
61  void print() const;
62 
67  bool isWorking() const;
68 
81  void tryToWork(double employmentRate, std::vector<AGWorkPosition>* wps);
82 
89  void lostWorkPosition();
90 
97 
106  const AGWorkPosition& getWorkPosition() const;
107 
108 private:
114 
120  static AGWorkPosition* randomFreeWorkPosition(std::vector<AGWorkPosition>* wps);
121 };
122 
123 #endif /* AGADULT_H */
124 
125 /****************************************************************************/
const AGWorkPosition & getWorkPosition() const
Provides the work position of the adult.
Definition: AGAdult.cpp:105
bool isWorking() const
States whether this person occupies a work position at present.
Definition: AGAdult.cpp:85
AGWorkPosition * work
Definition: AGAdult.h:113
An adult person who can have a job.
Definition: AGAdult.h:51
void resignFromWorkPosition()
Called when the adult should resign her job.
Definition: AGAdult.cpp:97
static AGWorkPosition * randomFreeWorkPosition(std::vector< AGWorkPosition > *wps)
Randomly selects a free work position from the list.
Definition: AGAdult.cpp:39
void lostWorkPosition()
Called when the adult has lost her job.
Definition: AGAdult.cpp:91
void tryToWork(double employmentRate, std::vector< AGWorkPosition > *wps)
Tries to get a new work position.
Definition: AGAdult.cpp:64
AGAdult(int age)
Initialises the base class and the own attributes.
Definition: AGAdult.cpp:53
void print() const
Puts out a summary of the attributes.
Definition: AGAdult.cpp:58
int age
Definition: AGPerson.h:65
Base class of every person in the city (adults and children)
Definition: AGPerson.h:42