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


C++ CObjectIStream类代码示例

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


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

示例1: ReadObject

void COffsetReadHook::ReadObject(CObjectIStream &in, 
                                 const CObjectInfo &object)
{
    CCallStackGuard guard(m_Sniffer->m_CallStack, object);
    
    if (m_EventMode == CObjectsSniffer::eCallAlways) {

        // Clear the discard flag before calling sniffer's event reactors
        m_Sniffer->SetDiscardCurrObject(false);

        m_Sniffer->OnObjectFoundPre(object, in.GetStreamPos());
     
        DefaultRead(in, object);

        m_Sniffer->OnObjectFoundPost(object);

        // Relay discard flag to the stream
        bool discard = m_Sniffer->GetDiscardCurrObject();
        in.SetDiscardCurrObject(discard);
    }
    else {
        if (m_EventMode == CObjectsSniffer::eSkipObject) {
            DefaultSkip(in, object);
        }
        else {
            DefaultRead(in, object);
        }
    }
}
开发者ID:swuecho,项目名称:igblast,代码行数:29,代码来源:obj_sniff.cpp

示例2: Serial_FilterSkip

bool Serial_FilterSkip(CObjectIStream& in, const CObjectTypeInfo& ctype)
{
    if (!in.EndOfData()) {
        in.Skip(ctype);
        return true;
    }
    return false;
}
开发者ID:svn2github,项目名称:ncbi_tk,代码行数:8,代码来源:serial.cpp

示例3: Read

 static void Read(CObjectIStream& in, TTypeInfo ,
                  TObjectPtr objectPtr)
     {
         if ( objectPtr != 0 ) {
             in.ThrowError(in.fInvalidData,
                 "non-null value when reading NULL member");
         }
         in.ReadNull();
     }
开发者ID:swuecho,项目名称:igblast,代码行数:9,代码来源:choiceptr.cpp

示例4: SkipChoiceDefault

void CChoiceTypeInfoFunctions::SkipChoiceDefault(CObjectIStream& in,
        TTypeInfo objectType)
{
    const CChoiceTypeInfo* choiceType =
        CTypeConverter<CChoiceTypeInfo>::SafeCast(objectType);
    BEGIN_OBJECT_FRAME_OF2(in, eFrameChoice, choiceType);
    in.BeginChoice(choiceType);
    BEGIN_OBJECT_FRAME_OF(in, eFrameChoiceVariant);
    TMemberIndex index = in.BeginChoiceVariant(choiceType);
    if ( index == kInvalidMember )
        in.ThrowError(in.fFormatError,"choice variant id expected");
    const CVariantInfo* variantInfo = choiceType->GetVariantInfo(index);
    if (variantInfo->GetId().IsAttlist()) {
        const CMemberInfo* memberInfo =
            dynamic_cast<const CMemberInfo*>(
                choiceType->GetVariants().GetItemInfo(index));
        memberInfo->SkipMember(in);
        in.EndChoiceVariant();
        index = in.BeginChoiceVariant(choiceType);
        if ( index == kInvalidMember )
            in.ThrowError(in.fFormatError,"choice variant id expected");
        variantInfo = choiceType->GetVariantInfo(index);
    }

    in.SetTopMemberId(variantInfo->GetId());

    variantInfo->SkipVariant(in);

    in.EndChoiceVariant();
    END_OBJECT_FRAME_OF(in);
    in.EndChoice();
    END_OBJECT_FRAME_OF(in);
}
开发者ID:,项目名称:,代码行数:33,代码来源:

示例5: SkipClassMember

    virtual void SkipClassMember(CObjectIStream& in,
                                 const CObjectTypeInfoMI& passed_info)
    {
        cout << in.GetStackPath() << endl;
#if 1
        DefaultSkip(in, passed_info);
#else
// get information about the member
        // typeinfo of the parent class (Bioseq)
        CObjectTypeInfo oti = passed_info.GetClassType();
        // typeinfo of the member  (SET OF Seq-annot)
        CObjectTypeInfo omti = passed_info.GetMemberType();
        // index of the member in parent class  (4)
        TMemberIndex mi = passed_info.GetMemberIndex();
        // information about the member, including its name (annot)
        const CMemberInfo* minfo = passed_info.GetMemberInfo();
#if 1
// or read the whole SET OF Seq-annot at once
        CObjectInfo oi(passed_info);
        DefaultRead(in, oi);
        cout << MSerial_AsnText << oi << endl;
#endif

#if 0
// or read CSeq_annot objects one by one and write them into stdout
        unique_ptr<CObjectOStream> out(CObjectOStream::Open(eSerial_AsnText, "stdout", eSerial_StdWhenStd));
        COStreamContainer o(*out, passed_info);
        for ( CIStreamContainerIterator i(in, passed_info); i; ++i ) {
            CSeq_annot annot;
            i >> annot;
// NOTE: this does not produce well formed text ASN, because of missing typeinfo name
// this would work though if we copied data into existing ASN stream
// where typeinfo name ("file header") is not required
            o << annot;
// if we needed well formed text ASN, we could write it like this:
//            cout << MSerial_AsnText << annot;
        }
#endif
#if 0
// or read the whole SET OF Seq-annot at once
        CBioseq::TAnnot annot;
        CObjectInfo oi(&annot, passed_info.GetMemberType().GetTypeInfo());
        in.ReadObject(oi);
        // write them one by one
        for( const auto& e: annot) {
            cout << MSerial_AsnText << *e << endl;
        }
        // or write them all at once
        unique_ptr<CObjectOStream> out(CObjectOStream::Open(eSerial_AsnText, "stdout", eSerial_StdWhenStd));
        out->WriteObject(oi);
#endif
#endif
    }
开发者ID:svn2github,项目名称:ncbi_tk,代码行数:53,代码来源:hooks_skip_member.cpp

示例6: SkipAliasDefault

void CAliasTypeInfoFunctions::SkipAliasDefault(CObjectIStream& in,
                                               TTypeInfo objectType)
{
    const CAliasTypeInfo* aliasType =
        CTypeConverter<CAliasTypeInfo>::SafeCast(objectType);
    in.SkipAlias(aliasType);
}
开发者ID:,项目名称:,代码行数:7,代码来源:

示例7: GetParentObjectPtr

TObjectPtr CType_Base::GetParentObjectPtr(CObjectIStream& in,
                                          TTypeInfo typeInfo,
                                          size_t max_depth,
                                          size_t min_depth)
{
    return in.GetParentObjectPtr(typeInfo, max_depth, min_depth);
}
开发者ID:swuecho,项目名称:igblast,代码行数:7,代码来源:iterator.cpp

示例8: SetLocalSkipHook

void CTypeInfo::SetLocalSkipHook(CObjectIStream& stream,
                                 CSkipObjectHook* hook)
{
    CMutexGuard guard(GetTypeInfoMutex());
    m_SkipHookData.SetLocalHook(stream.m_ObjectSkipHookKey, hook);
    stream.AddMonitorType(this);
}
开发者ID:,项目名称:,代码行数:7,代码来源:

示例9: SkipChoiceSimple

void CChoiceTypeInfoFunctions::SkipChoiceSimple(CObjectIStream& in,
        TTypeInfo objectType)
{
    const CChoiceTypeInfo* choiceType =
        CTypeConverter<CChoiceTypeInfo>::SafeCast(objectType);
    in.SkipChoiceSimple(choiceType);
}
开发者ID:,项目名称:,代码行数:7,代码来源:

示例10: if

