CYCLUS
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:
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 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

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

Definition at line 24 of file product.h.

Member Function Documentation

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

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

Product::Ptr cyclus::Product::Create ( Agent creator,
double  quantity,
std::string  quality 
)
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 14 of file product.cc.

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

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

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

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

Returns 0 (for now).

Implements cyclus::Resource.

Definition at line 38 of file product.h.

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.

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.

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.

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

Returns Product::kType.

Implements cyclus::Resource.

Definition at line 43 of file product.h.

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

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: