• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

C++ NCBI_THROW函数代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了C++中NCBI_THROW函数的典型用法代码示例。如果您正苦于以下问题:C++ NCBI_THROW函数的具体用法?C++ NCBI_THROW怎么用?C++ NCBI_THROW使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。



在下文中一共展示了NCBI_THROW函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C++代码示例。

示例1: se

//  --------------------------------------------------------------------------
CSeq_entry_Handle CAsn2FastaApp::ObtainSeqEntryFromSeqEntry(
    CObjectIStream& is)
//  --------------------------------------------------------------------------
{
    try {
        CRef<CSeq_entry> se(new CSeq_entry);
        is >> *se;
        if (se->Which() == CSeq_entry::e_not_set) {
            NCBI_THROW(CException, eUnknown,
                       "provided Seq-entry is empty");
        }
        return m_Scope->AddTopLevelSeqEntry(*se);
    }
    catch (CException& e) {
        if (! (is.GetFailFlags() & is.eEOF)) {
            ERR_POST(Error << e);
        }
    }
    return CSeq_entry_Handle();
}
开发者ID:jackgopack4,项目名称:pico-blast,代码行数:21,代码来源:asn2fasta.cpp


示例2: s_SearchSortedArray

bool CGeneInfoFileReader::x_GiToGeneId(int gi, list<int>& listGeneIds)
{
    STwoIntRecord* pRecs;
    int nRecs;
    bool retval = false;
    if (s_GetMemFilePtrAndLength(m_memGi2GeneFile.get(),
                                 pRecs, nRecs))
    {
        retval = s_SearchSortedArray(pRecs, nRecs,
                                   gi, 1, listGeneIds, false);
    }
    else
    {
        NCBI_THROW(CGeneInfoException, eFileNotFoundError,
            "Cannot access the memory-mapped file for "
            "Gi to Gene ID conversion.");
    }

    return retval;
}
开发者ID:swuecho,项目名称:igblast,代码行数:20,代码来源:gene_info_reader.cpp


示例3: if

bool CJsonOverUTTPReader::x_AddNewNode(CJsonNode::TInstance new_node)
{
    if (!m_CurrentNode) {
        m_CurrentNode = new_node;
        return false;
    } else if (m_HashValueIsExpected) {
        m_HashValueIsExpected = false;
        m_CurrentNode.SetByKey(m_HashKey, new_node);
    } else
        // The current node is either a JSON object or an array,
        // because if it was a non-container node then this method
        // wouldn't have been called.
        if (m_CurrentNode.IsArray())
            m_CurrentNode.Append(new_node);
        else {
            NCBI_THROW(CJsonOverUTTPException, eObjectKeyMustBeString,
                    "JSON-over-UTTP: Invalid object key type");
        }
    return true;
}
开发者ID:DmitrySigaev,项目名称:ncbi,代码行数:20,代码来源:json_over_uttp.cpp


示例4: switch

CObjectOStream* CObjectOStream::Open(ESerialDataFormat format,
                                     CNcbiOstream& outStream,
                                     bool bdeleteStream)
{
    EOwnership deleteStream = bdeleteStream ? eTakeOwnership : eNoOwnership;
    switch ( format ) {
    case eSerial_AsnText:
        return OpenObjectOStreamAsn(outStream, deleteStream);
    case eSerial_AsnBinary:
        return OpenObjectOStreamAsnBinary(outStream, deleteStream);
    case eSerial_Xml:
        return OpenObjectOStreamXml(outStream, deleteStream);
    case eSerial_Json:
        return OpenObjectOStreamJson(outStream, deleteStream);
    default:
        break;
    }
    NCBI_THROW(CSerialException,eNotImplemented,
               "CObjectOStream::Open: unsupported format");
}
开发者ID:svn2github,项目名称:ncbi_tk,代码行数:20,代码来源:objostr.cpp


示例5: NCBI_THROW

CAsnCache_DataLoader::SCacheInfo& CAsnCache_DataLoader::x_GetIndex()
{
    if (m_IndexMap.empty()) {
        NCBI_THROW(CException, eUnknown,
                   "setup failure: no cache objects available");
    }

    CFastMutexGuard LOCK(m_Mutex);

    // hash to a pool of cache objects based on thread ID
    int id = CThread::GetSelf();
    id %= m_IndexMap.size();

    TIndexMap::iterator iter = m_IndexMap.begin() + id;
    if ( !iter->get() ) {
        iter->reset(new SCacheInfo);
        (*iter)->cache.Reset(new CAsnCache(m_DbPath));
    }
    return **iter;
}
开发者ID:svn2github,项目名称:ncbi_tk,代码行数:20,代码来源:asn_cache_loader.cpp


示例6: conf

CNetScheduleAPI CNetScheduleClientFactory::CreateInstance()
{
    CConfig conf(m_Registry);
    const CConfig::TParamTree* param_tree = conf.GetTree();
    const TPluginManagerParamTree* netschedule_tree =
        param_tree->FindSubNode(kNetScheduleAPIDriverName);

    if (netschedule_tree) {
        SNetScheduleAPIImpl* ret = m_PM_NetSchedule.CreateInstance(
                                       kNetScheduleAPIDriverName,
                                       TPMNetSchedule::GetDefaultDrvVers(),
                                       netschedule_tree);

        if (ret != NULL)
            return ret;
    }

    NCBI_THROW(CNSClientFactoryException, eNSClientIsNotCreated,
               "Couldn't create NetSchedule client. Check registry.");
}
开发者ID:swuecho,项目名称:igblast,代码行数:20,代码来源:ns_client_factory.cpp


示例7: NCBI_THROW

void CJsonOverUTTPWriter::SendOutputBuffer()
{
    const char* output_buffer;
    size_t output_buffer_size;
    size_t bytes_written;

    do {
        m_UTTPWriter.GetOutputBuffer(&output_buffer, &output_buffer_size);
        for (;;) {
            if (m_Pipe.Write(output_buffer, output_buffer_size,
                    &bytes_written) != eIO_Success) {
                NCBI_THROW(CIOException, eWrite,
                    "Error while writing to the pipe");
            }
            if (bytes_written == output_buffer_size)
                break;
            output_buffer += bytes_written;
            output_buffer_size -= bytes_written;
        }
    } while (m_UTTPWriter.NextOutputBuffer());
}
开发者ID:jackgopack4,项目名称:pico-blast,代码行数:21,代码来源:json_over_uttp.cpp


示例8: NCBI_THROW

TMemberIndex
CChoicePointerTypeInfo::GetPtrIndex(const CChoiceTypeInfo* choiceType,
                                    TConstObjectPtr choicePtr)
{
    const CChoicePointerTypeInfo* choicePtrType = 
        CTypeConverter<CChoicePointerTypeInfo>::SafeCast(choiceType);

    const CPointerTypeInfo* ptrType = choicePtrType->m_PointerTypeInfo;
    TConstObjectPtr classPtr = ptrType->GetObjectPointer(choicePtr);
    if ( !classPtr )
        return choicePtrType->m_NullPointerIndex;
    const CClassTypeInfo* classType =
        CTypeConverter<CClassTypeInfo>::SafeCast(ptrType->GetPointedType());
    const TVariantsByType& variants = choicePtrType->m_VariantsByType;
    TVariantsByType::const_iterator v =
        variants.find(classType->GetCPlusPlusTypeInfo(classPtr));
    if ( v == variants.end() )
        NCBI_THROW(CSerialException,eInvalidData,
                   "incompatible CChoicePointerTypeInfo type");
    return v->second;
}
开发者ID:swuecho,项目名称:igblast,代码行数:21,代码来源:choiceptr.cpp


示例9: ConnNetInfo_Create

void CBlastHitMatrixCGIApplication::x_GetSeqAnnot(CCgiContext& ctx)
{
        const CNcbiRegistry & reg = ctx.GetConfig();
        string blastURL = reg.Get("NetParams", "BlastURL");
        string url = (string)blastURL + "?CMD=Get&RID=" + m_RID + "&FORMAT_TYPE=ASN.1&FORMAT_OBJECT=Alignment";
        
        SConnNetInfo* net_info = ConnNetInfo_Create(NULL);
        // create HTTP connection
        CConn_HttpStream inHttp(url,net_info);   

        try {
            m_Annot.Reset(new CSeq_annot);
            auto_ptr<CObjectIStream> is
                    (CObjectIStream::Open(eSerial_AsnText, inHttp));
            *is >> *m_Annot;                                    
        }
         catch (CException& e) {
              m_Annot.Reset();              
              NCBI_THROW(CBlastHitMatrixCGIException, eInvalidSeqAnnot, "Exception reading SeqAnnot via url " + url + ", exception message: " + e.GetMsg());              
        }               
}
开发者ID:jackgopack4,项目名称:pico-blast,代码行数:21,代码来源:cgi_hit_matrix.cpp


