CYCLUS
Loading...
Searching...
No Matches
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:
cyclus::Resource

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 void ChangePackage (std::string new_package_name=Package::unpackaged_name())
 
virtual Resource::Ptr Clone () const
 
Product::Ptr Extract (double quantity)
 
virtual Resource::Ptr ExtractRes (double quantity)
 
virtual std::string package_name ()
 
virtual Resource::Ptr PackageExtract (double qty, std::string new_package_name=Package::unpackaged_name())
 
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
virtual void Absorb (Ptr res)
 
void BumpStateId ()
 
virtual void Decay (int curr_time)
 
const int obj_id () const
 
template<class T >
std::vector< typename T::Ptr > Package (Package::Ptr pkg)
 
 Resource ()
 
const int state_id () const
 
virtual ~Resource ()
 

Static Public Member Functions

static Ptr Create (Agent *creator, double quantity, std::string quality, std::string package_name=Package::unpackaged_name())
 
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.

Exceptions
ValueError'other' resource is of different quality

Definition at line 48 of file product.cc.

◆ ChangePackage()

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

Changes the product's package id.

Reimplemented from cyclus::Resource.

Definition at line 97 of file product.cc.

◆ Clone()

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

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 40 of file product.cc.

◆ Create()

Product::Ptr cyclus::Product::Create ( Agent * creator,
double quantity,
std::string quality,
std::string package_name = Package::unpackaged_name() )
static

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 15 of file product.cc.

◆ CreateUntracked()

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

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

Definition at line 32 of file product.cc.

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

Exceptions
ValueErrortried to extract more than exists.

Definition at line 59 of file product.cc.

◆ ExtractRes()

Resource::Ptr cyclus::Product::ExtractRes ( double quantity)
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

Implements cyclus::Resource.

Definition at line 72 of file product.cc.

◆ package_name()

std::string cyclus::Product::package_name ( )
virtual

Returns the package id.

Reimplemented from cyclus::Resource.

Definition at line 76 of file product.cc.

◆ PackageExtract()

Resource::Ptr cyclus::Product::PackageExtract ( double qty,
std::string new_package_name = Package::unpackaged_name() )
virtual

Implements cyclus::Resource.

Definition at line 80 of file product.cc.

◆ qual_id()

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

Returns 0 (for now).

Implements cyclus::Resource.

Definition at line 38 of file product.h.

◆ quality()

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

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
inlinevirtual

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
inlinevirtual

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.

Implements cyclus::Resource.

Definition at line 49 of file product.h.

◆ type()

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

Returns Product::kType.

Implements cyclus::Resource.

Definition at line 43 of file product.h.

◆ units()

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

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"
static

Definition at line 25 of file product.h.


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