1#line 1 "/cycamore/src/deploy_inst.cc"
8 : cyclus::Institution(ctx),
16 cyclus::Institution::Build(parent);
17 BuildSched::iterator it;
18 std::set<std::string> protos;
26 cyclus::Agent* a = context()->CreateAgent<Agent>(proto);
31 ss <<
"_life_forever";
36 if (protos.count(proto) == 0) {
38 context()->AddPrototype(proto, a);
44 for (
int j = 0; j <
n_build[i]; j++) {
45 context()->SchedBuild(
this, proto, t);
51 cyclus::Institution::EnterNotify();
55 ss <<
"prototype '" << prototype() <<
"' has " <<
build_times.size()
56 <<
" build_times vals, expected " << n;
57 throw cyclus::ValueError(ss.str());
58 }
else if (
n_build.size() != n) {
60 ss <<
"prototype '" << prototype() <<
"' has " <<
n_build.size()
61 <<
" n_build vals, expected " << n;
62 throw cyclus::ValueError(ss.str());
65 ss <<
"prototype '" << prototype() <<
"' has " <<
lifetimes.size()
66 <<
" lifetimes vals, expected " << n;
67 throw cyclus::ValueError(ss.str());
81 using cyclus::toolkit::CommodityProducer;
82 using cyclus::toolkit::CommodityProducerManager;
84 CommodityProducer* cp_cast =
dynamic_cast<CommodityProducer*
>(a);
85 if (cp_cast != NULL) {
86 LOG(cyclus::LEV_INFO3,
"mani") <<
"Registering agent "
87 << a->prototype() << a->id()
88 <<
" as a commodity producer.";
89 CommodityProducerManager::Register(cp_cast);
94 using cyclus::toolkit::CommodityProducer;
95 using cyclus::toolkit::CommodityProducerManager;
97 CommodityProducer* cp_cast =
dynamic_cast<CommodityProducer*
>(a);
99 CommodityProducerManager::Unregister(cp_cast);
104 cyclus::toolkit::CommodityProducer* producer) {
106 set<cyclus::toolkit::Commodity,
107 cyclus::toolkit::CommodityCompare> commodities =
108 producer->ProducedCommodities();
109 set<cyclus::toolkit::Commodity, cyclus::toolkit::CommodityCompare>::
112 LOG(cyclus::LEV_DEBUG3,
"maninst") <<
" Clone produces " << commodities.size()
114 for (it = commodities.begin(); it != commodities.end(); it++) {
115 LOG(cyclus::LEV_DEBUG3,
"maninst") <<
" Commodity produced: " << it->name();
116 LOG(cyclus::LEV_DEBUG3,
"maninst") <<
" capacity: " <<
117 producer->Capacity(*it);
118 LOG(cyclus::LEV_DEBUG3,
"maninst") <<
" cost: " <<
124 std::string specification = this->spec();
126 ->NewDatum(
"AgentPosition")
127 ->AddVal(
"Spec", specification)
128 ->AddVal(
"Prototype", this->prototype())
129 ->AddVal(
"AgentId",
id())
void WriteProducerInformation(cyclus::toolkit::CommodityProducer *producer)
write information about a commodity producer to a stream
std::vector< int > n_build
void Unregister_(cyclus::Agent *agent)
unregister a child
void RecordPosition()
Records an agent's latitude and longitude to the output db.
virtual void EnterNotify()
DeployInst(cyclus::Context *ctx)
virtual void DecomNotify(Agent *m)
void Register_(cyclus::Agent *agent)
register a child
virtual void Build(cyclus::Agent *parent)
std::vector< int > build_times
std::vector< std::string > prototypes
std::vector< int > lifetimes
virtual void BuildNotify(Agent *m)
cyclus::Agent * ConstructDeployInst(cyclus::Context *ctx)
cyclus::toolkit::Position coordinates