Public Types | Public Member Functions | Static Public Member Functions | Static Public Attributes | List of all members
cyclus::Product Class Reference

Detailed Description

A Product is a general type of resource in the Cyclus simulation, and is a catch-all for non-standard resources.

It implements the Resource class interface in a simple way usable for things such as: bananas, man-hours, water, buying power, etc.

Definition at line 18 of file product.h.

#include <product.h>

Inheritance diagram for cyclus::Product:
Inheritance graph

Public Types

typedef boost::shared_ptr< ProductPtr
- Public Types inherited from cyclus::Resource
typedef boost::shared_ptr< ResourcePtr

Public Member Functions

void Absorb (Product::Ptr other)
virtual Resource::Ptr Clone () const
Product::Ptr Extract (double quantity)
virtual Resource::Ptr ExtractRes (double quantity)
virtual int qual_id () const
virtual const std::string & quality () const
virtual double quantity () const
virtual void Record (Context *ctx) const
virtual const ResourceType type () const
virtual std::string units () const
- Public Member Functions inherited from cyclus::Resource
void BumpStateId ()
const int obj_id () const
 Resource ()
const int state_id () const
virtual ~Resource ()

Static Public Member Functions

static Ptr Create (Agent *creator, double quantity, std::string quality)
static Ptr CreateUntracked (double quantity, std::string quality)

Static Public Attributes

static const ResourceType kType = "Product"

Member Typedef Documentation

◆ Ptr

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

Definition at line 24 of file product.h.

Member Function Documentation

◆ Absorb()

void cyclus::Product::Absorb ( Product::Ptr  other)

Absorbs the contents of the given 'other' resource into this resource.

ValueError'other' resource is of different quality

Definition at line 47 of file

◆ Clone()

Resource::Ptr cyclus::Product::Clone ( ) const

Returns an untracked (not part of the simulation) copy of the resource.

A cloned resource should never record anything in the output database.

Implements cyclus::Resource.

Definition at line 39 of file

◆ Create()

Product::Ptr cyclus::Product::Create ( Agent creator,
double  quantity,
std::string  quality 

Creates a new product that is "live" and tracked.

creator is a pointer to the agent creating the resource (usually will be the caller's "this" pointer). All future output data recorded will be done using the creator's context.

Definition at line 14 of file

◆ CreateUntracked()

Product::Ptr cyclus::Product::CreateUntracked ( double  quantity,
std::string  quality 

Creates a new product that does not actually exist as part of the simulation and is untracked.

Definition at line 31 of file

◆ Extract()

Product::Ptr cyclus::Product::Extract ( double  quantity)

Extracts the specified mass from this resource and returns it as a new product object with the same quality/type.

ValueErrortried to extract more than exists.

Definition at line 58 of file

◆ ExtractRes()

Resource::Ptr cyclus::Product::ExtractRes ( double  quantity)

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.

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

Implements cyclus::Resource.

Definition at line 71 of file

◆ qual_id()

virtual int cyclus::Product::qual_id ( ) const

Returns 0 (for now).

Implements cyclus::Resource.

Definition at line 38 of file product.h.

◆ quality()

virtual const std::string& cyclus::Product::quality ( ) const

Returns the quality of this resource (e.g. bananas, human labor, water, etc.).

Definition at line 58 of file product.h.

◆ quantity()

virtual double cyclus::Product::quantity ( ) const

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

Implements cyclus::Resource.

Definition at line 53 of file product.h.

◆ Record()

virtual void cyclus::Product::Record ( Context ctx) const

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

ctxthe simulation context used to record the data.

Implements cyclus::Resource.

Definition at line 49 of file product.h.

◆ type()

virtual const ResourceType cyclus::Product::type ( ) const

Returns Product::kType.

Implements cyclus::Resource.

Definition at line 43 of file product.h.

◆ units()

virtual std::string cyclus::Product::units ( ) const

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

Implements cyclus::Resource.

Definition at line 51 of file product.h.

Member Data Documentation

◆ kType

const ResourceType cyclus::Product::kType = "Product"

Definition at line 25 of file product.h.

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