diff --git a/agent_based_epidemic_sim/applications/home_work/observer_test.cc b/agent_based_epidemic_sim/applications/home_work/observer_test.cc index e9357de..fc37ebc 100644 --- a/agent_based_epidemic_sim/applications/home_work/observer_test.cc +++ b/agent_based_epidemic_sim/applications/home_work/observer_test.cc @@ -54,7 +54,7 @@ const char* kExpectedHeaders = "work_16h,contact_1,contact_2,contact_4,contact_8,contact_16," "contact_32,contact_64,contact_128,contact_256,contact_512\n"; -std::unique_ptr MakeAgent(int64 uuid, HealthState::State state) { +std::unique_ptr MakeAgent(int64_t uuid, HealthState::State state) { auto agent = absl::make_unique(); EXPECT_CALL(*agent, uuid()) .Times(testing::AnyNumber()) @@ -65,7 +65,7 @@ std::unique_ptr MakeAgent(int64 uuid, HealthState::State state) { return agent; } -std::unique_ptr MakeLocation(int64 uuid) { +std::unique_ptr MakeLocation(int64_t uuid) { auto location = absl::make_unique(); EXPECT_CALL(*location, uuid()) .Times(testing::AnyNumber()) @@ -86,7 +86,7 @@ TEST(HomeWorkSimulationObserverTest, ZerosReturnedForNoObservations) { { HomeWorkSimulationObserverFactory observer_factory( file.get(), - [](int64 uuid) { + [](int64_t uuid) { return uuid == 0 ? LocationReference::HOUSEHOLD : LocationReference::BUSINESS; }, @@ -118,7 +118,7 @@ TEST(HomeWorkSimulationObserverTest, PassthroughFields) { { HomeWorkSimulationObserverFactory observer_factory( file.get(), - [](int64 uuid) { + [](int64_t uuid) { return uuid == 0 ? LocationReference::HOUSEHOLD : LocationReference::BUSINESS; }, @@ -148,7 +148,7 @@ TEST(HomeWorkSimulationObserverTest, CorrectValuesForObservations) { { HomeWorkSimulationObserverFactory observer_factory( file.get(), - [](int64 uuid) { + [](int64_t uuid) { return uuid == 0 ? LocationReference::HOUSEHOLD : LocationReference::BUSINESS; }, @@ -162,8 +162,8 @@ TEST(HomeWorkSimulationObserverTest, CorrectValuesForObservations) { auto work = MakeLocation(1); std::vector home_visits, work_visits; - for (int64 i = 0; i < 4; ++i) { - int64 uuid = i; + for (int64_t i = 0; i < 4; ++i) { + int64_t uuid = i; home_visits.push_back({ .location_uuid = 0, .agent_uuid = uuid, @@ -188,8 +188,8 @@ TEST(HomeWorkSimulationObserverTest, CorrectValuesForObservations) { observers[0]->Observe(*MakeAgent(uuid, HealthState::SUSCEPTIBLE), outcomes); } - for (int64 i = 0; i < 3; ++i) { - int64 uuid = 4 + i; + for (int64_t i = 0; i < 3; ++i) { + int64_t uuid = 4 + i; home_visits.push_back({ .location_uuid = 0, .agent_uuid = uuid, @@ -213,8 +213,8 @@ TEST(HomeWorkSimulationObserverTest, CorrectValuesForObservations) { } observers[0]->Observe(*MakeAgent(uuid, HealthState::EXPOSED), outcomes); } - for (int64 i = 0; i < 2; ++i) { - int64 uuid = 7 + i; + for (int64_t i = 0; i < 2; ++i) { + int64_t uuid = 7 + i; home_visits.push_back({ .location_uuid = 0, .agent_uuid = uuid, diff --git a/agent_based_epidemic_sim/applications/home_work/risk_score.cc b/agent_based_epidemic_sim/applications/home_work/risk_score.cc index 4459635..5717b5a 100644 --- a/agent_based_epidemic_sim/applications/home_work/risk_score.cc +++ b/agent_based_epidemic_sim/applications/home_work/risk_score.cc @@ -45,8 +45,8 @@ class TogglingRiskScore : public RiskScore { void AddExposureNotification(const Exposure& exposure, const ContactReport& notification) override {} - VisitAdjustment GetVisitAdjustment(const Timestep& timestep, - const int64 location_uuid) const override { + VisitAdjustment GetVisitAdjustment( + const Timestep& timestep, const int64_t location_uuid) const override { return { .frequency_adjustment = SkipVisit(timestep, location_uuid) ? 0.0f : 1.0f, @@ -76,7 +76,7 @@ class TogglingRiskScore : public RiskScore { void RequestTest(absl::Time time) override {} private: - bool SkipVisit(const Timestep& timestep, const int64 location_uuid) const { + bool SkipVisit(const Timestep& timestep, const int64_t location_uuid) const { if (location_type_(location_uuid) != LocationReference::BUSINESS) { return false; } diff --git a/agent_based_epidemic_sim/applications/home_work/risk_score_test.cc b/agent_based_epidemic_sim/applications/home_work/risk_score_test.cc index f9233c0..995f17a 100644 --- a/agent_based_epidemic_sim/applications/home_work/risk_score_test.cc +++ b/agent_based_epidemic_sim/applications/home_work/risk_score_test.cc @@ -33,7 +33,7 @@ absl::Time TestDay(int day) { std::vector FrequencyAdjustments( const ToggleRiskScoreGenerator* const gen, const float essentialness, const LocationReference::Type type, const std::vector& days) { - int64 location_uuid = type == LocationReference::BUSINESS ? 0 : 1; + int64_t location_uuid = type == LocationReference::BUSINESS ? 0 : 1; auto risk_score = gen->GetRiskScore(essentialness); std::vector adjustments; @@ -75,7 +75,7 @@ TEST(PublicPolicyTest, AppropriateFrequencyAdjustments) { DistancingPolicy config = BuildPolicy({{10, .6}, {3, .2}, {20, 1.0}, {15, .2}}); auto generator_or = - NewRiskScoreGenerator(config, [](const int64 location_uuid) { + NewRiskScoreGenerator(config, [](const int64_t location_uuid) { return location_uuid == 0 ? LocationReference::BUSINESS : LocationReference::HOUSEHOLD; }); @@ -112,7 +112,7 @@ TEST(PublicPolicyTest, AppropriateFrequencyAdjustments) { TEST(PublicPolicyTest, ZeroStagePolicy) { DistancingPolicy config; auto generator_or = - NewRiskScoreGenerator(config, [](const int64 location_uuid) { + NewRiskScoreGenerator(config, [](const int64_t location_uuid) { return location_uuid == 0 ? LocationReference::BUSINESS : LocationReference::HOUSEHOLD; }); diff --git a/agent_based_epidemic_sim/applications/home_work/simulation.cc b/agent_based_epidemic_sim/applications/home_work/simulation.cc index 339b80f..3f9badb 100644 --- a/agent_based_epidemic_sim/applications/home_work/simulation.cc +++ b/agent_based_epidemic_sim/applications/home_work/simulation.cc @@ -54,15 +54,15 @@ constexpr char kHouseholdSizeProbability[] = "household_size_probability"; constexpr char kDistancingStageStart[] = "distancing_stage_start"; constexpr char kDistancingStageFraction[] = "distancing_stage_essential_workers"; -constexpr int64 kPopulationProfileId = 0; +constexpr int64_t kPopulationProfileId = 0; constexpr char kTopBusiness[] = "top_business_size"; constexpr int kNumTopBusinesses = 5; } // namespace namespace { -int64 GetLocationUuidForTypeOrDie(const AgentProto& agent, - const LocationReference::Type type) { +int64_t GetLocationUuidForTypeOrDie(const AgentProto& agent, + const LocationReference::Type type) { for (const auto& location : agent.locations()) { if (location.type() == type) { return location.uuid(); @@ -175,7 +175,7 @@ SimulationContext GetSimulationContext(const HomeWorkSimulationConfig& config) { LOG(INFO) << "Building agents and locations from config: " << config.DebugString(); // Samples the locations and agents. - const int64 kUuidShard = 0LL; + const int64_t kUuidShard = 0LL; SimulationContext context; std::vector& locations = context.locations; auto uuid_generator = @@ -217,7 +217,7 @@ SimulationContext GetSimulationContext(const HomeWorkSimulationConfig& config) { for (int i = 0; i < config.population_size(); ++i) { context.agents.push_back(sampler.Next()); } - absl::flat_hash_set business_uuids; + absl::flat_hash_set business_uuids; std::for_each( context.locations.begin(), context.locations.end(), [&business_uuids](const auto& location) { @@ -226,7 +226,7 @@ SimulationContext GetSimulationContext(const HomeWorkSimulationConfig& config) { } }); context.location_type = [business_uuids = - std::move(business_uuids)](int64 uuid) { + std::move(business_uuids)](int64_t uuid) { return business_uuids.contains(uuid) ? LocationReference::BUSINESS : LocationReference::HOUSEHOLD; };