73 parent2_ =
absorbed->res_->state_id();
86 parent1_ = parent->res_->state_id();
103void ResTracker::Record(
bool bumpId) {
116 ->
AddVal(
"Parent1", parent1_)
117 ->
AddVal(
"Parent2", parent2_)
The abstract base class used by all types of agents that live and interact in a simulation.
A simulation context provides access to necessary simulation-global functions and state.
Datum * NewDatum(std::string title)
See Recorder::NewDatum documentation.
virtual int time()
Returns the current simulation timestep.
Datum * AddVal(const char *field, boost::spirit::hold_any val, std::vector< int > *shape=NULL)
Add an arbitrary field-value pair to the datum.
void Record()
Record this datum to its Recorder.
Tracks and records the state and parent-child relationships of resources as they are changed.
void Create(Agent *creator)
Should be called when a resource instance is newly created.
void Modify()
Should be called when the state of a resource changes (e.g.
void Extract(ResTracker *removed)
Should be called when a resource has some quantity removed from it (e.g.
void Package(ResTracker *parent=NULL)
Should be called when a resource's package gets modified.
void Absorb(ResTracker *absorbed)
Should be called when a resource is combined with another.
ResTracker(Context *ctx, Resource *r)
Create a new tracker following r.
void DontTrack()
Prevent a resource's heritage from being tracked and recorded.
Resource defines an abstract interface implemented by types that are offered, requested,...
const int state_id() const
Returns the unique id corresponding to this resource and its current state.
virtual const ResourceType type() const =0
A unique type/name for the concrete resource implementation.
virtual std::string units() const =0
Returns the units this resource is based in (e.g. "kg").
virtual void Record(Context *ctx) const =0
Records the resource's state to the output database.
virtual double quantity() const =0
Returns the quantity of this resource with dimensions as specified by the return value of units().
const int obj_id() const
Returns the unique id corresponding to this resource object.
virtual std::string package_name()
Returns the package id.
void BumpStateId()
Assigns a new, unique internal id to this resource and its state.
virtual int qual_id() const =0
Returns an id representing the specific resource implementation's internal state that is not accessib...
taken directly from OsiSolverInterface.cpp on 2/17/14 from https://projects.coin-or....
double eps_rsrc()
an epsilon value to be used by resources
T OptionalQuery(InfileTree *tree, std::string query, T default_val)
a query method for optional parameters