Stride Reference Manual  - generated for commit 9643b11
GeoGridJSONReader.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 "GeoGridReader.h"
19 #include "contact/ContactPool.h"
20 #include "contact/ContactType.h"
21 #include "geopop/Location.h"
22 
23 #include <boost/property_tree/ptree_fwd.hpp>
24 
25 namespace geopop {
26 
27 class GeoGrid;
28 
34 {
35 public:
37  GeoGridJSONReader(std::unique_ptr<std::istream> inputStream, stride::Population* pop);
38 
40  GeoGridJSONReader(const GeoGridJSONReader&) = delete;
41 
44 
46  void Read() override;
47 
48 private:
50  std::shared_ptr<ContactCenter> ParseContactCenter(boost::property_tree::ptree& contactCenter);
51 
53  stride::ContactPool* ParseContactPool(boost::property_tree::ptree& contactPool, stride::ContactType::Id typeId);
54 
56  Coordinate ParseCoordinate(boost::property_tree::ptree& coordinate);
57 
59  std::shared_ptr<Location> ParseLocation(boost::property_tree::ptree& location);
60 
62  stride::Person* ParsePerson(boost::property_tree::ptree& person);
63 };
64 
65 } // namespace geopop
void Read() override
Actually perform the read and return the GeoGrid.
std::shared_ptr< ContactCenter > ParseContactCenter(boost::property_tree::ptree &contactCenter)
Create a ContactCenter based on the information stored in the provided boost property tree...
Id
Enumerates the ContactPool types.
Definition: ContactType.h:34
A group of Persons that potentially have contacts with one another.
Definition: ContactPool.h:38
Header for the core ContactPool class.
GeoGridJSONReader operator=(const GeoGridJSONReader &)=delete
No copy assignement.
Key Data structure: container for (a) all individuals in the population (b) the ContactPoolSys wchich...
Definition: Population.h:47
Definition of ContactPool Id Type.
Coordinate ParseCoordinate(boost::property_tree::ptree &coordinate)
Create a Coordinate based on the information stored in the provided boost property tree...
Namespace for the geographic and demograhic classes.
Definition: Coordinate.h:21
An abstract base class for creating a GeoGrid that was read from a file, can be implemented using mul...
Definition: GeoGridReader.h:37
boost::geometry::model::point< double, 2, boost::geometry::cs::geographic< boost::geometry::degree >> Coordinate
Definition: Coordinate.h:23
GeoGridJSONReader(std::unique_ptr< std::istream > inputStream, stride::Population *pop)
Construct the GeoGridJSONReader with the istream which contains the JSON.
std::shared_ptr< Location > ParseLocation(boost::property_tree::ptree &location)
Create a Location based on the information stored in the provided boost property tree.
Store and handle person data.
Definition: Person.h:34
An implementation of the GeoGridReader using JSON.
stride::Person * ParsePerson(boost::property_tree::ptree &person)
Create a Person based on the information stored in the provided boost property tree.
stride::ContactPool * ParseContactPool(boost::property_tree::ptree &contactPool, stride::ContactType::Id typeId)
Create a ContactCenter based on the information stored in the provided boost property tree...