35 (
"flow",
"flows", MetaCategory::ControllerDefault,
writer);
37 Object::createDefault<FlowStart>,
true);
39 Object::createDefault<FlowEnd>);
48 x.
addMethod(
"toXML",
toXML, METH_VARARGS,
"return a XML representation");
56 bool firstflow =
true;
82 throw DataException(
"Missing operation and buffer on a flow");
84 throw DataException(
"Missing operation on a flow with buffer '"
87 throw DataException(
"Missing buffer on a flow with operation '"
93 Operation::flowlist::const_iterator i = oper->
getFlows().
begin();
95 if (i->getBuffer() == buf
106 buf->
getName() +
"' already exists");
142 if (j->getFlow() ==
this) j.deleteFlowPlan();
156 unsigned short cnt = 0;
157 int minprio = INT_MAX;
158 Flow* newLeader = NULL;
161 if (i->altFlow ==
this)
164 if (i->priority < minprio)
174 newLeader->altFlow = NULL;
178 newLeader->hasAlts =
true;
179 newLeader->altFlow = NULL;
182 if (i->altFlow ==
this) i->altFlow = newLeader;
190 bool only_one =
true;
193 if (i->altFlow == altFlow)
198 if (only_one) altFlow->hasAlts =
false;
208 if (hasAlts || f->altFlow)
209 throw DataException(
"Nested alternate flows are not allowed");
211 throw DataException(
"Only consuming alternate flows are supported");
222 throw LogicException(
"Can't set an alternate flow before setting the operation");
224 if (!x)
throw DataException(
"Can't find flow with name '" + n +
"'");
282 else throw LogicException(
"Incorrect object type during read operation");
288 else throw LogicException(
"Incorrect object type during read operation");
357 if (getEffective().getStart() != Date::infinitePast)
359 if (getEffective().getEnd() != Date::infiniteFuture)
406 Buffer* y =
static_cast<Buffer*
>(
static_cast<PyObject*
>(field));
416 Operation* y =
static_cast<Operation*
>(
static_cast<PyObject*
>(field));
435 Flow *y =
static_cast<Flow*
>(
static_cast<PyObject*
>(field));
448 PyObject* Flow::create(PyTypeObject* pytype, PyObject* args, PyObject* kwds)
453 PyObject* oper = PyDict_GetItemString(kwds,
"operation");
455 throw DataException(
"flow operation must be of type operation");
458 PyObject* buf = PyDict_GetItemString(kwds,
"buffer");
463 PyObject* q1 = PyDict_GetItemString(kwds,
"quantity");
468 PyObject* eff_start = PyDict_GetItemString(kwds,
"effective_start");
474 PyObject* eff_end = PyDict_GetItemString(kwds,
"effective_end");
483 PyObject* t = PyDict_GetItemString(kwds,
"type");
487 if (d.getString() ==
"flow_end")
489 static_cast<Operation*>(oper),
490 static_cast<Buffer*
>(buf),
495 static_cast<Operation*>(oper),
496 static_cast<Buffer*>(buf),
502 static_cast<Operation*>(oper),
503 static_cast<Buffer*>(buf),
509 return static_cast<PyObject*
>(l);
513 PythonType::evalException();
524 x.
setDoc(
"frePPLe iterator for flows");
530 PyObject* FlowIterator::iternext()
536 if (ib == buf->getFlows().end())
return NULL;
537 result =
const_cast<Flow*
>(&*ib);
543 if (io == oper->getFlows().end())
return NULL;
544 result =
const_cast<Flow*
>(&*io);