Class xmlReader

Inheritance Relationships

Base Type

Class Documentation

class xmlReader : public StateReader

Public Functions

xmlReader(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_file, Simulation *sim_instance)

Constructs a reader capable of reading model state from XML files Environment properties will be read into the Simulation instance pointed to by ‘sim_instance_id’ Agent data will be read into ‘model_state’

  • 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_file – Filename of the input file (This will be used to determine which reader to return)

virtual int parse()

parses the xml file

Actual performs the XML parsing to load the model state


TinyXMLError – If parsing of the input file fails


Always tinyxml2::XML_SUCCESS