CYCLUS
Loading...
Searching...
No Matches
cyclus::StateWrangler Class Referenceabstract

Detailed Description

An abjstract interface that must be implemented by all simulation agents and all agent member variables that have unexported internal state.

These methods all do inter-related things. Notably, the InfileToDb, InitFrom, and Snapshot methods must all write/read to/from the same database tables (and table schemas). The InfileToDb method reads data from the InfileTree that is first validated with the rng schema returned by the schema method.

Definition at line 20 of file state_wrangler.h.

#include <state_wrangler.h>

Inheritance diagram for cyclus::StateWrangler:
cyclus::Agent cyclus::toolkit::CommodityRecipeContext cyclus::Facility cyclus::Institution cyclus::Region cyclus::Dummy

Public Member Functions

virtual StateWranglerClone ()=0
 
virtual void InfileToDb (InfileTree *qe, DbInit di)=0
 
virtual void InitFrom (QueryableBackend *b)=0
 
virtual std::string schema ()=0
 
virtual void Snapshot (DbInit di)=0
 

Member Function Documentation

◆ Clone()

virtual StateWrangler * cyclus::StateWrangler::Clone ( )
pure virtual

Return a newly created/allocated object that is an exact copy of this.

Subclasses are expected to override the return type with their own concrete type.

Implemented in cyclus::Dummy, cyclus::toolkit::CommodityRecipeContext, and cyclus::Agent.

◆ InfileToDb()

virtual void cyclus::StateWrangler::InfileToDb ( InfileTree * qe,
DbInit di )
pure virtual

Translates info for the object from input file information to the database by reading parameters from the passed InfileTree and recording data via the DbInit variable.

The simulation and agent id's are automatically injected in all data transfered through di.

Agent parameters in the InfileTree are scoped in the "config/*" path. The superclass InitFrom expects the InfileTree passed to it to be scoped identically to the tree passed to the agent's InitFrom. - do NOT pass a changed-scope tree to the superclass.

Warning
this method MUST NOT modify the object's state.

Implemented in cyclus::Agent, cyclus::Facility, cyclus::Institution, cyclus::Region, and cyclus::toolkit::CommodityRecipeContext.

◆ InitFrom()

virtual void cyclus::StateWrangler::InitFrom ( QueryableBackend * b)
pure virtual

Intializes an agent's internal state from an output database.

Appropriate simulation id, agent id, and time filters are automatically included in all queries.

Implemented in cyclus::Agent, cyclus::Facility, cyclus::Institution, cyclus::Region, and cyclus::toolkit::CommodityRecipeContext.

◆ schema()

virtual std::string cyclus::StateWrangler::schema ( )
pure virtual

Returns an object's xml rng schema for initializing from input files.

Implemented in cyclus::Agent, and cyclus::toolkit::CommodityRecipeContext.

◆ Snapshot()

virtual void cyclus::StateWrangler::Snapshot ( DbInit di)
pure virtual

Snapshots agent-internal state to the output db via di.

This method MUST call the superclass' Snapshot method before doing any work. The simulation and agent id's in addition to the snapshot time are automatically included in all information transfered through di.

Warning
because a 'Time' field is automatically injected, that label cannot be used for any other fields.
This method MUST NOT modify the agent's state.

Implemented in cyclus::Facility, cyclus::Institution, cyclus::Region, cyclus::toolkit::CommodityRecipeContext, and cyclus::Agent.


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