Stride Reference Manual  - generated for commit 9643b11
GeoGridProtoWriter.h
Go to the documentation of this file.
1 /*
2  * This is free software: you can redistribute it and/or modify it
3  * under the terms of the GNU General Public License as published by
4  * the Free Software Foundation, either version 3 of the License, or
5  * any later version.
6  * The software is distributed in the hope that it will be useful,
7  * but WITHOUT ANY WARRANTY; without even the implied warranty of
8  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
9  * GNU General Public License for more details.
10  * You should have received a copy of the GNU General Public License
11  * along with the software. If not, see <http://www.gnu.org/licenses/>.
12  *
13  * Copyright 2018, Jan Broeckhove and Bistromatics group.
14  */
15 
16 #pragma once
17 
18 #include "GeoGridWriter.h"
19 #include "geopop/Location.h"
20 
21 #include <set>
22 
23 namespace stride {
24 class ContactPool;
25 class Person;
26 } // namespace stride
27 
28 namespace proto {
29 class GeoGrid_Location;
30 class GeoGrid_Location_Coordinate;
31 class GeoGrid_Location_ContactPools;
32 class GeoGrid_Location_ContactPools_ContactPool;
33 class GeoGrid_Person;
34 } // namespace proto
35 
36 namespace geopop {
37 
43 {
44 public:
47 
49  void Write(GeoGrid& geoGrid, std::ostream& stream) override;
50 
51 private:
53  void WriteContactPools(stride::ContactType::Id typeId,
55  proto::GeoGrid_Location_ContactPools* protoContactPools);
56 
58  void WriteContactPool(stride::ContactPool* contactPool,
60 
62  void WriteCoordinate(const Coordinate& coordinate, proto::GeoGrid_Location_Coordinate* protoCoordinate);
63 
65  void WriteLocation(Location& location, proto::GeoGrid_Location* protoLocation);
66 
68  void WritePerson(stride::Person* person, proto::GeoGrid_Person* protoPerson);
69 
70 private:
71  std::set<stride::Person*> m_persons_found;
72 };
73 
74 } // namespace geopop
An interface for writing the GeoGrid to a file, can be implemented with multiple file types...
Definition: GeoGridWriter.h:29
Id
Enumerates the ContactPool types.
Definition: ContactType.h:34
A group of Persons that potentially have contacts with one another.
Definition: ContactPool.h:38
A Geographic grid of simulation region contains Locations that in turn contain an index to the Contac...
Definition: GeoGrid.h:41
Container that stores objects "almost contiguously" (in a chain of blocks) and guarantees that pointe...
Namespace for the geographic and demograhic classes.
Definition: Coordinate.h:21
boost::geometry::model::point< double, 2, boost::geometry::cs::geographic< boost::geometry::degree >> Coordinate
Definition: Coordinate.h:23
std::set< stride::Person * > m_persons_found
The persons found when looping over the ContactPools.
Location for use within the GeoGrid, contains Coordinate and index to ContactPools.
Definition: Location.h:41
Store and handle person data.
Definition: Person.h:34
Namespace for the simulator and related classes.
Definition: Calendar.cpp:28
An implementation of the GeoGridWriter using Protocol Buffers This class is used to write a GeoGrid t...