Class StateReader

Inheritance Relationships

Derived Types

Class Documentation

class StateReader

Subclassed by jsonReader, xmlReader

Public Functions

inline StateReader(const std::string &_model_name, const std::unordered_map<std::string, EnvironmentDescription::PropData> &_env_desc, std::unordered_map<std::pair<std::string, unsigned int>, Any> &_env_init, 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)

inline ~StateReader()
virtual int parse() = 0

Actually perform the file load

Todo:

: This should probably be the same return code between subclasses, and seems redundant with our exceptions as should never return fail.

Returns

Returns a return code

Protected Attributes

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
std::unordered_map<std::pair<std::string, unsigned int>, Any> &env_init
Simulation *sim_instance