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

Detailed Description

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>

Inheritance diagram for cyclus::Resource:
cyclus::Material cyclus::Product

Public Types

typedef boost::shared_ptr< ResourcePtr
 

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 ()
 

Member Typedef Documentation

◆ Ptr

Definition at line 27 of file resource.h.

Constructor & Destructor Documentation

◆ Resource()

cyclus::Resource::Resource ( )
inline

Definition at line 29 of file resource.h.

◆ ~Resource()

virtual cyclus::Resource::~Resource ( )
inlinevirtual

Definition at line 31 of file resource.h.

Member Function Documentation

◆ Absorb()

virtual void cyclus::Resource::Absorb ( Ptr res)
inlinevirtual

To enable the Absorb method to be called on any child resource, define a null op Absorb method here.

Parameters
respointer to a resource to be absorbed by this resource

Definition at line 93 of file resource.h.

◆ BumpStateId()

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.

◆ ChangePackage()

virtual void cyclus::Resource::ChangePackage ( std::string new_package_name = Package::unpackaged_name())
inlinevirtual

Changes the product's package id.

Reimplemented in cyclus::Material, and cyclus::Product.

Definition at line 101 of file resource.h.

◆ Clone()

virtual Ptr cyclus::Resource::Clone ( ) const
pure virtual

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.

◆ Decay()

virtual void cyclus::Resource::Decay ( int curr_time)
inlinevirtual

To enable the Decay method to be called on any child resource, define a null op Decay method here.

Parameters
curr_timethe current time for the decay oepration

Reimplemented in cyclus::Material.

Definition at line 88 of file resource.h.

◆ ExtractRes()

virtual Ptr cyclus::Resource::ExtractRes ( double quantity)
pure virtual

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.

Returns
a new resource object with same state id and quantity == quantity

Implemented in cyclus::Material, and cyclus::Product.

◆ obj_id()

const int cyclus::Resource::obj_id ( ) const
inline

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.

◆ Package()

template<class T >
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.

◆ package_name()

virtual std::string cyclus::Resource::package_name ( )
inlinevirtual

Returns the package id.

Reimplemented in cyclus::Material, and cyclus::Product.

Definition at line 96 of file resource.h.

◆ PackageExtract()

virtual Ptr cyclus::Resource::PackageExtract ( double qty,
std::string new_package_name )
pure virtual

Implemented in cyclus::Material, and cyclus::Product.

◆ qual_id()

virtual int cyclus::Resource::qual_id ( ) const
pure virtual

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.

◆ quantity()

virtual double cyclus::Resource::quantity ( ) const
pure virtual

Returns the quantity of this resource with dimensions as specified by the return value of units().

Implemented in cyclus::Material, and cyclus::Product.

◆ Record()

virtual void cyclus::Resource::Record ( Context * ctx) const
pure virtual

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).

Parameters
ctxthe simulation context used to record the data.

Implemented in cyclus::Material, and cyclus::Product.

◆ state_id()

const int cyclus::Resource::state_id ( ) const
inline

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.

◆ type()

virtual const ResourceType cyclus::Resource::type ( ) const
pure virtual

A unique type/name for the concrete resource implementation.

Implemented in cyclus::Material, and cyclus::Product.

◆ units()

virtual std::string cyclus::Resource::units ( ) const
pure virtual

Returns the units this resource is based in (e.g. "kg").

Implemented in cyclus::Material, and cyclus::Product.


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