Eclipse SUMO - Simulation of Urban MObility
AGCar.cpp
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 /****************************************************************************/
20 // Cars owned by people of the city: included in households.
21 /****************************************************************************/
22 
23 
24 // ===========================================================================
25 // included modules
26 // ===========================================================================
27 #include <config.h>
28 
29 #include <iostream>
30 #include <sstream>
31 #include <string>
32 #include "AGCar.h"
33 #include "AGAdult.h"
34 
35 
36 // ===========================================================================
37 // method definitions
38 // ===========================================================================
39 std::string
40 AGCar::createName(int idHH, int idCar) {
41  std::ostringstream os;
42  os << "h" << idHH << "c" << idCar;
43  return os.str();
44 }
45 
46 bool
48  if (currentUser == nullptr) {
49  currentUser = pers;
50  return true;
51  }
52  return false;
53 }
54 
55 bool
57  return (currentUser != nullptr);
58 }
59 
60 std::string
61 AGCar::getName() const {
62  return idName;
63 }
64 
65 /****************************************************************************/
std::string idName
Definition: AGCar.h:52
An adult person who can have a job.
Definition: AGAdult.h:51
bool associateTo(AGAdult *pers)
Definition: AGCar.cpp:47
AGAdult * currentUser
Definition: AGCar.h:53
std::string getName() const
Definition: AGCar.cpp:61
std::string createName(int idHH, int idCar)
Definition: AGCar.cpp:40
bool isAssociated() const
Definition: AGCar.cpp:56