Stride Reference Manual  1.0
Traveller.h
Go to the documentation of this file.
1 #pragma once
2 
3 #include "Person.h"
4 #include <iostream>
5 
6 using namespace std;
7 
8 namespace stride {
9 
10 // Perhaps a solution based on inheritance would have 'looked' nicer
11 // However, since people 'become' travellers at random, that would have
12 // been very difficult to achieve (and either hacky or inefficient, too)
13 
14 template<class PersonType>
15 class Traveller {
16 public:
17  using uint = unsigned int;
18 
19  Traveller(const PersonType& home_person, PersonType* new_person, const string& home_sim_id,
20  const string& destination_sim_id, uint home_simulator_index)
21  : m_home_simulator_id(home_sim_id), m_destination_simulator_id(destination_sim_id),
22  m_home_simulator_index(home_simulator_index),
23  m_home_person(home_person), m_new_person(new_person) {}
24 
25  Traveller(const Traveller& other_traveller)
26  : m_home_simulator_id(other_traveller.m_home_simulator_id),
27  m_destination_simulator_id(other_traveller.m_destination_simulator_id),
28  m_home_simulator_index(other_traveller.m_home_simulator_index),
29  m_home_person(other_traveller.m_home_person), m_new_person(other_traveller.m_new_person) {}
30 
31  const PersonType& getHomePerson() const {
32  return m_home_person;
33  }
34 
35  PersonType* getNewPerson() const {
36  return m_new_person;
37  }
38 
39  string getHomeSimulatorId() const {
40  return m_home_simulator_id;
41  }
42 
44  return m_home_simulator_index;
45  }
46 
47  string getDestinationSimulatorId() const {
48  return m_destination_simulator_id;
49  }
50 
51 private:
55 
56  PersonType m_home_person;
57  PersonType* m_new_person;
58 };
59 
60 }
PersonType * getNewPerson() const
Definition: Traveller.h:35
Time Dependent Person DataType.
Definition: NoBehaviour.h:17
string m_home_simulator_id
The id of the home simulator.
Definition: Traveller.h:52
PersonType m_home_person
The person in the region of origin.
Definition: Traveller.h:56
Header file for the Person class.
const PersonType & getHomePerson() const
Definition: Traveller.h:31
unsigned int uint
Definition: Traveller.h:17
string getHomeSimulatorId() const
Definition: Traveller.h:39
string getDestinationSimulatorId() const
Definition: Traveller.h:47
STL namespace.
uint getHomeSimulatorIndex() const
Definition: Traveller.h:43
Traveller(const Traveller &other_traveller)
Definition: Traveller.h:25
Traveller(const PersonType &home_person, PersonType *new_person, const string &home_sim_id, const string &destination_sim_id, uint home_simulator_index)
Definition: Traveller.h:19
string m_destination_simulator_id
The id of the destination simulator.
Definition: Traveller.h:53
uint m_home_simulator_index
The index of the person in the home simulator.
Definition: Traveller.h:54
PersonType * m_new_person
The person when he travelled to the other region.
Definition: Traveller.h:57