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