Exemplo n.º 1
0
void CReadObjectHook::DefaultRead(CObjectIStream& in,
                                  const CObjectInfo& object)
{
    object.GetTypeInfo()->DefaultReadData(in, object.GetObjectPtr());
}
Exemplo n.º 2
0
void CSkipChoiceVariantHook::DefaultRead(CObjectIStream& in,
                                       const CObjectInfo& object)
{
    object.GetTypeInfo()->DefaultReadData(in, object.GetObjectPtr());
}
Exemplo n.º 3
0
int main(int argc, const char* argv[])
{
    {{
        // set primitive value
        CSeq_id obj;
        CObjectInfo info(ObjectInfo(obj));
        CObjectInfo local(info.SetChoiceVariant(info.FindVariantIndex("local")));
        local.SetChoiceVariant(local.FindVariantIndex("id")).SetPrimitiveValueInt(234);
        cout << MSerial_AsnText << obj;
    }}

    {{
        CSeq_loc obj;
        CObjectInfo info(ObjectInfo(obj));

        // set choice variant
        info.SetChoiceVariant(info.FindVariantIndex("null"));
        cout << MSerial_AsnText << obj;

        // change choice variant
        CObjectInfo seqid(info.SetChoiceVariant(info.FindVariantIndex("empty")));
        CObjectInfo local(seqid.SetChoiceVariant(seqid.FindVariantIndex("local")));
        local.SetChoiceVariant(local.FindVariantIndex("id")).SetPrimitiveValueInt(987);
        cout << MSerial_AsnText << obj;
        
        // there is no way to reset choice variant
        // this does not work:
        //info.SetChoiceVariant(0);
    }}

    {{
        CSeq_id_set obj;
        CObjectInfo info(ObjectInfo(obj));
        // 'implicit' class has one member with no name
        CObjectInfo mem(info.SetClassMember(1));

        // add container element
        CObjectInfo elem(mem.AddNewPointedElement());
        CObjectInfo local(elem.SetChoiceVariant(elem.FindVariantIndex("local")));
        local.SetChoiceVariant(local.FindVariantIndex("id")).SetPrimitiveValueInt(345);

        // add container element
        elem = mem.AddNewPointedElement();
        local = elem.SetChoiceVariant(elem.FindVariantIndex("local"));
        local.SetChoiceVariant(local.FindVariantIndex("str")).SetPrimitiveValueString("345string");

        // add container element
        elem = mem.AddNewPointedElement();
        CObjectInfo prf = elem.SetChoiceVariant(elem.FindVariantIndex("prf"));
        prf.SetClassMember(prf.FindMemberIndex("name")).SetPrimitiveValueString("prfname");
        prf.SetClassMember(prf.FindMemberIndex("release")).SetPrimitiveValueString("prfrelease");
        prf.SetClassMember(prf.FindMemberIndex("version")).SetPrimitiveValueInt(567);

        cout << MSerial_AsnText << obj;

        // unset class member
        // only optional members can be unset
        if (prf.FindClassMember("version").IsSet()) {
            prf.FindClassMember("version").Reset();
        }
        cout << MSerial_AsnText << obj;
    }}

    return 0;
}
Exemplo n.º 4
0
void CSkipClassMemberHook::DefaultRead(CObjectIStream& in,
                                       const CObjectInfo& object)
{
    object.GetTypeInfo()->DefaultReadData(in, object.GetObjectPtr());
}
Exemplo n.º 5
0
void CReadObjectHook::DefaultSkip(CObjectIStream& in,
                                  const CObjectInfo& object)
{
    object.GetTypeInfo()->DefaultSkipData(in);
}