Stride Reference Manual  - generated for commit 9643b11
GeoGridJSONWriter.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 <boost/property_tree/ptree.hpp>
22 #include <set>
23 
24 namespace stride {
25 class ContactPool;
26 class Person;
27 } // namespace stride
28 
29 namespace geopop {
30 
31 class ContactCenter;
32 
37 {
38 public:
41 
43  void Write(GeoGrid& geoGrid, std::ostream& stream) override;
44 
45 private:
47  boost::property_tree::ptree WriteContactCenter(std::shared_ptr<ContactCenter> contactCenter);
48 
50  boost::property_tree::ptree WriteContactPool(stride::ContactPool* contactPool);
51 
53  boost::property_tree::ptree WriteCoordinate(const Coordinate& coordinate);
54 
56  boost::property_tree::ptree WriteLocation(const Location& location);
57 
59  boost::property_tree::ptree WritePerson(stride::Person* person);
60 
61 private:
62  std::set<stride::Person*> m_persons_found;
63 };
64 
65 } // namespace geopop
An interface for writing the GeoGrid to a file, can be implemented with multiple file types...
Definition: GeoGridWriter.h:29
boost::property_tree::ptree WriteLocation(const Location &location)
Create a Boost Property Tree containing all info needed to reconstruct a Location.
A group of Persons that potentially have contacts with one another.
Definition: ContactPool.h:38
std::set< stride::Person * > m_persons_found
The persons found when looping over the ContactPools.
boost::property_tree::ptree WritePerson(stride::Person *person)
Create a Boost Property Tree containing all info needed to reconstruct a Person.
boost::property_tree::ptree WriteContactCenter(std::shared_ptr< ContactCenter > contactCenter)
Create a Boost Property Tree containing all info needed to reconstruct a ContactCenter.
A Geographic grid of simulation region contains Locations that in turn contain an index to the Contac...
Definition: GeoGrid.h:41
Writes a GeoGrid to a JSON file.
boost::property_tree::ptree WriteCoordinate(const Coordinate &coordinate)
Create a Boost Property Tree containing all info needed to reconstruct a Coordinate.
Namespace for the geographic and demograhic classes.
Definition: Coordinate.h:21
void Write(GeoGrid &geoGrid, std::ostream &stream) override
Write the provided GeoGrid to the proved ostream in JSON format.
boost::geometry::model::point< double, 2, boost::geometry::cs::geographic< boost::geometry::degree >> Coordinate
Definition: Coordinate.h:23
boost::property_tree::ptree WriteContactPool(stride::ContactPool *contactPool)
Create a Boost Property Tree containing all info needed to reconstruct a ContactPool.
GeoGridJSONWriter()
Construct the GeoGridJSONWriter.
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