CYCLUS
Public Types | Public Member Functions | List of all members
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 19 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

void BumpStateId ()
 
virtual Ptr Clone () const =0
 
virtual Ptr ExtractRes (double quantity)=0
 
const int obj_id () const
 
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

typedef boost::shared_ptr<Resource> cyclus::Resource::Ptr

Definition at line 24 of file resource.h.

Constructor & Destructor Documentation

cyclus::Resource::Resource ( )
inline

Definition at line 26 of file resource.h.

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

Definition at line 28 of file resource.h.

Member Function Documentation

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.

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.

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.

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 33 of file resource.h.

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.

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.

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.

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 39 of file resource.h.

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.

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: