33 (
"load",
"loads", MetaCategory::ControllerDefault,
writer);
35 "load",
"load",
true,Object::createDefault<Load>
45 x.
addMethod(
"toXML",
toXML, METH_VARARGS,
"return a XML representation");
53 bool firstload =
true;
55 for (Operation::loadlist::const_iterator j = i->getLoads().begin(); j != i->getLoads().end(); ++j)
79 throw DataException(
"Missing operation and resource on a load");
81 throw DataException(
"Missing operation on a load on resource '"
84 throw DataException(
"Missing resource on a load on operation '"
90 Operation::loadlist::const_iterator i = oper->
getLoads().begin();
91 for (; i != oper->
getLoads().end(); ++i)
92 if (i->getResource() == res
104 + res->
getName() +
"' already exists");
111 if (i == oper->
getLoads().end())
break;
145 if (j->getLoad() ==
this) j.deleteLoadPlan();
159 unsigned short cnt = 0;
160 int minprio = INT_MAX;
161 Load* newLeader = NULL;
164 if (i->altLoad ==
this)
167 if (i->priority < minprio)
177 newLeader->altLoad = NULL;
181 newLeader->hasAlts =
true;
182 newLeader->altLoad = NULL;
185 if (i->altLoad ==
this) i->altLoad = newLeader;
193 bool only_one =
true;
194 for (Operation::loadlist::iterator i =
getOperation()->loaddata.begin();
196 if (i->altLoad == altLoad)
201 if (only_one) altLoad->hasAlts =
false;
211 if (hasAlts || f->altLoad)
212 throw DataException(
"Nested alternate loads are not allowed");
223 throw LogicException(
"Can't set an alternate load before setting the operation");
225 if (!x)
throw DataException(
"Can't find load with name '" + n +
"'");
238 for (Operation::loadlist::iterator i =
getOperation()->loaddata.begin();
240 if (&*i !=
this && !i->setup.empty()
243 throw DataException(
"Only a single load of an operation can specify a setup");
313 else throw LogicException(
"Incorrect object type during read operation");
319 else throw LogicException(
"Incorrect object type during read operation");
348 else throw LogicException(
"Incorrect object type during read operation");
439 Load *y =
static_cast<Load*
>(
static_cast<PyObject*
>(field));
454 Skill* y =
static_cast<Skill*
>(
static_cast<PyObject*
>(field));
464 PyObject* Load::create(PyTypeObject* pytype, PyObject* args, PyObject* kwds)
469 PyObject* oper = PyDict_GetItemString(kwds,
"operation");
471 throw DataException(
"load operation must be of type operation");
474 PyObject* res = PyDict_GetItemString(kwds,
"resource");
476 throw DataException(
"load resource must be of type resource");
479 PyObject* q1 = PyDict_GetItemString(kwds,
"quantity");
484 PyObject* eff_start = PyDict_GetItemString(kwds,
"effective_start");
490 PyObject* eff_end = PyDict_GetItemString(kwds,
"effective_end");
499 static_cast<Operation*>(oper),
500 static_cast<Resource*>(res),
506 return static_cast<PyObject*
>(l);
510 PythonType::evalException();
521 x.
setDoc(
"frePPLe iterator for loads");
527 PyObject* LoadIterator::iternext()
533 if (ir == res->getLoads().end())
return NULL;
534 result =
const_cast<Load*
>(&*ir);
540 if (io == oper->getLoads().end())
return NULL;
541 result =
const_cast<Load*
>(&*io);