Stride Reference Manual  - generated for commit 9643b11
ReaderFactory.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 "CommutesReader.h"
19 #include "HouseholdReader.h"
20 #include "LocationsReader.h"
21 
22 #include <istream>
23 #include <memory>
24 #include <string>
25 
26 #ifdef BOOST_FOUND
27 #include <boost/filesystem.hpp>
28 #include <boost/filesystem/path.hpp>
29 namespace filesys = boost::filesystem;
30 #else
31 #include <filesystem>
32 namespace filesys = std::filesystem;
33 #endif
34 
35 namespace geopop {
36 
43 {
44 public:
46  static std::shared_ptr<LocationsReader> CreateLocationsReader(const std::string &filename);
47 
49  static std::shared_ptr<LocationsReader> CreateLocationsReader(const filesys::path &path);
50 
52  static std::shared_ptr<CommutesReader> CreateCommutesReader(const std::string& filename);
53 
55  static std::shared_ptr<CommutesReader> CreateCommutesReader(const filesys::path& path);
56 
58  static std::shared_ptr<HouseholdReader> CreateHouseholdReader(const std::string& filename);
59 
61  static std::shared_ptr<HouseholdReader> CreateHouseholdReader(const filesys::path& path);
62 
63 private:
65  static std::unique_ptr<std::istream> OpenFile(const filesys::path& path);
66 };
67 
68 } // namespace geopop
static std::shared_ptr< CommutesReader > CreateCommutesReader(const std::string &filename)
Create a CommutesReader based on the filename relative to the data directory.
static std::unique_ptr< std::istream > OpenFile(const filesys::path &path)
Create an istream based on the filesystem path.
static std::shared_ptr< LocationsReader > CreateLocationsReader(const std::string &filename)
Create a Reader based on the filename relative to the data directory.
A Factory for creating the correct implementation of the different Readers which parse the informatio...
Definition: ReaderFactory.h:42
Namespace for the geographic and demograhic classes.
Definition: Coordinate.h:21
static std::shared_ptr< HouseholdReader > CreateHouseholdReader(const std::string &filename)
Create a HouseholdReader based on the filename relative to the data directory.