/****************************************************************************/1// Eclipse SUMO, Simulation of Urban MObility; see https://eclipse.dev/sumo2// Copyright (C) 2010-2025 German Aerospace Center (DLR) and others.3// activitygen module4// Copyright 2010 TUM (Technische Universitaet Muenchen, http://www.tum.de/)5// This program and the accompanying materials are made available under the6// terms of the Eclipse Public License 2.0 which is available at7// https://www.eclipse.org/legal/epl-2.0/8// This Source Code may also be made available under the following Secondary9// Licenses when the conditions for such availability set forth in the Eclipse10// Public License 2.0 are satisfied: GNU General Public License, version 211// or later which is available at12// https://www.gnu.org/licenses/old-licenses/gpl-2.0-standalone.html13// SPDX-License-Identifier: EPL-2.0 OR GPL-2.0-or-later14/****************************************************************************/15/// @file AGAdult.h16/// @author Piotr Woznica17/// @author Walter Bamberger18/// @author Daniel Krajzewicz19/// @author Michael Behrisch20/// @date July 201021///22// Person in working age: can be linked to a work position.23/****************************************************************************/24#pragma once25#include <config.h>2627#include <vector>28#include <stdexcept>29#include "AGPerson.h"303132// ===========================================================================33// class declarations34// ===========================================================================35class AGWorkPosition;363738// ===========================================================================39// class definitions40// ===========================================================================41/**42* @class AGAdult43* @brief An adult person who can have a job.44*45* AGAdult extends AGPerson by various methods to handle work life.46*/47class AGAdult : public AGPerson {48public:49/** @brief Initialises the base class and the own attributes.50*51* @param[in] the age of the AGPerson52*/53AGAdult(int age);5455/** @brief Puts out a summary of the attributes.56*/57void print() const;5859/** @brief States whether this person occupies a work position at present.60*61* @return true if she has a work position62*/63bool isWorking() const;6465/** @brief Tries to get a new work position.66*67* Depending on the employment rate, this adult randomly gets unemployed68* or employed. If it gets employed, it randomly chooses one of the free69* work positions and occupies it.70*71* The new state (employed or unemployed) is chosen independently from the72* previous state. If the adult was employed, her previous job is given up.73*74* @param[in]: employmentRate (1 - unemploymentRate)75* @param[in]: wps the list of work positions (open or not) in the city76*/77void tryToWork(double employmentRate, std::vector<AGWorkPosition>* wps);7879/** @brief Called when the adult has lost her job.80*81* This method is called from AGWorkPosition, whenever the adult lost82* her job, be it because it got fired or because its resignation has83* been accepted.84*/85void lostWorkPosition();8687/** @brief Called when the adult should resign her job.88*89* This method asks the WorkPosition to quit the job. The WorkPosition in90* turn calls AGAdult::lostWorkPosition.91*/92void resignFromWorkPosition();9394/** @brief Provides the work position of the adult.95*96* You should test before, whether the adult has a job. If you call this97* method and the adult has no job, then a ProcessError is thrown.98*99* @return the work position100* @throw ProcessError the adult has no work position101*/102const AGWorkPosition& getWorkPosition() const;103104private:105/** The work position of this adult.106*107* A pointer to the work position or 0 if the adult is unemployed at present.108*/109AGWorkPosition* work;110111/** @brief Randomly selects a free work position from the list.112*113* @param[in] the list of work positions (free or not)114* @return the chosen free work position115*/116static AGWorkPosition* randomFreeWorkPosition(std::vector<AGWorkPosition>* wps);117};118119120