Stride Reference Manual  - generated for commit 9643b11
geopop::GeoGridProtoReader Class Reference

An implementation of the GeoGridReader using Protocol Buffers. More...

#include <GeoGridProtoReader.h>

Inheritance diagram for geopop::GeoGridProtoReader:
Inheritance graph
Collaboration diagram for geopop::GeoGridProtoReader:
Collaboration graph

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...
 
- Public Member Functions inherited from geopop::GeoGridReader
 GeoGridReader (std::unique_ptr< std::istream > inputStream, stride::Population *pop)
 Parametrized constructor. More...
 
 GeoGridReader (const GeoGridReader &)=delete
 No copy constructor. More...
 
GeoGridReaderoperator= (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< LocationParseLocation (const proto::GeoGrid_Location &protoLocation)
 Create a Location based on protobuf Location info. More...
 
stride::PersonParsePerson (const proto::GeoGrid_Person &person)
 Create a Person based on protobuf Person info. More...
 

Additional Inherited Members

- Protected Member Functions inherited from geopop::GeoGridReader
void AddCommutes (GeoGrid &geoGrid)
 Add the commutes that were found to their respective Locations symmetrically. More...
 
- Protected Attributes inherited from geopop::GeoGridReader
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::Populationm_population
 Population to use in the GeoGrid may be nullptr. More...
 

Detailed Description

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.

Constructor & Destructor Documentation

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.

geopop::GeoGridProtoReader::GeoGridProtoReader ( const GeoGridProtoReader )
delete

No copy constructor.

Member Function Documentation

GeoGridProtoReader geopop::GeoGridProtoReader::operator= ( const GeoGridProtoReader )
delete

No copy assignement.

void geopop::GeoGridProtoReader::ParseContactPool ( std::shared_ptr< Location loc,
const proto::GeoGrid_Location_ContactPools_ContactPool protoContactPool,
stride::ContactType::Id  typeId 
)
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().

Here is the call graph for this function:

Here is the caller graph for this function:

Coordinate geopop::GeoGridProtoReader::ParseCoordinate ( const proto::GeoGrid_Location_Coordinate protoCoordinate)
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().

Here is the call graph for this function:

Here is the caller graph for this function:

stride::Person * geopop::GeoGridProtoReader::ParsePerson ( const proto::GeoGrid_Person person)
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().

Here is the call graph for this function:

Here is the caller graph for this function:


The documentation for this class was generated from the following files: