本文整理汇总了C++中U2OpStatus类的典型用法代码示例。如果您正苦于以下问题:C++ U2OpStatus类的具体用法?C++ U2OpStatus怎么用?C++ U2OpStatus使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了U2OpStatus类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: readQuality
static void readQuality(U2OpStatus& os, IOAdapter *io, QByteArray &sequence, int count) {
QByteArray buffArray(DocumentFormat::READ_BUFF_SIZE + 1, 0);
char* buff = buffArray.data();
// reading quality sequence, ignoring whitespace at the beginning and the end of lines
int readed = 0;
while (!io->isEof() && (readed < count)) {
bool eolnFound = false;
int readedCount = io->readUntil(buff, DocumentFormat::READ_BUFF_SIZE, TextUtils::LINE_BREAKS, IOAdapter::Term_Include, &eolnFound);
CHECK_EXT(!io->hasError(), os.setError(io->errorString()), );
CHECK_EXT(readedCount >= 0, os.setError(U2::FastqFormat::tr("Error while reading sequence")),);
QByteArray trimmed = QByteArray(buffArray.data(), readedCount);
trimmed = trimmed.trimmed();
int qualitySize = sequence.size() + trimmed.size();
if (eolnFound && (qualitySize > count)) { // read quality sequence name line, reverting back
io->skip(-readedCount);
if (io->hasError()) {
os.setError(io->errorString());
}
return;
}
sequence.append(trimmed);
CHECK_OP(os,);
}
if (io->hasError()) {
os.setError(io->errorString());
}
}
示例2: getRow
U2MsaRow MysqlMsaDbi::getRow(const U2DataId& msaId, qint64 rowId, U2OpStatus& os) {
U2MsaRow res;
MysqlTransaction t(db, os);
Q_UNUSED(t);
static const QString rowString = "SELECT sequence, gstart, gend, length FROM MsaRow WHERE msa = :msa AND rowId = :rowId";
U2SqlQuery q(rowString, db, os);
q.bindDataId(":msa", msaId);
q.bindInt64(":rowId", rowId);
if (q.step()) {
res.rowId = rowId;
res.sequenceId = q.getDataId(0, U2Type::Sequence);
res.gstart = q.getInt64(1);
res.gend = q.getInt64(2);
res.length = q.getInt64(3);
q.ensureDone();
} else if (!os.hasError()) {
os.setError(U2DbiL10n::tr("Msa row not found"));
return res;
}
static const QString gapString = "SELECT gapStart, gapEnd FROM MsaRowGap WHERE msa = :msa AND rowId = :rowId ORDER BY gapStart";
U2SqlQuery gapQ(gapString, db, os);
gapQ.bindDataId(":msa", msaId);
gapQ.bindInt64(":rowId", rowId);
while (gapQ.step()) {
U2MsaGap gap;
gap.offset = gapQ.getInt64(0);
gap.gap = gapQ.getInt64(1) - gap.offset;
res.gaps.append(gap);
}
return res;
}
示例3: getModelHeight
qint64 AssemblyModel::getModelHeight(U2OpStatus & os) {
if(NO_VAL == cachedModelHeight) {
U2AttributeDbi * attributeDbi = dbiHandle.dbi->getAttributeDbi();
if(attributeDbi != NULL) {
U2IntegerAttribute attr = U2AttributeUtils::findIntegerAttribute(attributeDbi, assembly.id, U2BaseAttributeName::max_prow, os);
LOG_OP(os);
if(attr.hasValidId()) {
if(attr.version == assembly.version) {
cachedModelHeight = attr.value;
} else if(checkPermissions(QFile::WriteUser,false)) {
U2AttributeUtils::removeAttribute(attributeDbi, attr.id, os);
LOG_OP(os);
}
}
}
if(cachedModelHeight == NO_VAL) {
// if could not get value from attribute, recompute the value...
cachedModelHeight = assemblyDbi->getMaxPackedRow(assembly.id, U2Region(0, getModelLength(os)), os);
LOG_OP(os);
if(! os.isCoR()) {
// ...and store it in a new attribure
U2IntegerAttribute attr;
U2AttributeUtils::init(attr, assembly, U2BaseAttributeName::max_prow);
attr.value = cachedModelHeight;
attributeDbi->createIntegerAttribute(attr, os);
}
}
if(cachedModelHeight == NO_VAL){
os.setError("Can't get model height, database is corrupted");
LOG_OP(os);
}
}
return cachedModelHeight;
}
示例4: id
UdrRecord::UdrRecord(const UdrRecordId &id, const QList<UdrValue> &data, U2OpStatus &os)
: id(id), data(data)
{
UdrSchemaRegistry *udrRegistry = AppContext::getUdrSchemaRegistry();
SAFE_POINT_EXT(NULL != udrRegistry, os.setError("NULL UDR registry"), );
schema = udrRegistry->getSchemaById(id.getSchemaId());
SAFE_POINT_EXT(NULL != schema, os.setError("Unknown schema id: " + QString(id.getSchemaId())), );
}
示例5: os
Peak2GeneFormatLoader::Peak2GeneFormatLoader(U2OpStatus &os, IOAdapter *ioAdapter) :
os(os),
ioAdapter(ioAdapter),
skipLine(false),
currentLineNumber(0)
{
CHECK_EXT(NULL != ioAdapter, os.setError(L10N::nullPointerError("IO adapter")), );
CHECK_EXT(ioAdapter->isOpen(), os.setError(L10N::errorReadingFile(ioAdapter->getURL())), );
}
示例6: errorLoggingBreak
static bool errorLoggingBreak(U2OpStatus& os, QMap<QString, QString>& skippedLines, const QString& seqName){
if (os.isCoR()){
if (skippedLines.size() < SKIPPED_LINES_ERRORS_LIMIT){
skippedLines.insert(seqName, os.getError());
}
return true;
}
return false;
}
示例7: getValidClickedActionId
int SampleActionsManager::getValidClickedActionId(U2OpStatus &os) const {
QAction *a = qobject_cast<QAction*>(sender());
CHECK_EXT(NULL != a, os.setError(L10N::internalError("Unexpected method call")), -1);
bool ok = false;
int id = a->property(ID_PROPERTY).toInt(&ok);
CHECK_EXT(ok, os.setError(L10N::internalError("Wrong action ID")), -1);
CHECK_EXT(id >=0 && id < actions.size(), os.setError(L10N::internalError("Out of range action ID")), -1);
return id;
}
示例8: checkType
bool UdrValue::checkType(UdrSchema::DataType askedDataType, U2OpStatus &os) const {
if (isNull) {
os.setError("NULL value");
return false;
}
if (dataType != askedDataType) {
os.setError("Type mismatch");
return false;
}
return true;
}
示例9: defineSettings
CreateSubalignmentSettings FormatsMsaClipboardTask::defineSettings(const QStringList& names, const U2Region &window, const DocumentFormatId &formatId, U2OpStatus& os){
//Create temporal document for the workflow run task
const AppSettings* appSettings = AppContext::getAppSettings();
SAFE_POINT_EXT(NULL != appSettings, os.setError(tr("Invalid applications settings detected")), CreateSubalignmentSettings());
UserAppsSettings* usersSettings = appSettings->getUserAppsSettings();
SAFE_POINT_EXT(NULL != usersSettings, os.setError(tr("Invalid users applications settings detected")), CreateSubalignmentSettings());
const QString tmpDirPath = usersSettings->getCurrentProcessTemporaryDirPath();
GUrl path = GUrlUtils::prepareTmpFileLocation(tmpDirPath, "clipboard", "tmp", os);
return CreateSubalignmentSettings(window, names, path, true, false, formatId);
}
示例10: getMsaAlphabet
U2AlphabetId MysqlMsaDbi::getMsaAlphabet(const U2DataId& msaId, U2OpStatus& os) {
QString alphabetName;
U2SqlQuery q("SELECT alphabet FROM Msa WHERE object = :object", db, os);
q.bindDataId(":object", msaId);
if (q.step()) {
alphabetName = q.getString(0);
q.ensureDone();
} else if (!os.hasError()) {
os.setError(U2DbiL10n::tr("Msa object not found"));
}
return U2AlphabetId(alphabetName);
}
示例11: getNumOfRows
qint64 MysqlMsaDbi::getNumOfRows(const U2DataId& msaId, U2OpStatus& os) {
qint64 res = 0;
static const QString queryString = "SELECT numOfRows FROM Msa WHERE object = :object";
U2SqlQuery q(queryString, db, os);
q.bindDataId(":object", msaId);
if (q.step()) {
res = q.getInt64(0);
q.ensureDone();
} else if (!os.hasError()) {
os.setError(U2DbiL10n::tr("Msa object not found"));
}
return res;
}
示例12: read
int SQLiteBlobInputStream::read(char *buffer, int length, U2OpStatus &os) {
SAFE_POINT_EXT(NULL != handle, os.setError("blob handle is not opened"), 0);
int targetLength = (offset + length < size) ? length : (size - offset);
if (0 == targetLength) {
return -1;
}
int status = sqlite3_blob_read(handle, (void*)buffer, targetLength, offset);
if (SQLITE_OK != status) {
os.setError(QObject::tr("Can not read data. The database is closed or the data were changed."));
return 0;
}
offset += targetLength;
return targetLength;
}
示例13: getSequenceData
QByteArray SQLiteSequenceDbi::getSequenceData(const U2DataId& sequenceId, const U2Region& region, U2OpStatus& os) {
try {
QByteArray res;
if (0 == region.length) {
return res;
} else if (U2_REGION_MAX != region) {
res.reserve(region.length);
}
// Get all chunks that intersect the region
SQLiteReadQuery q("SELECT sstart, send, data FROM SequenceData WHERE sequence = ?1 "
"AND (send >= ?2 AND sstart < ?3) ORDER BY sstart", db, os);
q.bindDataId(1, sequenceId);
q.bindInt64(2, region.startPos);
q.bindInt64(3, region.endPos());
qint64 pos = region.startPos;
qint64 regionLengthToRead = region.length;
while (q.step()) {
qint64 sstart = q.getInt64(0);
qint64 send = q.getInt64(1);
qint64 length = send - sstart;
QByteArray data = q.getBlob(2);
int copyStart = pos - sstart;
int copyLength = static_cast<int>(qMin(regionLengthToRead, length - copyStart));
res.append(data.constData() + copyStart, copyLength);
pos += copyLength;
regionLengthToRead -= copyLength;
SAFE_POINT_EXT(regionLengthToRead >= 0,
os.setError("An error occurred during reading sequence data from dbi."),
QByteArray());
}
return res;
} catch (const std::bad_alloc &) {
#ifdef UGENE_X86
os.setError("UGENE ran out of memory during the sequence processing. "
"The 32-bit UGENE version has a restriction on its memory consumption. Try using the 64-bit version instead.");
#else
os.setError("Out of memory during the sequence processing.");
#endif
return QByteArray();
} catch (...) {
os.setError("Internal error occurred during the sequence processing.");
coreLog.error("An exception was thrown during reading sequence data from dbi.");
return QByteArray();
}
}
示例14: toByteArray
QByteArray MultipleSequenceAlignmentRowData::toByteArray(U2OpStatus &os, qint64 length) const {
if (length < getCoreEnd()) {
coreLog.trace("Incorrect length was passed to MultipleSequenceAlignmentRowData::toByteArray");
os.setError("Failed to get row data");
return QByteArray();
}
if (gaps.isEmpty() && sequence.length() == length) {
return sequence.constSequence();
}
QByteArray bytes = joinCharsAndGaps(true, true);
// Append additional gaps, if necessary
if (length > bytes.count()) {
QByteArray gapsBytes;
gapsBytes.fill(U2Msa::GAP_CHAR, length - bytes.count());
bytes.append(gapsBytes);
}
if (length < bytes.count()) {
// cut extra trailing gaps
bytes = bytes.left(length);
}
return bytes;
}
示例15: getVariantTrack
U2VariantTrack MysqlVariantDbi::getVariantTrack(const U2DataId& variantTrackId, U2OpStatus& os) {
U2VariantTrack res;
DBI_TYPE_CHECK(variantTrackId, U2Type::VariantTrack, os, res);
MysqlTransaction t(db, os);
Q_UNUSED(t);
dbi->getMysqlObjectDbi()->getObject(res, variantTrackId, os);
CHECK_OP(os, res);
static const QString queryString = "SELECT sequence, sequenceName, trackType, fileHeader FROM VariantTrack WHERE object = :object";
U2SqlQuery q(queryString, db, os);
q.bindDataId(":object", variantTrackId);
if (q.step()) {
res.sequence = q.getDataId(0, U2Type::Sequence);
res.sequenceName = q.getString(1);
int trackType = q.getInt32(2);
CHECK_EXT(TrackType_FIRST <= trackType && trackType <= TrackType_LAST,
os.setError(U2DbiL10n::tr("Invalid variant track type: %1").arg(trackType)), res);
res.trackType = static_cast<VariantTrackType>(trackType);
res.fileHeader = q.getString(3);
q.ensureDone();
}
return res;
}