13 in_commods_.insert(in_commod);
14 out_commods_.insert(out_commod);
22 rsrc_commod_map_[rsrc->obj_id()] =
commod;
27 rsrc_commod_map_.erase(rsrc->obj_id());
32 rsrc_commod_map_[rsrc->obj_id()] =
commod;
38 in_recipes_[incommod] = recipe;
47 for (
int i = 0; i < nfuel; i++) {
49 di.
NewDatum(
"CommodityRecipeContext_inoutmap")
51 ->AddVal(
"in_recipe", fuel->
GetString(
"inrecipe"))
52 ->AddVal(
"out_commod", fuel->
GetString(
"outcommodity"))
53 ->AddVal(
"out_recipe", fuel->
GetString(
"outrecipe"))
60 for (
int i = 0; i < qr.
rows.size(); ++i) {
68 qr = b->
Query(
"CommodityRecipeContext_resmap", NULL);
69 }
catch(std::exception err) {
return; }
71 for (
int i = 0; i < qr.
rows.size(); ++i) {
73 int id = qr.
GetVal<
int>(
"res_id", i);
79 std::set<std::string>::iterator it2;
80 for (it2 = in_commods_.begin(); it2 != in_commods_.end(); ++it2) {
82 di.
NewDatum(
"CommodityRecipeContext_inoutmap")
84 ->
AddVal(
"in_recipe", in_recipes_[c])
85 ->
AddVal(
"out_commod", out_commod_map_[c])
86 ->
AddVal(
"out_recipe", out_recipes_[c])
90 std::map<int, std::string>::iterator it = rsrc_commod_map_.begin();
91 for (; it != rsrc_commod_map_.end(); ++it) {
92 di.
NewDatum(
"CommodityRecipeContext_resmap")
93 ->
AddVal(
"commod", it->second)
94 ->
AddVal(
"res_id", it->first)
102 " <element name=\"fuel\"> \n" 103 " <element name=\"incommodity\"><text/></element>\n" 104 " <element name=\"inrecipe\"><text/></element>\n" 105 " <element name=\"outcommodity\"><text/></element>\n" 106 " <element name=\"outrecipe\"><text/></element>\n" void UpdateRsrc(std::string commod, Resource::Ptr rsrc)
update a resource and its commodity affiliation
virtual void Snapshot(DbInit di)
Snapshots agent-internal state to the output db via di.
double b(int nuc)
Computes the scattering length [cm] from the coherent and incoherent components.
virtual int NMatches(std::string query)
investigates the current status and returns the number of elements matching a query ...
Meta data and results of a query.
A class for extracting information from a given XML parser.
virtual void InfileToDb(InfileTree *qe, DbInit di)
Translates info for the object from input file information to the database by reading parameters from...
Datum * NewDatum(std::string title)
Returns a new datum to be used exactly as the Context::NewDatum method.
T GetVal(std::string field, int row=0)
Convenience method for retrieving a value from a specific row and named field (column).
std::string out_recipe(std::string in_commod)
void AddRsrc(std::string commod, Resource::Ptr rsrc)
add a resource and its commodity affiliation
virtual std::string GetString(std::string query, int index=0)
investigates the current status and returns a string representing the content of a query at a given i...
virtual std::string schema()
Returns an object's xml rng schema for initializing from input files.
void AddInCommod(std::string in_commod, std::string in_recipe, std::string out_commod, std::string out_recipe)
add an input commodity and its relations
Datum * AddVal(const char *field, boost::spirit::hold_any val, std::vector< int > *shape=NULL)
Add an arbitrary field-value pair to the datum.
a CommodityRecipeContext contains relationships between commodities, recipes and resources ...
DbInit provides an interface for agents to record data to the output db that automatically injects th...
void UpdateInRec(std::string in_commod, std::string recipe)
update an input recipe and its commodity affiliation
InfileTree * SubTree(std::string query, int index=0)
populates a child infile based on a query and index
boost::shared_ptr< Resource > Ptr
virtual QueryResult Query(std::string table, std::vector< Cond > *conds)=0
Return a set of rows from the specificed table that match all given conditions.
taken directly from OsiSolverInterface.cpp on 2/17/14 from https://projects.coin-or.org/Osi/browser/trunk.
std::string commod(Resource::Ptr rsrc)
std::vector< QueryRow > rows
ordered results of a query
std::string in_recipe(std::string in_commod)
void Record()
Record this datum to its Recorder.
void RemoveRsrc(Resource::Ptr rsrc)
removes a resource from the context
virtual void InitFrom(QueryableBackend *b)
Intializes an agent's internal state from an output database.
Interface implemented by backends that support rudimentary querying.
virtual CommodityRecipeContext * Clone()
Return a newly created/allocated object that is an exact copy of this.
std::string out_commod(std::string in_commod)