Stride Reference Manual
- generated for commit 9643b11
|
An implementation of the GeoGridReader using Protocol Buffers. More...
#include <GeoGridProtoReader.h>
Public Member Functions | |
GeoGridProtoReader (std::unique_ptr< std::istream > inputStream, stride::Population *pop) | |
Construct the GeoGridJSONReader with the istream which contains the Protobuf info. More... | |
GeoGridProtoReader (const GeoGridProtoReader &)=delete | |
No copy constructor. More... | |
GeoGridProtoReader | operator= (const GeoGridProtoReader &)=delete |
No copy assignement. More... | |
void | Read () override |
Actually perform the read and return the GeoGrid. More... | |
![]() | |
GeoGridReader (std::unique_ptr< std::istream > inputStream, stride::Population *pop) | |
Parametrized constructor. More... | |
GeoGridReader (const GeoGridReader &)=delete | |
No copy constructor. More... | |
GeoGridReader & | operator= (const GeoGridReader &)=delete |
No copy assignment. More... | |
virtual | ~GeoGridReader ()=default |
Default destructor. More... | |
Private Member Functions | |
void | ParseContactPools (std::shared_ptr< Location > loc, const proto::GeoGrid_Location_ContactPools &protoContactPools) |
Create ContactPools based on protobuf ContactPools info. More... | |
void | ParseContactPool (std::shared_ptr< Location > loc, const proto::GeoGrid_Location_ContactPools_ContactPool &protoContactPool, stride::ContactType::Id typeId) |
Create a ContactPool based on the provided protobuf ContactPool. More... | |
Coordinate | ParseCoordinate (const proto::GeoGrid_Location_Coordinate &protoCoordinate) |
Create a Coordinate based on the provided protobuf Coordinate. More... | |
std::shared_ptr< Location > | ParseLocation (const proto::GeoGrid_Location &protoLocation) |
Create a Location based on protobuf Location info. More... | |
stride::Person * | ParsePerson (const proto::GeoGrid_Person &person) |
Create a Person based on protobuf Person info. More... | |
Additional Inherited Members | |
![]() | |
void | AddCommutes (GeoGrid &geoGrid) |
Add the commutes that were found to their respective Locations symmetrically. More... | |
![]() | |
std::map< unsigned int, stride::Person * > | m_people |
< Store the persons (id->person) that were found while loping over the ContactPools. More... | |
std::vector< std::tuple< unsigned int, unsigned int, double > > | m_commutes |
std::unique_ptr< std::istream > | m_inputStream |
File to read. More... | |
stride::Population * | m_population |
Population to use in the GeoGrid may be nullptr. More... | |
An implementation of the GeoGridReader using Protocol Buffers.
This class is used to read a GeoGrid from a Proto file.
Definition at line 40 of file GeoGridProtoReader.h.
geopop::GeoGridProtoReader::GeoGridProtoReader | ( | std::unique_ptr< std::istream > | inputStream, |
stride::Population * | pop | ||
) |
Construct the GeoGridJSONReader with the istream which contains the Protobuf info.
Definition at line 31 of file GeoGridProtoReader.cpp.
|
delete |
No copy constructor.
|
delete |
No copy assignement.
|
overridevirtual |
Actually perform the read and return the GeoGrid.
Implements geopop::GeoGridReader.
Definition at line 36 of file GeoGridProtoReader.cpp.
References geopop::GeoGridReader::AddCommutes(), proto::GeoGrid::locations(), proto::GeoGrid::locations_size(), geopop::GeoGridReader::m_commutes, geopop::GeoGridReader::m_inputStream, geopop::GeoGridReader::m_people, geopop::GeoGridReader::m_population, ParseLocation(), ParsePerson(), proto::GeoGrid::persons(), proto::GeoGrid::persons_size(), and stride::Population::RefGeoGrid().
|
private |
Create ContactPools based on protobuf ContactPools info.
Definition at line 61 of file GeoGridProtoReader.cpp.
References proto::GeoGrid_Location_ContactPools_Type_College, proto::GeoGrid_Location_ContactPools_Type_Household, proto::GeoGrid_Location_ContactPools_Type_K12School, proto::GeoGrid_Location_ContactPools_Type_PrimaryCommunity, proto::GeoGrid_Location_ContactPools_Type_SecondaryCommunity, proto::GeoGrid_Location_ContactPools_Type_Workplace, ParseContactPool(), proto::GeoGrid_Location_ContactPools::pools(), proto::GeoGrid_Location_ContactPools::pools_size(), and proto::GeoGrid_Location_ContactPools::type().
Referenced by ParseLocation().
|
private |
Create a ContactPool based on the provided protobuf ContactPool.
Definition at line 87 of file GeoGridProtoReader.cpp.
References stride::ContactPoolSys::CreateContactPool(), geopop::GeoGridReader::m_people, geopop::GeoGridReader::m_population, proto::GeoGrid_Location_ContactPools_ContactPool::people(), proto::GeoGrid_Location_ContactPools_ContactPool::people_size(), and stride::Population::RefPoolSys().
Referenced by ParseContactPools().
|
private |
Create a Coordinate based on the provided protobuf Coordinate.
Definition at line 82 of file GeoGridProtoReader.cpp.
References proto::GeoGrid_Location_Coordinate::latitude(), and proto::GeoGrid_Location_Coordinate::longitude().
Referenced by ParseLocation().
|
private |
Create a Location based on protobuf Location info.
Definition at line 104 of file GeoGridProtoReader.cpp.
References proto::GeoGrid_Location::commutes(), proto::GeoGrid_Location::commutes_size(), proto::GeoGrid_Location::contactpools(), proto::GeoGrid_Location::contactpools_size(), proto::GeoGrid_Location::coordinate(), proto::GeoGrid_Location::id(), geopop::GeoGridReader::m_commutes, proto::GeoGrid_Location::name(), ParseContactPools(), ParseCoordinate(), proto::GeoGrid_Location::population(), proto::GeoGrid_Location_Commute::proportion(), proto::GeoGrid_Location::province(), and proto::GeoGrid_Location_Commute::to().
Referenced by Read().
|
private |
Create a Person based on protobuf Person info.
Definition at line 127 of file GeoGridProtoReader.cpp.
References proto::GeoGrid_Person::age(), stride::Population::CreatePerson(), proto::GeoGrid_Person::id(), and geopop::GeoGridReader::m_population.
Referenced by Read().