Skip to content

Commit 87ad859

Browse files
Pandemic-Sim Teamcopybara-github
authored andcommitted
Automated Code Change
PiperOrigin-RevId: 806051033
1 parent 954b48a commit 87ad859

File tree

3 files changed

+33
-33
lines changed

3 files changed

+33
-33
lines changed

agent_based_epidemic_sim/applications/risk_learning/simulation.cc

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -338,7 +338,7 @@ class RiskLearningSimulation : public Simulation {
338338
LocationProto proto;
339339
while (reader.ReadRecord(proto)) {
340340
{
341-
absl::MutexLock l(&location_mu);
341+
absl::MutexLock l(location_mu);
342342
result->location_types_[proto.reference().uuid()] =
343343
proto.reference().type();
344344
}
@@ -350,7 +350,7 @@ class RiskLearningSimulation : public Simulation {
350350
} else if (proto.reference().type() == LocationReference::RANDOM) {
351351
transmissibility = random_transmissibility;
352352
} else {
353-
absl::MutexLock l(&status_mu);
353+
absl::MutexLock l(status_mu);
354354
statuses.push_back(absl::InvalidArgumentError(absl::StrCat(
355355
"Invalid type ", i, ": ", proto.reference().DebugString())));
356356
return;
@@ -369,7 +369,7 @@ class RiskLearningSimulation : public Simulation {
369369
: non_work_drop_prob;
370370
{
371371
const int64 uuid = proto.reference().uuid();
372-
absl::MutexLock l(&location_mu);
372+
absl::MutexLock l(location_mu);
373373
locations.push_back(NewGraphLocation(
374374
uuid, transmissibility, drop_prob, std::move(edges),
375375
*result->exposure_generators_[result->get_location_type_(
@@ -379,27 +379,27 @@ class RiskLearningSimulation : public Simulation {
379379
}
380380
case LocationProto::kRandom: {
381381
const int64 uuid = proto.reference().uuid();
382-
absl::MutexLock l(&location_mu);
382+
absl::MutexLock l(location_mu);
383383
locations.push_back(NewRandomGraphLocation(
384384
uuid, transmissibility, random_interaction_multiplier,
385385
*result->exposure_generators_[result->get_location_type_(
386386
uuid)]));
387387
} break;
388388
default: {
389-
absl::MutexLock l(&status_mu);
389+
absl::MutexLock l(status_mu);
390390
statuses.push_back(absl::InvalidArgumentError(absl::StrCat(
391391
"Invalid location ", i, ": ", proto.DebugString())));
392392
}
393393
return;
394394
}
395395
{
396-
absl::MutexLock l(&location_mu);
396+
absl::MutexLock l(location_mu);
397397
i++;
398398
}
399399
}
400400
absl::Status status = reader.status();
401401
if (!status.ok()) {
402-
absl::MutexLock l(&status_mu);
402+
absl::MutexLock l(status_mu);
403403
statuses.push_back(status);
404404
return;
405405
}
@@ -504,7 +504,7 @@ class RiskLearningSimulation : public Simulation {
504504
while (reader.ReadRecord(proto)) {
505505
auto profile_iter = profile_data.find(proto.population_profile_id());
506506
if (profile_iter == profile_data.end()) {
507-
absl::MutexLock l(&status_mu);
507+
absl::MutexLock l(status_mu);
508508
statuses.push_back(absl::InvalidArgumentError(
509509
absl::StrCat("Invalid population profile id for agent: ",
510510
proto.DebugString())));
@@ -517,7 +517,7 @@ class RiskLearningSimulation : public Simulation {
517517
config.tracing_policy(), result->risk_score_policy_,
518518
result->risk_score_model_.get(), result->get_location_type_);
519519
if (!risk_score_or.ok()) {
520-
absl::MutexLock l(&status_mu);
520+
absl::MutexLock l(status_mu);
521521
statuses.push_back(risk_score_or.status());
522522
return;
523523
}
@@ -535,7 +535,7 @@ class RiskLearningSimulation : public Simulation {
535535
transmission_model = result->transmission_model_.get();
536536
}
537537
{
538-
absl::MutexLock l(&agent_mu);
538+
absl::MutexLock l(agent_mu);
539539
if (max_population > 0 && agents.size() == max_population) {
540540
break;
541541
}
@@ -555,7 +555,7 @@ class RiskLearningSimulation : public Simulation {
555555
}
556556
absl::Status status = reader.status();
557557
if (!status.ok()) {
558-
absl::MutexLock l(&status_mu);
558+
absl::MutexLock l(status_mu);
559559
statuses.push_back(status);
560560
}
561561
reader.Close();

agent_based_epidemic_sim/port/deps/logging.cc

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -38,13 +38,13 @@ constexpr char kDefaultDirectory[] = "/tmp/";
3838
namespace {
3939

4040
// The logging directory.
41-
ABSL_CONST_INIT std::string *log_file_directory = nullptr;
41+
ABSL_CONST_INIT std::string* log_file_directory = nullptr;
4242

4343
// The log filename.
44-
ABSL_CONST_INIT std::string *log_basename = nullptr;
44+
ABSL_CONST_INIT std::string* log_basename = nullptr;
4545

46-
const char *GetBasename(const char *file_path) {
47-
const char *slash = strrchr(file_path, '/');
46+
const char* GetBasename(const char* file_path) {
47+
const char* slash = strrchr(file_path, '/');
4848
return slash ? slash + 1 : file_path;
4949
}
5050

@@ -66,20 +66,20 @@ std::string get_log_directory() {
6666

6767
namespace logging_internal {
6868

69-
LogMessage::LogMessage(const char *file, int line)
69+
LogMessage::LogMessage(const char* file, int line)
7070
: LogMessage(file, line, absl::LogSeverity::kInfo) {}
7171

72-
LogMessage::LogMessage(const char *file, int line, const std::string &result)
72+
LogMessage::LogMessage(const char* file, int line, const std::string& result)
7373
: LogMessage(file, line, absl::LogSeverity::kFatal) {
7474
stream() << "Check failed: " << result << " ";
7575
}
7676

77-
static constexpr const char *LogSeverityNames[4] = {"INFO", "WARNING", "ERROR",
77+
static constexpr const char* LogSeverityNames[4] = {"INFO", "WARNING", "ERROR",
7878
"FATAL"};
7979

80-
LogMessage::LogMessage(const char *file, int line, absl::LogSeverity severity)
80+
LogMessage::LogMessage(const char* file, int line, absl::LogSeverity severity)
8181
: severity_(severity) {
82-
const char *filename = GetBasename(file);
82+
const char* filename = GetBasename(file);
8383

8484
// Write a prefix into the log message, including local date/time, severity
8585
// level, filename, and line number.
@@ -103,10 +103,10 @@ LogMessage::~LogMessage() {
103103
}
104104
}
105105

106-
void LogMessage::SendToLog(const std::string &message_text) {
106+
void LogMessage::SendToLog(const std::string& message_text) {
107107
std::string log_path = get_log_directory() + get_log_basename();
108108

109-
FILE *file = fopen(log_path.c_str(), "ab");
109+
FILE* file = fopen(log_path.c_str(), "ab");
110110
if (file) {
111111
if (fprintf(file, "%s", message_text.c_str()) > 0) {
112112
if (message_text.back() != '\n') {

agent_based_epidemic_sim/port/deps/logging.h

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -30,40 +30,40 @@ class LogMessage {
3030
//
3131
// file: source file that produced the log.
3232
// line: source code line that produced the log.
33-
LogMessage(const char *file, int line);
33+
LogMessage(const char* file, int line);
3434

3535
// Constructs a new message with the specified severity.
3636
//
3737
// file: source file that produced the log.
3838
// line: source code line that produced the log.
3939
// severity: severity level of the log.
40-
LogMessage(const char *file, int line, absl::LogSeverity severity);
40+
LogMessage(const char* file, int line, absl::LogSeverity severity);
4141

4242
// Constructs a log message with additional text that is provided by CHECK
4343
// macros. Severity is implicitly FATAL.
4444
//
4545
// file: source file that produced the log.
4646
// line: source code line that produced the log.
4747
// result: result message of the failed check.
48-
LogMessage(const char *file, int line, const std::string &result);
48+
LogMessage(const char* file, int line, const std::string& result);
4949

5050
// The destructor flushes the message.
5151
~LogMessage();
5252

53-
LogMessage(const LogMessage &) = delete;
54-
void operator=(const LogMessage &) = delete;
53+
LogMessage(const LogMessage&) = delete;
54+
void operator=(const LogMessage&) = delete;
5555

5656
// Gets a reference to the underlying string stream.
57-
std::ostream &stream() { return stream_; }
57+
std::ostream& stream() { return stream_; }
5858

5959
protected:
6060
void Flush();
6161

6262
private:
63-
void Init(const char *file, int line, absl::LogSeverity severity);
63+
void Init(const char* file, int line, absl::LogSeverity severity);
6464

6565
// Sends the message to print.
66-
void SendToLog(const std::string &message_text);
66+
void SendToLog(const std::string& message_text);
6767

6868
// stream_ reads all the input messages into a stringstream, then it's
6969
// converted into a string in the destructor for printing.
@@ -76,7 +76,7 @@ class LogMessage {
7676
// operator& is used because it has precedence lower than << but higher than :?
7777
class LogMessageVoidify {
7878
public:
79-
void operator&(const std::ostream &) {}
79+
void operator&(const std::ostream&) {}
8080
};
8181

8282
// Default LogSeverity FATAL version of LogMessage.
@@ -87,15 +87,15 @@ class LogMessageFatal : public LogMessage {
8787
//
8888
// file: source file that produced the log.
8989
// line: source code line that produced the log.
90-
LogMessageFatal(const char *file, int line)
90+
LogMessageFatal(const char* file, int line)
9191
: LogMessage(file, line, absl::LogSeverity::kFatal) {}
9292

9393
// Constructs a message with FATAL severity for use by CHECK macros.
9494
//
9595
// file: source file that produced the log.
9696
// line: source code line that produced the log.
9797
// result: result message when check fails.
98-
LogMessageFatal(const char *file, int line, const std::string &result)
98+
LogMessageFatal(const char* file, int line, const std::string& result)
9999
: LogMessage(file, line, result) {}
100100

101101
// Suppresses warnings in some cases, example:

0 commit comments

Comments
 (0)