/** * Add a classifier to the data structure. * @param classifier the classifier to add * @param parent the tree item under which the classifier is placed * @param addSuper add it to the base classifier folder * @param addSub add it to the derived classifier folder * @param recurse ... */ void RefactoringAssistant::addClassifier(UMLClassifier *classifier, QTreeWidgetItem *parent, bool addSuper, bool addSub, bool recurse) { if (!classifier) { uWarning() << "No classifier given - do nothing!"; return; } DEBUG(DBG_SRC) << classifier->name() << " added."; QTreeWidgetItem *classifierItem, *item; if (parent) { classifierItem = parent; } else { classifierItem = new QTreeWidgetItem(this, QStringList(classifier->name())); m_umlObjectMap[classifierItem] = classifier; } m_alreadySeen << classifier; connect(classifier, SIGNAL(modified()), this, SLOT(objectModified())); // add attributes connect(classifier, SIGNAL(attributeAdded(UMLClassifierListItem*)), this, SLOT(attributeAdded(UMLClassifierListItem*))); connect(classifier, SIGNAL(attributeRemoved(UMLClassifierListItem*)), this, SLOT(attributeRemoved(UMLClassifierListItem*))); QStringList itemTextAt; itemTextAt << i18n("Attributes") << QLatin1String("attributes"); QTreeWidgetItem *attsFolder = new QTreeWidgetItem(classifierItem, itemTextAt); attsFolder->setIcon(0, Icon_Utils::SmallIcon(Icon_Utils::it_Folder_Orange)); attsFolder->setExpanded(true); UMLAttributeList atts(classifier->getAttributeList()); foreach(UMLAttribute* att, atts) { attributeAdded(att); }
ArrayDesc inferSchema(vector<ArrayDesc> inputSchemas, shared_ptr<Query> query) { Attributes atts(1); atts[0] = AttributeDesc((AttributeID)0, "success", TID_BOOL, 0, CompressorType::NONE ); Dimensions dims(1); dims[0] = DimensionDesc("i", 0, 0, 0, 0, 1, 0); //#ifdef CPP11 return ArrayDesc("", atts, dims, defaultPartitioning(), query->getDefaultArrayResidency()); //#else //return ArrayDesc("", atts, dims); //#endif }
ArrayDesc inferSchema(std::vector< ArrayDesc> schemas, boost::shared_ptr< Query> query) { Attributes atts(1); TypeId type = schemas[0].getAttributes()[0].getType(); AttributeDesc multAttr((AttributeID)0, "matricize", type, 0, 0); atts[0] = multAttr; Dimensions const& inputDims = schemas[0].getDimensions(); Coordinate ndims = inputDims.size(); Coordinate rowmode = 0; Coordinate colmode = 1; if (_parameters.size() == 1) { rowmode = evaluate(((boost::shared_ptr<OperatorParamLogicalExpression>&)_parameters[0])->getExpression(), query, TID_INT64).getInt64(); if(rowmode < 1 || rowmode > ndims) { throw USER_EXCEPTION(SCIDB_SE_INFER_SCHEMA, SCIDB_LE_OP_MATRICIZE_ERROR1); } if(rowmode < ndims) colmode = ndims; else colmode = ndims-1; rowmode -= 1; colmode -= 1; } else { throw USER_EXCEPTION(SCIDB_SE_INFER_SCHEMA, SCIDB_LE_OP_MATRICIZE_ERROR2); } Coordinate len = 1; Coordinate chunklen = 1; for(Coordinate i=ndims-1;i>=0;i--) { if(i == rowmode) continue; len *= inputDims[i].getLength(); chunklen *= inputDims[i].getChunkInterval(); } Dimensions dims(2); dims[0] = inputDims[rowmode]; dims[1] = DimensionDesc(inputDims[rowmode].getBaseName(), 1, len, chunklen, 0, inputDims[rowmode].getType(), inputDims[rowmode].getFlags(), inputDims[rowmode].getMappingArrayName(), inputDims[rowmode].getComment()); return ArrayDesc("Matricize",atts,dims); }
bool SimEngineManager::CloneNetwork(const EngineKey &/*ek*/, int networkId, const QueryOverTimeAttributes *qatts) { engine->GetNetMgr()->CloneNetwork(networkId); #if 0 // This is a sim. We don't want query over time atts do we? if (qatts != NULL) { QueryOverTimeAttributes atts(*qatts); engine->GetNetMgr()->AddQueryOverTimeFilter(atts, networkId); } #endif return true; }
/* Call CBaBackupSessionWrapper to restart closed apps this is synchronous which will return quickly. */ void CFmServiceUtilsHandler::RestartAppsL() { if ( !iBSWrapper ) { return; } TBackupOperationAttributes atts( MBackupObserver::ETakeLock, MBackupOperationObserver::EEnd ); iBSWrapper->NotifyBackupOperationL( atts ); iBSWrapper->RestartAll(); // Get rid of the wrapper instance delete iBSWrapper; iBSWrapper = 0; }
/* Call CBaBackupSessionWrapper to close apps this is synchronous which will take a while, please call this function in thread */ void CFmServiceUtilsHandler::CloseAppsL() { if( iBSWrapper ) { delete iBSWrapper; iBSWrapper = 0; } iBSWrapper = CBaBackupSessionWrapper::NewL(); TBackupOperationAttributes atts( MBackupObserver::EReleaseLockNoAccess, MBackupOperationObserver::EStart ); iBSWrapper->NotifyBackupOperationL( atts ); iBSWrapper->CloseAll( MBackupObserver::EReleaseLockNoAccess, iStatus ); SetActive(); // Memory card formatting cannot be executed if there are open files on it. // It has been detected, that in some cases memory card using applications // have no time to close file handles before formatting is tried to be executed. // To address this issue, we need to add a delay here after client-notification // about pending format and real formatting procedure. User::After( KAppCloseTimeout ); StartWait(); }
//-------------------------------------------------------------------------------- /// Performs a result export for active project. /// /// @return 0 if calculation was successful /// 1 on error //-------------------------------------------------------------------------------- int PowerHandler::ExportCalculateResult(Application* app, const char *filename) { if (!app || !filename) { return 1; } //run a Result Export Value com_res("ComRes"); ValueGuard comRes(app->Execute("GetCaseObject", &com_res)); app->DefineTransferAttributes("ComRes", "iopt_exp,f_name"); Value atts(Value::VECTOR); atts.VecInsertInteger(4); atts.VecInsertString(filename); int ret = 0; comRes->GetDataObject()->SetAttributes(&atts, &ret); if (ret > 0) { return 1; } comRes->GetDataObject()->Execute("Execute", nullptr, &ret); return ret; }
ArrayDesc inferSchema(std::vector< ArrayDesc> schemas, boost::shared_ptr< Query> query) { assert(schemas.size() == 2); if (!hasSingleAttribute(schemas[0]) || !hasSingleAttribute(schemas[1])) throw USER_EXCEPTION(SCIDB_SE_INFER_SCHEMA, SCIDB_LE_OP_MULTIPLY_ERROR2); if (schemas[0].getDimensions().size() != 2 || schemas[1].getDimensions().size() != 2) throw USER_EXCEPTION(SCIDB_SE_INFER_SCHEMA, SCIDB_LE_OP_MULTIPLY_ERROR3); if (schemas[0].getDimensions()[0].getLength() == INFINITE_LENGTH || schemas[0].getDimensions()[1].getLength() == INFINITE_LENGTH || schemas[1].getDimensions()[0].getLength() == INFINITE_LENGTH || schemas[1].getDimensions()[1].getLength() == INFINITE_LENGTH) throw USER_EXCEPTION(SCIDB_SE_INFER_SCHEMA, SCIDB_LE_OP_MULTIPLY_ERROR4); if (schemas[0].getDimensions()[1].getLength() != schemas[1].getDimensions()[1].getLength() || schemas[0].getDimensions()[1].getStart() != schemas[1].getDimensions()[1].getStart()) throw USER_EXCEPTION(SCIDB_SE_INFER_SCHEMA, SCIDB_LE_OP_MULTIPLY_ERROR5); // FIXME: This condition needs to go away later if (schemas[0].getDimensions()[1].getChunkInterval() != schemas[1].getDimensions()[1].getChunkInterval()) throw USER_EXCEPTION(SCIDB_SE_INFER_SCHEMA, SCIDB_LE_OP_MULTIPLY_ERROR6); if (schemas[0].getAttributes()[0].getType() != schemas[1].getAttributes()[0].getType()) throw USER_EXCEPTION(SCIDB_SE_INFER_SCHEMA, SCIDB_LE_OP_MULTIPLY_ERROR7); if (schemas[0].getAttributes()[0].isNullable() || schemas[1].getAttributes()[0].isNullable()) throw USER_EXCEPTION(SCIDB_SE_INFER_SCHEMA, SCIDB_LE_OP_MULTIPLY_ERROR8); Attributes atts(1); TypeId type = schemas[0].getAttributes()[0].getType(); AttributeDesc multAttr((AttributeID)0, "multiply", type, 0, 0); atts[0] = multAttr; Dimensions dims(2); DimensionDesc const& d1 = schemas[0].getDimensions()[0]; dims[0] = DimensionDesc(d1.getBaseName(), d1.getNamesAndAliases(), d1.getStartMin(), d1.getCurrStart(), d1.getCurrEnd(), d1.getEndMax(), d1.getChunkInterval(), 0, d1.getType(), d1.getFlags(), d1.getMappingArrayName(), d1.getComment(), d1.getFuncMapOffset(), d1.getFuncMapScale()); DimensionDesc const& d2 = schemas[1].getDimensions()[0]; dims[1] = DimensionDesc(d1.getBaseName() == d2.getBaseName() ? d1.getBaseName() + "2" : d2.getBaseName(), d2.getNamesAndAliases(), d2.getStartMin(), d2.getCurrStart(), d2.getCurrEnd(), d2.getEndMax(), d2.getChunkInterval(), 0, d2.getType(), d2.getFlags(), d2.getMappingArrayName(), d2.getComment(), d2.getFuncMapOffset(), d2.getFuncMapScale()); return ArrayDesc("MultiplyRow",atts,dims); }