CYCLUS
Loading...
Searching...
No Matches
cyclus::XMLFileLoader Class Reference

Detailed Description

Handles initialization of a database with information from a cyclus xml input file.

Warning
the LoadSim method is NOT idempotent. Only one / simulation should ever be initialized per XMLFileLoader object.

Definition at line 51 of file xml_file_loader.h.

#include <xml_file_loader.h>

Inheritance diagram for cyclus::XMLFileLoader:
cyclus::XMLFlatLoader

Public Member Functions

virtual void LoadSim ()
 
 XMLFileLoader (Recorder *r, QueryableBackend *b, std::string schema_file, const std::string input_file="", const std::string format="none", bool ms_print=false)
 
virtual ~XMLFileLoader ()
 

Protected Member Functions

AgentBuildAgent (std::string proto, Agent *parent)
 
void LoadControlParams ()
 
virtual void LoadInitialAgents ()
 
void LoadPackages ()
 
void LoadRecipe (InfileTree *qe)
 
void LoadRecipes ()
 
void LoadSolver ()
 
void LoadSpecs ()
 
void LoadTransportUnits ()
 
virtual std::string master_schema ()
 
void ProcessCommodities (std::map< std::string, double > *commodity_priority)
 

Protected Attributes

QueryableBackendb_
 
Contextctx_
 
std::string file_
 
std::string format_
 
bool ms_print_
 
boost::shared_ptr< XMLParserparser_
 
Recorderrec_
 
std::string schema_path_
 
std::map< std::string, AgentSpecspecs_
 
Timer ti_
 

Constructor & Destructor Documentation

◆ XMLFileLoader()

cyclus::XMLFileLoader::XMLFileLoader ( Recorder * r,
QueryableBackend * b,
std::string schema_file,
const std::string input_file = "",
const std::string format = "none",
bool ms_print = false )

Create a new loader reading from the xml simulation input file and writing to and initializing the backends in r.

r must already have b registered. schema_file identifies the master xml rng schema used to validate the input file. The format specifies the input file format from one of: "none", "xml", "json", or "py".

Definition at line 160 of file xml_file_loader.cc.

◆ ~XMLFileLoader()

cyclus::XMLFileLoader::~XMLFileLoader ( )
virtual

Definition at line 182 of file xml_file_loader.cc.

Member Function Documentation

◆ BuildAgent()

Agent * cyclus::XMLFileLoader::BuildAgent ( std::string proto,
Agent * parent )
protected

Creates and builds an agent, notifying its parent.

The agent init info is translated and stored in the output db.

Definition at line 449 of file xml_file_loader.cc.

◆ LoadControlParams()

void cyclus::XMLFileLoader::LoadControlParams ( )
protected

Method to load the simulation control parameters.

Definition at line 458 of file xml_file_loader.cc.

◆ LoadInitialAgents()

void cyclus::XMLFileLoader::LoadInitialAgents ( )
protectedvirtual

Creates all initial agent instances from the input file.

Reimplemented in cyclus::XMLFlatLoader.

Definition at line 378 of file xml_file_loader.cc.

◆ LoadPackages()

void cyclus::XMLFileLoader::LoadPackages ( )
protected

Loads packages.

Definition at line 331 of file xml_file_loader.cc.

◆ LoadRecipe()

void cyclus::XMLFileLoader::LoadRecipe ( InfileTree * qe)
protected

loads a specific recipe

◆ LoadRecipes()

void cyclus::XMLFileLoader::LoadRecipes ( )
protected

Method to load recipes from either the primary input file or a recipeBook catalog.

Definition at line 316 of file xml_file_loader.cc.

◆ LoadSim()

void cyclus::XMLFileLoader::LoadSim ( )
virtual

Load an entire simulation from the inputfile.

Parameters
use_flat_schemawhether or not to use the flat schema

Definition at line 190 of file xml_file_loader.cc.

◆ LoadSolver()

void cyclus::XMLFileLoader::LoadSolver ( )
protected

Method to load the simulation exchange solver.

Definition at line 207 of file xml_file_loader.cc.

◆ LoadSpecs()

void cyclus::XMLFileLoader::LoadSpecs ( )
protected

Load agent specs from the input file to a map by alias.

Definition at line 371 of file xml_file_loader.cc.

◆ LoadTransportUnits()

void cyclus::XMLFileLoader::LoadTransportUnits ( )
protected

Loads Transport Units.

Definition at line 352 of file xml_file_loader.cc.

◆ master_schema()

std::string cyclus::XMLFileLoader::master_schema ( )
protectedvirtual

Reimplemented in cyclus::XMLFlatLoader.

Definition at line 186 of file xml_file_loader.cc.

◆ ProcessCommodities()

void cyclus::XMLFileLoader::ProcessCommodities ( std::map< std::string, double > * commodity_priority)
protected

Processes commodity priorities, such that any without a defined priority (i.e., are nonpositive), are given priority lower than the last known commodity.

Definition at line 294 of file xml_file_loader.cc.

Member Data Documentation

◆ b_

QueryableBackend* cyclus::XMLFileLoader::b_
protected

Definition at line 108 of file xml_file_loader.h.

◆ ctx_

Context* cyclus::XMLFileLoader::ctx_
protected

Definition at line 107 of file xml_file_loader.h.

◆ file_

std::string cyclus::XMLFileLoader::file_
protected

the input file name

Definition at line 123 of file xml_file_loader.h.

◆ format_

std::string cyclus::XMLFileLoader::format_
protected

the input file format

Definition at line 126 of file xml_file_loader.h.

◆ ms_print_

bool cyclus::XMLFileLoader::ms_print_
protected

flag to indicate printing master schema

Definition at line 111 of file xml_file_loader.h.

◆ parser_

boost::shared_ptr<XMLParser> cyclus::XMLFileLoader::parser_
protected

the parser

Definition at line 120 of file xml_file_loader.h.

◆ rec_

Recorder* cyclus::XMLFileLoader::rec_
protected

Definition at line 105 of file xml_file_loader.h.

◆ schema_path_

std::string cyclus::XMLFileLoader::schema_path_
protected

filepath to the schema

Definition at line 114 of file xml_file_loader.h.

◆ specs_

std::map<std::string, AgentSpec> cyclus::XMLFileLoader::specs_
protected

Definition at line 117 of file xml_file_loader.h.

◆ ti_

Timer cyclus::XMLFileLoader::ti_
protected

Definition at line 106 of file xml_file_loader.h.


The documentation for this class was generated from the following files: