本文整理汇总了C++中Operation::setName方法的典型用法代码示例。如果您正苦于以下问题:C++ Operation::setName方法的具体用法?C++ Operation::setName怎么用?C++ Operation::setName使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Operation
的用法示例。
在下文中一共展示了Operation::setName方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: setData
// For editing
bool OperationModel::setData( const QModelIndex &index, const QVariant &value, int role)
{
qDebug() << "setData(), index" << index << "role" << role;
if (index.isValid()) {
int row = index.row();
if (row >= 0 && row < m_items.count()) {
Operation* item = m_items[row];
if (role == SetIndexRole){
item->setIndex(value.toInt());
return true;
} else if (role == SetNameRole) {
item->setName(value.toString());
return true;
} else if (role == SetLastDateRole) {
item->setLastDate(value.toDate());
return true;
} else if (role == SetBonsaiIdRole) {
item->setBonsaiId(value.toInt());
return true;
} else {
return false;
}
} else {
return false;
}
} else {
return false;
}
return false;
}
示例2: getOperation
DECLARE_EXPORT Operation* BufferProcure::getOperation() const
{
if (!oper)
{
Operation *o = Operation::find(PURCHASE_OPERATION);
if (!o)
{
// Create a new purchase operation
o = new OperationFixedTime();
o->setName(PURCHASE_OPERATION);
static_cast<OperationFixedTime*>(o)->setDuration(leadtime);
new FlowEnd(o, const_cast<BufferProcure*>(this), 1);
}
// Copy procurement parameters to the existing operation
if (o->getType() == *OperationFixedTime::metadata)
static_cast<OperationFixedTime*>(o)->setDuration(leadtime);
const_cast<BufferProcure*>(this)->oper = o;
o->setFence(getFence());
o->setSizeMaximum(getSizeMaximum());
o->setSizeMinimum(getSizeMinimum());
o->setSizeMultiple(getSizeMultiple());
if (!o->getLocation()) o->setLocation(getLocation());
o->setSource(getSource());
}
return oper;
}
示例3: setOnHand
DECLARE_EXPORT void Buffer::setOnHand(double f)
{
// The dummy operation to model the inventory may need to be created
Operation *o = Operation::find(INVENTORY_OPERATION);
Flow *fl;
if (!o)
{
// Create a fixed time operation with zero leadtime, hidden from the xml
// output, hidden for the solver, and without problem detection.
o = new OperationFixedTime();
o->setName(INVENTORY_OPERATION);
o->setHidden(true);
o->setDetectProblems(false);
fl = new FlowEnd(o, this, 1);
}
else
// Find the flow of this operation
fl = const_cast<Flow*>(&*(o->getFlows().begin()));
// Check valid pointers
if (!fl || !o)
throw LogicException("Failed creating inventory operation for '"
+ getName() + "'");
// Make sure the sign of the flow is correct: +1 or -1.
fl->setQuantity(f>=0.0 ? 1.0 : -1.0);
// Create a dummy operationplan on the inventory operation
OperationPlan::iterator i(o);
if (i == OperationPlan::end())
{
// No operationplan exists yet
OperationPlan *opplan = o->createOperationPlan(
fabs(f), Date::infinitePast, Date::infinitePast);
opplan->setLocked(true);
opplan->activate();
}
else
{
// Update the existing operationplan
i->setLocked(false);
i->setQuantity(fabs(f));
i->setLocked(true);
}
setChanged();
}