示例10: NCBI_THROW

int CSeqDB::GetAmbigSeqAlloc(int             oid,
                             char         ** buffer,
                             int             nucl_code,
                             ESeqDBAllocType strategy,
                             TSequenceRanges *masks) const
{
    m_Impl->Verify();

    if ((strategy != eMalloc) && (strategy != eNew))
    {
        NCBI_THROW(CSeqDBException,
                   eArgErr,
                   "Invalid allocation strategy specified.");
    }

    int rv = m_Impl->GetAmbigSeq(oid, buffer, nucl_code, 0, strategy, masks);

    m_Impl->Verify();

    return rv;
}
开发者ID:Yeyke,项目名称:H-BLAST,代码行数:21,代码来源:seqdb.cpp


示例11: ds

char* CDelta_ext_PackTarget::NewSegment(CSeqUtil::TCoding coding,
                                        TSeqPos length)
{
    CRef<CDelta_seq> ds(new CDelta_seq);
    CSeq_literal&    lit = ds->SetLiteral();
    lit.SetLength(length);
    m_Obj.Set().push_back(ds);

    switch (coding) {
    case CSeqUtil::e_not_set:
        return NULL;

#define CODING_CASE_EX(key, type, setter, len) \
    case CSeqUtil::key: \
    { \
        type& dest = lit.SetSeq_data().setter(); \
        dest.Set().resize(len); \
        return &dest.Set()[0]; \
    }
#define CODING_CASE(name, type) \
    CODING_CASE_EX(e_##name, type, Set##name, length)

    CODING_CASE_EX(e_Ncbi2na, CNCBI2na, SetNcbi2na, (length + 3) / 4)
    CODING_CASE_EX(e_Ncbi4na, CNCBI4na, SetNcbi4na, (length + 1) / 2)

    // case CSeqUtil::e_Ncbi4na_expand:
    // CODING_CASE(Ncbi8na, CNCBI8na)

    CODING_CASE(Iupacaa,   CIUPACaa)
    CODING_CASE(Ncbi8aa,   CNCBI8aa)
    CODING_CASE(Ncbieaa,   CNCBIeaa)
    CODING_CASE(Ncbistdaa, CNCBIstdaa)
#undef CODING_CASE
#undef CODING_CASE_EX

    default:
        NCBI_THROW(CSeqUtilException, eInvalidCoding,
                   "CDelta_ext_PackTarget: unexpected coding");
    }        
}
开发者ID:svn2github,项目名称:ncbi_tk,代码行数:40,代码来源:Delta_ext.cpp


示例12: x_GetCGIContextParams

int CBlastHitMatrixCGIApplication::ProcessRequest(CCgiContext &ctx)
{
    // retrieve our CGI rendering params
    x_GetCGIContextParams(ctx);            
    x_InitAppData(ctx);        
        
    bool success = true;       
    if(m_BlastHitMatrix->IsFileOut()) {
        success = m_BlastHitMatrix->WriteToFile();
    }
    else {        
        string encoding("image/png");
        CCgiResponse& response = ctx.GetResponse();
        response.SetContentType(encoding);
        response.WriteHeader();        
        success = m_BlastHitMatrix->Display(response.out());
    }
    if(!success) {
        NCBI_THROW(CBlastHitMatrixCGIException, eImageRenderError, "Exception occured, exception message: " + m_BlastHitMatrix->GetErrorMessage()); 
    }
    return 0;
}
开发者ID:jackgopack4,项目名称:pico-blast,代码行数:22,代码来源:cgi_hit_matrix.cpp


示例13: ValidateAsmAccession

CRef<CGC_Assembly> CGenomicCollectionsService::GetAssembly(const string& acc_, const string& mode)
{
    string acc = NStr::TruncateSpaces(acc_);
    ValidateAsmAccession(acc);

    CGCClient_GetAssemblyBlobRequest req;
    CGCClientResponse reply;

    req.SetAccession(acc);
    req.SetMode(mode);

    LogRequest(req);

    try {
        return CCachedAssembly(AskGet_assembly_blob(req, &reply)).Assembly();
    } catch (CException& ex) {
        if(reply.IsSrvr_error()) {
            NCBI_THROW(CException, eUnknown, reply.GetSrvr_error().GetDescription());
        }
        throw;
    }
}
开发者ID:svn2github,项目名称:ncbi_tk,代码行数:22,代码来源:genomic_collections_cli.cpp


示例14: m_strGi2GeneFile

CGeneInfoFileReader::CGeneInfoFileReader(const string& strGi2GeneFile,
                                         const string& strGene2OffsetFile,
                                         const string& strGi2OffsetFile,
                                         const string& strAllGeneDataFile,
                                         const string& strGene2GiFile,
                                         bool bGiToOffsetLookup)
    : m_strGi2GeneFile(strGi2GeneFile),
      m_strGene2OffsetFile(strGene2OffsetFile),
      m_strGi2OffsetFile(strGi2OffsetFile),
      m_strGene2GiFile(strGene2GiFile),
      m_strAllGeneDataFile(strAllGeneDataFile),
      m_bGiToOffsetLookup(bGiToOffsetLookup)
{
    if (!OpenBinaryInputFile(m_strAllGeneDataFile, m_inAllData))
    {
        NCBI_THROW(CGeneInfoException, eFileNotFoundError,
            "Cannot open the Gene Data file for reading: " +
            m_strAllGeneDataFile);
    }

    x_MapMemFiles();
}
开发者ID:swuecho,项目名称:igblast,代码行数:22,代码来源:gene_info_reader.cpp


示例15: _ASSERT

void CSeqVector_CI::x_PrevCacheSeg()
{
    _ASSERT(m_SeqMap);
    TSeqPos pos = x_CachePos();
    if ( pos-- == 0 ) {
        // Can not go further
        NCBI_THROW(CSeqVectorException, eOutOfRange,
                   "Can not update cache: iterator beyond start");
    }
    TSeqPos size = x_GetSize();
    // save current cache in backup
    x_SwapCache();
    // update segment if needed
    if ( m_Seg.IsInvalid() ) {
        x_InitSeg(pos);
    }
    else {
        while ( m_Seg && m_Seg.GetPosition() > pos ) {
            x_DecSeg();
        }
    }
    if ( !m_Seg ) {
        NCBI_THROW_FMT(CSeqVectorException, eDataError,
                       "CSeqVector_CI: invalid sequence length: "
                       <<pos<<" <> "<<size);
    }
    // Try to re-use backup cache
    if ( pos >= x_CachePos()  &&  pos < x_CacheEndPos() ) {
        m_Cache = m_CacheData.get() + pos - x_CachePos();
    }
    else {
        // can not use backup cache
        x_ResetCache();
        x_UpdateCacheDown(pos);
        _ASSERT(GetPos() == pos);
        _ASSERT(x_CacheSize());
        _ASSERT(x_CacheEndPos() == pos+1);
    }
}
开发者ID:swuecho,项目名称:igblast,代码行数:39,代码来源:seq_vector_ci.cpp


示例16: switch

BEGIN_NCBI_SCOPE

BEGIN_objects_SCOPE // namespace ncbi::objects::

// constructor
CSeq_data::CSeq_data(const string& value, E_Choice index)
{


    // Does value have to be validated
    // create seq type data holder
    switch (index) {
    case e_Iupacna:
    case e_Iupacaa:
    case e_Ncbieaa:
        DoConstruct (value, index);
        break;

    case e_Ncbi2na:
    case e_Ncbi4na:
    case e_Ncbi8na:
    case e_Ncbipna:
    case e_Ncbi8aa:
    case e_Ncbipaa:
    case e_Ncbistdaa:
    {
        vector< char > v;
        v.resize (value.size());
        memcpy(&v[0], value.c_str(), value.size());
        DoConstruct (v, index);
        break;
    }
    default:
        // throw error
        NCBI_THROW (CException, eUnknown,
            "CSeq_data constructor: Invalid E_Choice index");
    }
}
开发者ID:svn2github,项目名称:ncbi_tk,代码行数:38,代码来源:Seq_data.cpp


示例17: dbmeta

string
CBlastDbFormatter::Write(const SSeqDBInitInfo& db_init_info)
{
    CBlastDbMetadata dbmeta(db_init_info);
    vector<string> data2write;
    data2write.reserve(m_ReplacementTypes.size());
    ITERATE(vector<char>, fmt, m_ReplacementTypes) {
        switch (*fmt) {
        case 'f':   // file name
            data2write.push_back(dbmeta.GetFileName());
            break;
        case 't':   // title
            data2write.push_back(dbmeta.GetTitle());
            break;
        case 'n':   // number of sequences
            data2write.push_back(dbmeta.GetNumberOfSequences());
            break;
        case 'l':   // DB length
            data2write.push_back(dbmeta.GetDbLength());
            break;
        case 'p':   // molecule type
            data2write.push_back(dbmeta.GetMoleculeType());
            break;
        case 'd':   // date of last update
            data2write.push_back(dbmeta.GetDate());
            break;
        case 'U':   // Disk usage
            data2write.push_back(dbmeta.GetDiskUsage());
            break;
        default:
            CNcbiOstrstream os;
            os << "Unrecognized format specification: '%" << *fmt << "'";
            NCBI_THROW(CInvalidDataException, eInvalidInput, 
                       CNcbiOstrstreamToString(os));
        }
    }
    return x_Replacer(data2write);
}
开发者ID:svn2github,项目名称:ncbi_tk,代码行数:38,代码来源:blastdb_formatter.cpp


示例18: LOCK

void CPIDGuard::Release(void)
{
    if ( !m_Path.empty() ) {
        // MT-Safe protect
        CFastMutexGuard LOCK(s_PidGuardMutex);

        // Read info
        TPid pid = 0;
        unsigned int ref = 0;
        CNcbiIfstream in(m_Path.c_str());
        if ( in.good() ) {
            in >> pid >> ref;
            in.close();
            if ( m_NewPID != pid ) {
                // We do not own this file more
                return;
            }
            if ( ref ) {
                ref--;
            }
            // Check reference counter
            if ( ref ) {
                // Write updated reference counter into the file
                CNcbiOfstream out(m_Path.c_str(),
                                  IOS_BASE::out | IOS_BASE::trunc);
                if ( out.good() ) {
                    out << pid << endl << ref << endl;
                }
                if ( !out.good() ) {
                    NCBI_THROW(CPIDGuardException, eWrite,
                               "Unable to write into PID file " + m_Path +": "
                               + _T_CSTRING(NcbiSys_strerror(errno)));
                }
            } else {
                // Remove the file
                CDirEntry(m_Path).Remove();
            }
        }
开发者ID:timothyjlaurent,项目名称:nacl_blast,代码行数:38,代码来源:ncbi_process.cpp


示例19: Tokenize

    ERR_Action Tokenize(const CTempString    raw_line,
                        vector<CTempString>& tokens)
    {
        if (!m_FieldNamesExtracted) {
            x_ExtractNames(raw_line);
            return eRR_Skip;
        }

        // The field names have been extracted so tokenize and check the data
        // consistency.
        // Note: the only action Tokenize() returns is eRR_Continue_Data
        TRowReaderStream_SingleTabDelimited::Tokenize(raw_line, tokens);

        if (tokens.size() != m_NumberOfFields)
            NCBI_THROW(CCRowReaderStream_IANA_TSV_Exception,
                       eNumberOfFieldsMismatch,
                       "Unexpected number of fields. The first line declared "
                       + NStr::NumericToString(m_NumberOfFields) +
                       "fields while the current line has " +
                       NStr::NumericToString(tokens.size()) + " fields");

        return eRR_Continue_Data;
    }
开发者ID:svn2github,项目名称:ncbi_tk,代码行数:23,代码来源:row_reader_iana_tsv.hpp


示例20: SeqDB_CombineAndQuote

CSeqDB::CSeqDB(const vector<string> & dbs,
               ESeqType               seqtype,
               CSeqDBGiList         * gi_list)
{
    string dbname;
    SeqDB_CombineAndQuote(dbs, dbname);

    if (dbname.size() == 0)
    {
        NCBI_THROW(CSeqDBException,
                   eArgErr,
                   "Database name is required.");
    }

    m_Impl = s_SeqDBInit(dbname,
                         s_GetSeqTypeChar(seqtype),
                         0,
                         0,
                         true,
                         gi_list);

    m_Impl->Verify();
}
开发者ID:Yeyke,项目名称:H-BLAST,代码行数:23,代码来源:seqdb.cpp



注:本文中的NCBI_THROW函数示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
C++ NCONF_free函数代码示例发布时间:2022-05-30
下一篇:
C++ NBITS函数代码示例发布时间:2022-05-30
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap