当前位置: 首页>>代码示例>>C++>>正文


C++ NCBI_THROW函数代码示例

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


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


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