CYCLUS
Public Member Functions | Protected Member Functions | Protected Attributes | List of all members
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 50 of file xml_file_loader.h.

#include <xml_file_loader.h>

Inheritance diagram for cyclus::XMLFileLoader:
Inheritance graph
[legend]

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 LoadRecipe (InfileTree *qe)
 
void LoadRecipes ()
 
void LoadSolver ()
 
void LoadSpecs ()
 
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 407 of file xml_file_loader.cc.

◆ LoadControlParams()

void cyclus::XMLFileLoader::LoadControlParams ( )
protected

Method to load the simulation control parameters.

Definition at line 416 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 336 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 314 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 205 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 329 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 292 of file xml_file_loader.cc.

Member Data Documentation

◆ b_

QueryableBackend* cyclus::XMLFileLoader::b_
protected

Definition at line 101 of file xml_file_loader.h.

◆ ctx_

Context* cyclus::XMLFileLoader::ctx_
protected

Definition at line 100 of file xml_file_loader.h.

◆ file_

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

the input file name

Definition at line 116 of file xml_file_loader.h.

◆ format_

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

the input file format

Definition at line 119 of file xml_file_loader.h.

◆ ms_print_

bool cyclus::XMLFileLoader::ms_print_
protected

flag to indicate printing master schema

Definition at line 104 of file xml_file_loader.h.

◆ parser_

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

the parser

Definition at line 113 of file xml_file_loader.h.

◆ rec_

Recorder* cyclus::XMLFileLoader::rec_
protected

Definition at line 98 of file xml_file_loader.h.

◆ schema_path_

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

filepath to the schema

Definition at line 107 of file xml_file_loader.h.

◆ specs_

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

Definition at line 110 of file xml_file_loader.h.

◆ ti_

Timer cyclus::XMLFileLoader::ti_
protected

Definition at line 99 of file xml_file_loader.h.


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