Class StateReader

Inheritance Relationships

Derived Types

Class Documentation

class flamegpu::io::StateReader

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

See

XMLStateReader The XML implementation of a StateReader

See

JSONStateReader The JSON implementation of a StateReader

Subclassed by flamegpu::io::JSONStateReader, flamegpu::io::XMLStateReader

Public Functions

inline StateReader(const std::string &_model_name, const std::unordered_map<std::string, EnvironmentDescription::PropData> &_env_desc, util::StringUint32PairUnorderedMap<util::Any> &_env_init, util::StringPairUnorderedMap<std::shared_ptr<AgentVector>> &_model_state, const std::string &input, Simulation *_sim_instance)

Constructs a reader capable of reading model state from a specific format (this class is abstract) Environment properties will be read into the Simulation instance pointed to by ‘sim_instance_id’ Agent data will be read into ‘model_state’

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

  • _env_desc – Environment description for validating property data on load

  • _env_init – Dictionary of loaded values map:<{name, index}, value>

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

  • input – 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 ~StateReader()

Virtual destructor for correct inheritance behaviour

virtual int parse() = 0

Actually perform the file load

Returns

Returns a return code

Protected Attributes

util::StringPairUnorderedMap<std::shared_ptr<AgentVector>> &model_state
std::string inputFile
const std::string model_name
const std::unordered_map<std::string, EnvironmentDescription::PropData> &env_desc
util::StringUint32PairUnorderedMap<util::Any> &env_init
Simulation *sim_instance