//  --------------------------------------------------------------------------
CObjectIStream* CAsn2FastaApp::x_OpenIStream(const CArgs& args)
//  --------------------------------------------------------------------------
{

    // determine the file serialization format.
    // default for batch files is binary, otherwise text.
    ESerialDataFormat serial = args["batch"] ? eSerial_AsnBinary :eSerial_AsnText;
    if ( args["serial"] ) {
        const string& val = args["serial"].AsString();
        if ( val == "text" ) {
            serial = eSerial_AsnText;
        } else if ( val == "binary" ) {
            serial = eSerial_AsnBinary;
        } else if ( val == "XML" ) {
            serial = eSerial_Xml;
        }
    }

    // make sure of the underlying input stream. If -i was given on the command line
    // then the input comes from a file. Otherwise, it comes from stdin:
    CNcbiIstream* pInputStream = &NcbiCin;
    bool bDeleteOnClose = false;
    if ( args["i"] ) {
        pInputStream = new CNcbiIfstream( args["i"].AsString().c_str(), ios::binary  );
        bDeleteOnClose = true;
    }

    // if -c was specified then wrap the input stream into a gzip decompressor before
    // turning it into an object stream:
    CObjectIStream* pI = 0;
    if ( args["c"] ) {
        CZipStreamDecompressor* pDecompressor = new CZipStreamDecompressor(
            512, 512, kZlibDefaultWbits, CZipCompression::fCheckFileHeader );
        CCompressionIStream* pUnzipStream = new CCompressionIStream(
            *pInputStream, pDecompressor, CCompressionIStream::fOwnProcessor );
        pI = CObjectIStream::Open( serial, *pUnzipStream, eTakeOwnership );
    }
    else {
        pI = CObjectIStream::Open( 
            serial, *pInputStream, (bDeleteOnClose ? eTakeOwnership : eNoOwnership));
    }

    if ( 0 != pI ) {
        pI->UseMemoryPool();
    }
    return pI;
}
开发者ID:jackgopack4,项目名称:pico-blast,代码行数:48,代码来源:asn2fasta.cpp

示例11: SkipPointer

void CPointerTypeInfo::SkipPointer(CObjectIStream& in,
                                   TTypeInfo objectType)
{
    const CPointerTypeInfo* pointerType =
        CTypeConverter<CPointerTypeInfo>::SafeCast(objectType);

    in.SkipPointer(pointerType->GetPointedType());
}
开发者ID:swuecho,项目名称:igblast,代码行数:8,代码来源:ptrinfo.cpp

示例12: ReadAliasDefault

void CAliasTypeInfoFunctions::ReadAliasDefault(CObjectIStream& in,
                                               TTypeInfo objectType,
                                               TObjectPtr objectPtr)
{
    const CAliasTypeInfo* aliasType =
        CTypeConverter<CAliasTypeInfo>::SafeCast(objectType);
    in.ReadAlias(aliasType, objectPtr);
}
开发者ID:,项目名称:,代码行数:8,代码来源:

示例13: ReadChoiceSimple

void CChoiceTypeInfoFunctions::ReadChoiceSimple(CObjectIStream& in,
        TTypeInfo objectType,
        TObjectPtr objectPtr)
{
    const CChoiceTypeInfo* choiceType =
        CTypeConverter<CChoiceTypeInfo>::SafeCast(objectType);
    in.ReadChoiceSimple(choiceType, objectPtr);
}
开发者ID:,项目名称:,代码行数:8,代码来源:

示例14: SkipContainer

void CContainerTypeInfo::SkipContainer(CObjectIStream& in,
                                       TTypeInfo objectType)
{
    const CContainerTypeInfo* containerType =
        CTypeConverter<CContainerTypeInfo>::SafeCast(objectType);

    in.SkipContainer(containerType);
}
开发者ID:svn2github,项目名称:ncbi_tk,代码行数:8,代码来源:continfo.cpp

示例15: ReadPointer

void CPointerTypeInfo::ReadPointer(CObjectIStream& in,
                                   TTypeInfo objectType,
                                   TObjectPtr objectPtr)
{
    const CPointerTypeInfo* pointerType =
        CTypeConverter<CPointerTypeInfo>::SafeCast(objectType);

    TTypeInfo pointedType = pointerType->GetPointedType();
    TObjectPtr pointedPtr = pointerType->GetObjectPointer(objectPtr);
    if ( pointedPtr ) {
        //pointedType->SetDefault(pointedPtr);
        in.ReadObject(pointedPtr, pointedType);
    }
    else {
        pointerType->SetObjectPointer(objectPtr,
                                      in.ReadPointer(pointedType).first);
    }
}
开发者ID:swuecho,项目名称:igblast,代码行数:18,代码来源:ptrinfo.cpp


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