37 (
"flow",
"flows", MetaCategory::ControllerDefault,
writer);
39 Object::createDefault<FlowStart>,
true);
41 Object::createDefault<FlowEnd>);
43 Object::createDefault<FlowFixedStart>);
45 Object::createDefault<FlowFixedEnd>);
54 x.
addMethod(
"toXML",
toXML, METH_VARARGS,
"return a XML representation");
62 bool firstflow =
true;
88 throw DataException(
"Missing operation and buffer on a flow");
90 throw DataException(
"Missing operation on a flow with buffer '"
93 throw DataException(
"Missing buffer on a flow with operation '"
100 Operation::flowlist::const_iterator i = oper->
getFlows().
begin();
102 if (i->getBuffer() == buf
114 buf->
getName() +
"' already exists");
150 if (j->getFlow() ==
this) j.deleteFlowPlan();
164 unsigned short cnt = 0;
165 int minprio = INT_MAX;
166 Flow* newLeader = NULL;
169 if (i->altFlow ==
this)
172 if (i->priority < minprio)
182 newLeader->altFlow = NULL;
186 newLeader->hasAlts =
true;
187 newLeader->altFlow = NULL;
190 if (i->altFlow ==
this) i->altFlow = newLeader;
198 bool only_one =
true;
201 if (i->altFlow == altFlow)
206 if (only_one) altFlow->hasAlts =
false;
216 if (hasAlts || f->altFlow)
217 throw DataException(
"Nested alternate flows are not allowed");
219 throw DataException(
"Only consuming alternate flows are supported");
230 throw LogicException(
"Can't set an alternate flow before setting the operation");
232 if (!x)
throw DataException(
"Can't find flow with name '" + n +
"'");
290 else throw LogicException(
"Incorrect object type during read operation");
296 else throw LogicException(
"Incorrect object type during read operation");
365 if (getEffective().getStart() != Date::infinitePast)
367 if (getEffective().getEnd() != Date::infiniteFuture)
414 Buffer* y =
static_cast<Buffer*
>(
static_cast<PyObject*
>(field));
424 Operation* y =
static_cast<Operation*
>(
static_cast<PyObject*
>(field));
443 Flow *y =
static_cast<Flow*
>(
static_cast<PyObject*
>(field));
456 PyObject* Flow::create(PyTypeObject* pytype, PyObject* args, PyObject* kwds)
461 PyObject* oper = PyDict_GetItemString(kwds,
"operation");
463 throw DataException(
"flow operation must be of type operation");
466 PyObject* buf = PyDict_GetItemString(kwds,
"buffer");
471 PyObject* q1 = PyDict_GetItemString(kwds,
"quantity");
476 PyObject* eff_start = PyDict_GetItemString(kwds,
"effective_start");
482 PyObject* eff_end = PyDict_GetItemString(kwds,
"effective_end");
491 PyObject* t = PyDict_GetItemString(kwds,
"type");
495 if (d.getString() ==
"flow_end")
497 static_cast<Operation*>(oper),
498 static_cast<Buffer*
>(buf),
501 else if (d.getString() ==
"flow_fixed_end")
502 l =
new FlowFixedEnd(
503 static_cast<Operation*>(oper),
504 static_cast<Buffer*
>(buf),
507 else if (d.getString() ==
"flow_fixed_start")
508 l =
new FlowFixedStart(
509 static_cast<Operation*>(oper),
510 static_cast<Buffer*
>(buf),
515 static_cast<Operation*>(oper),
516 static_cast<Buffer*>(buf),
522 static_cast<Operation*>(oper),
523 static_cast<Buffer*>(buf),
529 return static_cast<PyObject*
>(l);
533 PythonType::evalException();
544 x.
setDoc(
"frePPLe iterator for flows");
550 PyObject* FlowIterator::iternext()
556 if (ib == buf->getFlows().end())
return NULL;
557 result =
const_cast<Flow*
>(&*ib);
563 if (io == oper->getFlows().end())
return NULL;
564 result =
const_cast<Flow*
>(&*io);