Exemplo n.º 1
0
    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
    }
Exemplo n.º 2
0
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);
    }
}
Exemplo n.º 3
0
    virtual void SkipChoiceVariant(CObjectIStream& in,
                                   const CObjectTypeInfoCV& passed_info)
    {
        cout << in.GetStackPath() << endl;
#if 1
        DefaultSkip(in, passed_info);

#else
// get information about the variant
        // typeinfo of the parent class (Seq-annot.data)
        CObjectTypeInfo oti = passed_info.GetChoiceType();
        // typeinfo of the variant  (SET OF Seq-feat)
        CObjectTypeInfo omti = passed_info.GetVariantType();
        // index of the variant in parent class  (1)
        TMemberIndex mi = passed_info.GetVariantIndex();
        // information about the variant, including its name (ftable)
        const CVariantInfo* minfo = passed_info.GetVariantInfo();

#if 1
// or read the whole SET OF Seq-feat at once
        CObjectInfo oi(passed_info);
        DefaultRead(in, oi);
        cout << MSerial_AsnText << oi << endl;
#endif
#if 0
// or read CSeq_feat objects one by one
        for ( CIStreamContainerIterator i(in, passed_info.GetVariantType()); i; ++i ) {
            CSeq_feat feat;
            i >> feat;
            cout << MSerial_AsnText << feat << endl;
        }
#endif
#if 0
// or read CSeq_feat 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.GetVariantType());
        for ( CIStreamContainerIterator i(in, passed_info.GetVariantType()); i; ++i ) {
            CSeq_feat feat;
            i >> feat;
// 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 << feat;
// if we needed well formed text ASN, we could write it like this:
            cout << MSerial_AsnText << feat;
        }
#endif
#if 0
// or read the whole SET OF Seq-feat at once
        CSeq_annot::TData::TFtable ft;
        CObjectInfo oi(&ft, passed_info.GetVariantType().GetTypeInfo());
        // or, like this:
        //  CObjectInfo oi(passed_info.GetVariantType());
        in.ReadObject(oi);
        // write them one by one
        for( const auto& e: ft) {
            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
    }