CYCLUS
Loading...
Searching...
No Matches
res_tracker.h
Go to the documentation of this file.
1
#ifndef CYCLUS_SRC_RES_TRACKER_H_
2
#define CYCLUS_SRC_RES_TRACKER_H_
3
4
#include <string>
5
#include <vector>
6
7
#include "
context.h
"
8
#include "
resource.h
"
9
10
namespace
cyclus
{
11
12
/// Tracks and records the state and parent-child relationships of resources as
13
/// they are changed. Resource implementations embed this as a member variable
14
/// and invoke its methods appropriately to have their state changes tracked in
15
/// the canonical core resource table.
16
///
17
/// Invocations to Create, Extract, Absorb, and Modify result in one or more
18
/// entries in the output db Resource table and also call the Record method of
19
/// the tracker's tracked resource. A zero parent id indicates a resource id
20
/// has no parent; if both are zeros the resource was newly created.
21
class
ResTracker
{
22
public
:
23
/// Create a new tracker following r.
24
ResTracker
(
Context
* ctx,
Resource
*
r
);
25
26
/// Prevent a resource's heritage from being tracked and recorded.
27
void
DontTrack
();
28
29
/// Should be called when a resource instance is newly created.
30
void
Create
(
Agent
*
creator
);
31
32
/// Should be called when a resource has some quantity removed from it (e.g.
33
/// resource is split).
34
/// @param removed the tracker of the extracted/removed resource.
35
void
Extract
(
ResTracker
*
removed
);
36
37
/// Should be called when a resource is combined with another.
38
/// @param absorbed the tracker of the resource being absorbed.
39
void
Absorb
(
ResTracker
*
absorbed
);
40
41
/// Should be called when the state of a resource changes (e.g. radioactive
42
/// decay).
43
void
Modify
();
44
45
/// Should be called when a resource's package gets modified. If the resource
46
/// was just created from a parent resource, the parent should be passed in.
47
/// If the resource is just being repackaged (e.g. to unpackaged), the parent
48
/// should be NULL.
49
void
Package
(
ResTracker
* parent =
NULL
);
50
51
private
:
52
void
Record(
bool
bumpId
=
true
);
53
54
int
parent1_;
55
int
parent2_;
56
bool
tracked_;
57
std::string package_name_;
58
Resource
* res_;
59
Context
* ctx_;
60
};
61
62
}
// namespace cyclus
63
64
#endif
// CYCLUS_SRC_RES_TRACKER_H_
cyclus::Agent
The abstract base class used by all types of agents that live and interact in a simulation.
Definition
agent.h:49
cyclus::Context
A simulation context provides access to necessary simulation-global functions and state.
Definition
context.h:145
cyclus::ResTracker
Tracks and records the state and parent-child relationships of resources as they are changed.
Definition
res_tracker.h:21
cyclus::ResTracker::Create
void Create(Agent *creator)
Should be called when a resource instance is newly created.
Definition
res_tracker.cc:19
cyclus::ResTracker::Modify
void Modify()
Should be called when the state of a resource changes (e.g.
Definition
res_tracker.cc:34
cyclus::ResTracker::Extract
void Extract(ResTracker *removed)
Should be called when a resource has some quantity removed from it (e.g.
Definition
res_tracker.cc:44
cyclus::ResTracker::Package
void Package(ResTracker *parent=NULL)
Should be called when a resource's package gets modified.
Definition
res_tracker.cc:77
cyclus::ResTracker::Absorb
void Absorb(ResTracker *absorbed)
Should be called when a resource is combined with another.
Definition
res_tracker.cc:67
cyclus::ResTracker::ResTracker
ResTracker(Context *ctx, Resource *r)
Create a new tracker following r.
Definition
res_tracker.cc:8
cyclus::ResTracker::DontTrack
void DontTrack()
Prevent a resource's heritage from being tracked and recorded.
Definition
res_tracker.cc:15
cyclus::Resource
Resource defines an abstract interface implemented by types that are offered, requested,...
Definition
resource.h:22
context.h
cyclus
taken directly from OsiSolverInterface.cpp on 2/17/14 from https://projects.coin-or....
Definition
agent.cc:14
cyclus::OptionalQuery
T OptionalQuery(InfileTree *tree, std::string query, T default_val)
a query method for optional parameters
Definition
infile_tree.h:121
resource.h
src
res_tracker.h
Generated by
1.10.0