LCOV - code coverage report
Current view: top level - src/activitygen/city - AGHousehold.h (source / functions) Hit Total Coverage
Test: lcov.info Lines: 4 4 100.0 %
Date: 2024-05-05 15:31:14 Functions: 0 0 -

          Line data    Source code
       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             : /****************************************************************************/
      16             : /// @file    AGHousehold.h
      17             : /// @author  Piotr Woznica
      18             : /// @author  Daniel Krajzewicz
      19             : /// @author  Walter Bamberger
      20             : /// @author  Michael Behrisch
      21             : /// @date    July 2010
      22             : ///
      23             : // A household contains the people and cars of the city: roughly represents
      24             : // families with their address, cars, adults and possibly children
      25             : /****************************************************************************/
      26             : #pragma once
      27             : #include <config.h>
      28             : 
      29             : #include <iostream>
      30             : #include <list>
      31             : #include "AGPerson.h"
      32             : #include "AGAdult.h"
      33             : #include "AGChild.h"
      34             : #include "AGCar.h"
      35             : #include "AGStreet.h"
      36             : #include "AGPosition.h"
      37             : #include "AGCity.h"
      38             : 
      39             : 
      40             : // ===========================================================================
      41             : // class declarations
      42             : // ===========================================================================
      43             : class AGCity;
      44             : 
      45             : 
      46             : // ===========================================================================
      47             : // class definitions
      48             : // ===========================================================================
      49             : class AGHousehold {
      50             : public:
      51             :     AGHousehold(AGPosition pos, AGCity* city, int idHouseholds) :
      52             :         myCity(city),
      53             :         myLocation(pos),
      54             :         myId(idHouseholds) {};
      55        2005 :     AGHousehold(AGStreet* str, AGCity* city, int idHouseholds) :
      56        2005 :         myCity(city),
      57        2005 :         myLocation(*str),
      58        2005 :         myId(idHouseholds) {};
      59             :     /**
      60             :      * function generating the given number of adults (1 or 2) and possibly children
      61             :      */
      62             :     void generatePeople(int numAdults, int numChilds, bool firstRetired);
      63             :     int getPeopleNbr();
      64             :     int getAdultNbr();
      65             :     const std::list<AGAdult>& getAdults() const;
      66             :     const std::list<AGChild>& getChildren() const;
      67             :     const std::list<AGCar>& getCars() const;
      68             :     /**
      69             :      * function returning true if the household is close to the given stations stations
      70             :      */
      71             :     bool isCloseFromPubTransport(std::list<AGPosition>* pubTransport);
      72             :     bool isCloseFromPubTransport(std::map<int, AGPosition>* pubTransport);
      73             :     /**
      74             :      * function regenerating the household:
      75             :      * --> work positions and schools are resigned
      76             :      * --> cars and people are deleted
      77             :      * --> number of people are MAINTAINED
      78             :      * --> work positions, schools and cars are reallocated
      79             :      */
      80             :     void regenerate();
      81             :     /**
      82             :      * associates a school to each children.
      83             :      * return false if not done (not enough place at school in the city...
      84             :      */
      85             :     bool allocateChildrenSchool();
      86             :     /**
      87             :      * associates a work position to every working adult
      88             :      * is taken in account the unemployment and the number of work positions
      89             :      */
      90             :     bool allocateAdultsWork();
      91             :     /**
      92             :      * function allocating cars to this household in relation to the given rate for each adult
      93             :      */
      94             :     void generateCars(double rate);
      95             :     int getCarNbr();
      96             :     /**
      97             :      * generates one (more) car in this household
      98             :      */
      99             :     void addACar();
     100             :     /**
     101             :      * returns the city pointer in which the household is.
     102             :      */
     103             :     AGCity* getTheCity();
     104             :     /**
     105             :      * returns if adults are retired or in working age
     106             :      */
     107             :     bool retiredHouseholders();
     108             :     /**
     109             :      * returns the position of the household and other private entities
     110             :      */
     111             :     AGPosition getPosition();
     112             : 
     113             : private:
     114             :     AGCity* myCity;
     115             :     AGPosition myLocation;
     116             :     int myId;
     117             : 
     118             : private:
     119             :     std::list<AGAdult> myAdults;
     120             :     std::list<AGChild> myChildren;
     121             :     std::list<AGCar> myCars;
     122             : };

Generated by: LCOV version 1.14