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 43 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="")
 
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_
 
boost::shared_ptr< XMLParserparser_
 
Recorderrec_
 
std::string schema_path_
 
std::map< std::string, AgentSpecspecs_
 
Timer ti_
 

Constructor & Destructor Documentation

cyclus::XMLFileLoader::XMLFileLoader ( Recorder r,
QueryableBackend b,
std::string  schema_file,
const std::string  input_file = "" 
)

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.

Definition at line 146 of file xml_file_loader.cc.

cyclus::XMLFileLoader::~XMLFileLoader ( )
virtual

Definition at line 169 of file xml_file_loader.cc.

Member Function Documentation

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 391 of file xml_file_loader.cc.

void cyclus::XMLFileLoader::LoadControlParams ( )
protected

Method to load the simulation control parameters.

Definition at line 400 of file xml_file_loader.cc.

void cyclus::XMLFileLoader::LoadInitialAgents ( )
protectedvirtual

Creates all initial agent instances from the input file.

Reimplemented in cyclus::XMLFlatLoader.

Definition at line 320 of file xml_file_loader.cc.

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

loads a specific recipe

void cyclus::XMLFileLoader::LoadRecipes ( )
protected

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

Definition at line 298 of file xml_file_loader.cc.

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 177 of file xml_file_loader.cc.

void cyclus::XMLFileLoader::LoadSolver ( )
protected

Method to load the simulation exchange solver.

Definition at line 189 of file xml_file_loader.cc.

void cyclus::XMLFileLoader::LoadSpecs ( )
protected

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

Definition at line 313 of file xml_file_loader.cc.

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

Reimplemented in cyclus::XMLFlatLoader.

Definition at line 173 of file xml_file_loader.cc.

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 276 of file xml_file_loader.cc.

Member Data Documentation

QueryableBackend* cyclus::XMLFileLoader::b_
protected

Definition at line 93 of file xml_file_loader.h.

Context* cyclus::XMLFileLoader::ctx_
protected

Definition at line 92 of file xml_file_loader.h.

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

the input file name

Definition at line 105 of file xml_file_loader.h.

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

the parser

Definition at line 102 of file xml_file_loader.h.

Recorder* cyclus::XMLFileLoader::rec_
protected

Definition at line 90 of file xml_file_loader.h.

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

filepath to the schema

Definition at line 96 of file xml_file_loader.h.

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

Definition at line 99 of file xml_file_loader.h.

Timer cyclus::XMLFileLoader::ti_
protected

Definition at line 91 of file xml_file_loader.h.


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