1#ifndef CYCLUS_SRC_AGENT_H_
2#define CYCLUS_SRC_AGENT_H_
29 virtual const int id()
const = 0;
38typedef std::map<std::string, std::vector<Resource::Ptr> >
Inventories;
51 friend class ::SimInitTest;
63 virtual std::string
version() {
return "unspecified"; }
345 inline const std::string
prototype()
const {
return prototype_; }
352 virtual const int id()
const {
return id_; }
356 inline std::string
spec() {
return spec_; }
370 virtual std::string
str();
377 inline const int parent_id()
const {
return parent_id_; }
395 inline const int lifetime()
const {
return lifetime_; }
408 return enter_time_ + lifetime_ - 1;
412 inline const std::set<Agent*>&
children()
const {
return children_; }
467 std::set<Agent*> children_;
480 std::string prototype_;
The abstract base class used by all types of agents that live and interact in a simulation.
virtual Json::Value annotations()
Returns an agent's json annotations for all state variables and any other information the developer w...
virtual void DecomNotify(Agent *m)
Called when a child of this agent is about to be decommissioned.
virtual void BuildNotify(Agent *m)
Called when a new child of this agent has just been built.
const int exit_time() const
Returns the default time step at which this agent will exit the simulation (-1 if the agent has an in...
virtual void InitFrom(QueryableBackend *b)
Intializes an agent's internal state from the database.
const std::string prototype() const
Returns the agent's prototype.
virtual void Build(Agent *parent)
Called when the agent enters the smiulation as an active participant and is only ever called once.
std::string spec()
The string representation of the agent spec that uniquely identifies the concrete agent class/module.
virtual Agent * Clone()=0
Returns a newly created/allocated prototype that is an exact copy of this.
Agent(Context *ctx)
Creates a new agent that is managed by the given context.
const int parent_id() const
Returns the id for this agent's parent.
virtual std::string schema()
Returns an agent's xml rng schema for initializing from input files.
virtual void InitInv(Inventories &inv)=0
Provides an agent's initial inventory of resources before a simulation begins.
std::vector< std::string > GetTreePrintOuts(Agent *m)
returns a vector of strings representing the parent-child tree at the node for Agent m
virtual void AdjustMatlPrefs(PrefMap< Material >::type &prefs)
default implementation for material preferences.
void spec(std::string new_impl)
Sets this agent's agent spec.
Context * context() const
Returns this agent's simulation context.
bool DecendentOf(Agent *other)
returns true if this agent is an decendent of an other agent (i.e., resides below an other agent in t...
virtual void InfileToDb(InfileTree *qe, DbInit di)
Translates info for the agent from an input file to the database by reading parameters from the passe...
const int lifetime() const
Returns the number of time steps this agent operates between building and decommissioning (-1 if the ...
const std::set< Agent * > & children() const
Returns a list of children this agent has.
const std::string kind() const
Returns a string that describes the agent subclass (e.g.
virtual const int id() const
The agent instance's unique ID within a simulation.
virtual void Decommission()
Decommissions the agent, removing it from the simulation.
void prototype(std::string p)
Sets the agent's prototype.
virtual void Snapshot(DbInit di)=0
Snapshots agent-internal state to the database via the DbInit var di.
std::string PrintChildren()
recursively prints the parent-child tree
virtual ~Agent()
Removes references to self from simulation context, parent, children, etc.
bool InFamilyTree(Agent *other)
returns true if this agent is in the parent-child family tree of an other agent
std::string kind_
describes the agent subclass (e.g.
virtual void EnterNotify()
Called to give the agent an opportunity to register for services (e.g.
virtual std::string version()
Agent * parent() const
Returns parent of this agent. Returns NULL if the agent has no parent.
virtual void AdjustProductPrefs(PrefMap< Product >::type &prefs)
default implementation for material preferences.
virtual std::string str()
Description of this agent.
virtual std::string InformErrorMsg(std::string msg)
adds agent-specific information prefix to an error message
const int enter_time() const
Returns the time step at which this agent's Build function was called (-1 if the agent has never been...
bool AncestorOf(Agent *other)
returns true if this agent is an ancestor of an other agent (i.e., resides above an other agent in th...
void lifetime_force(int n_timesteps)
Sets the number of time steps this agent operates between building and decommissioning (-1 if the age...
virtual Inventories SnapshotInv()=0
Snapshots an agent's resource inventories to the database.
A simulation context provides access to necessary simulation-global functions and state.
DbInit provides an interface for agents to record data to the output db that automatically injects th...
virtual const int id() const =0
A class for extracting information from a given XML parser.
The material class is primarily responsible for enabling basic material manipulation while helping en...
A Product is a general type of resource in the Cyclus simulation, and is a catch-all for non-standard...
Interface implemented by backends that support rudimentary querying.
Handles initialization of a simulation from the output database.
An abjstract interface that must be implemented by all simulation agents and all agent member variabl...
@ objectValue
object value (collection of name/value pairs).
taken directly from OsiSolverInterface.cpp on 2/17/14 from https://projects.coin-or....
std::map< std::string, std::vector< Resource::Ptr > > Inventories
map<inventory_name, vector<resources_in_inventory> >.
T OptionalQuery(InfileTree *tree, std::string query, T default_val)
a query method for optional parameters
std::map< Request< T > *, std::map< Bid< T > *, double > > type