Class StateWriter

Inheritance Relationships

Derived Types

Class Documentation

class StateWriter

Abstract representation of a class for exporting model data (agent population data, environment properties, run configuration) to file

See also

XMLStateWriter The XML implementation of a StateWriter

See also

JSONStateWriter The JSON implementation of a StateWriter

Subclassed by flamegpu::io::JSONStateWriter, flamegpu::io::XMLStateWriter

Public Functions

inline StateWriter(const std::string &_model_name, const std::shared_ptr<detail::EnvironmentManager> &_env_manager, const util::StringPairUnorderedMap<std::shared_ptr<AgentVector>> &_model_state, const unsigned int _iterations, const std::string &output_file, const Simulation *_sim_instance)

Returns a writer capable of writing model state to a specific format (this class is abstract) Agent data will be read from ‘model_state’

Parameters:
  • _model_name – Name from the model description hierarchy of the model to be exported

  • _env_manager – Environment manager containing env property data for this sim instance

  • _model_state – Map of AgentVector to read the agent data from per agent, key should be agent name

  • _iterations – The value from the step counter at the time of export.

  • output_file – Filename of the input file (This will be used to determine which reader to return)

  • _sim_instance – Instance of the simulation (for configuration data IO)

inline virtual ~StateWriter()

Virtual destructor for correct inheritance behaviour

virtual int writeStates(bool prettyPrint) = 0

Actually perform the file export

Parameters:

prettyPrint – Whether to include indentation and line breaks to aide human reading

Returns:

Returns a return code

Protected Attributes

const util::StringPairUnorderedMap<std::shared_ptr<AgentVector>> model_state = {}
unsigned int iterations
std::string outputFile
const std::string model_name
const std::shared_ptr<detail::EnvironmentManager> env_manager
const Simulation *sim_instance