Class Reporter

Inheritance Relationships

Base Type

  • public std::enable_shared_from_this< Reporter >

Class Documentation

class Reporter : public std::enable_shared_from_this<Reporter>

A Reporter is a module that works with ReporterAgent and ReporterModel to collect information about the state of the model for later analysis.

Public Functions

Reporter()

Constructor.

std::shared_ptr<Reporter> clear()

Empty the report.

Clear all entries from the report; new collection operations begin with a blank slate.

Returns

a reference copy of the Reporter

std::unique_ptr<nlohmann::json> collect(const std::shared_ptr<ReporterModel> &model)

Collect the current state of the model.

This will collect the current state of each agent associated with the population returned by the Model’s get_population().

Parameters

model – reference copy of the model

Returns

a copy of the current report

std::unique_ptr<nlohmann::json> collect(const std::shared_ptr<ReporterModel> &model, const std::shared_ptr<Population> &pop)

Collect the current state of the model.

This will collect the current state of each agent associated with the Population.

Parameters
  • model – reference copy of the model

  • popPopulation to collect on

Returns

a copy of the current report

std::unique_ptr<nlohmann::json> collect(const std::shared_ptr<ReporterModel> &model, const std::unique_ptr<std::vector<AgentID>> &agent_list)

Collect the current state of the model.

This will collect the current state of each agent given

Parameters
  • model – reference copy of the model

  • agent_list – a vector agents to report on

Returns

a copy of the current report

std::unique_ptr<nlohmann::json> report(const std::shared_ptr<ReporterModel> &model)

Collect the report.

This will return the aggregate report of all the data collected by this Reporter.

Parameters

model – reference copy of the model

Returns

a copy of the current report

Protected Attributes

std::unique_ptr<std::vector<nlohmann::json>> _report_data = nullptr

A vector of the the report collected so far.