CYCLUS
|
Resource defines an abstract interface implemented by types that are offered, requested, and transferred between simulation agents.
Resources represent the lifeblood of a simulation.
Definition at line 22 of file resource.h.
#include <resource.h>
Public Types | |
typedef boost::shared_ptr< Resource > | Ptr |
Public Member Functions | |
virtual void | Absorb (Ptr res) |
void | BumpStateId () |
virtual void | ChangePackage (std::string new_package_name=Package::unpackaged_name()) |
virtual Ptr | Clone () const =0 |
virtual void | Decay (int curr_time) |
virtual Ptr | ExtractRes (double quantity)=0 |
const int | obj_id () const |
template<class T > | |
std::vector< typename T::Ptr > | Package (Package::Ptr pkg) |
virtual std::string | package_name () |
virtual Ptr | PackageExtract (double qty, std::string new_package_name)=0 |
virtual int | qual_id () const =0 |
virtual double | quantity () const =0 |
virtual void | Record (Context *ctx) const =0 |
Resource () | |
const int | state_id () const |
virtual const ResourceType | type () const =0 |
virtual std::string | units () const =0 |
virtual | ~Resource () |
typedef boost::shared_ptr<Resource> cyclus::Resource::Ptr |
Definition at line 27 of file resource.h.
|
inline |
Definition at line 29 of file resource.h.
|
inlinevirtual |
Definition at line 31 of file resource.h.
To enable the Absorb method to be called on any child resource, define a null op Absorb method here.
res | pointer to a resource to be absorbed by this resource |
Definition at line 93 of file resource.h.
void cyclus::Resource::BumpStateId | ( | ) |
Assigns a new, unique internal id to this resource and its state.
This should be called by resource implementations whenever their state changes. A call to BumpStateId is not necessarily accompanied by a change to the state id. This should NEVER be called by agents.
Definition at line 8 of file resource.cc.
|
inlinevirtual |
Changes the product's package id.
Reimplemented in cyclus::Material, and cyclus::Product.
Definition at line 101 of file resource.h.
Returns an untracked (not part of the simulation) copy of the resource.
A cloned resource should never record anything in the output database.
Implemented in cyclus::Material, and cyclus::Product.
To enable the Decay method to be called on any child resource, define a null op Decay method here.
curr_time | the current time for the decay oepration |
Reimplemented in cyclus::Material.
Definition at line 88 of file resource.h.
Splits the resource and returns the extracted portion as a new resource object.
Allows for things like ResBuf and Traders to split offers/requests of arbitrary resource implementation type.
Implemented in cyclus::Material, and cyclus::Product.
Returns the unique id corresponding to this resource object.
Can be used to track and/or associate other information with this resource object. You should NOT track resources by pointer.
Definition at line 36 of file resource.h.
std::vector< typename T::Ptr > cyclus::Resource::Package | ( | Package::Ptr | pkg | ) |
Repackages a single resource into a package.
If some quantity of the resource cannot be packaged using the given packaging strategy and restrictions, the remainder is left in the resource object.
Definition at line 140 of file resource.h.
|
inlinevirtual |
Returns the package id.
Reimplemented in cyclus::Material, and cyclus::Product.
Definition at line 96 of file resource.h.
|
pure virtual |
Implemented in cyclus::Material, and cyclus::Product.
Returns an id representing the specific resource implementation's internal state that is not accessible via the Resource class public interface.
Any change to the qual_id should always be accompanied by a call to BumpStateId.
Implemented in cyclus::Material, and cyclus::Product.
Returns the quantity of this resource with dimensions as specified by the return value of units().
Implemented in cyclus::Material, and cyclus::Product.
Records the resource's state to the output database.
This method should generally NOT record data accessible via the Resource class public methods (e.g. qual_id, units, type, quantity).
ctx | the simulation context used to record the data. |
Implemented in cyclus::Material, and cyclus::Product.
Returns the unique id corresponding to this resource and its current state.
All resource id's are unique - even across different resource types/implementations. Runtime tracking of resources should generally use the obj_id rather than this.
Definition at line 42 of file resource.h.
|
pure virtual |
A unique type/name for the concrete resource implementation.
Implemented in cyclus::Material, and cyclus::Product.
|
pure virtual |
Returns the units this resource is based in (e.g. "kg").
Implemented in cyclus::Material, and cyclus::Product.