Hi Heinrich

Yes, you're rigth, the CHOICE option is the best way to go. And my structure is 
quite simple. The problem is my lack of knowledge about ASN.

I'll try with some test messages and see what I get. 

Thanks to all of you for your time.

Best regards

Santiago Conde
Senior Programmer
Kinamik Data Integrity, SL
c/ Diputació 238, Àtic 5ª
08007 Barcelona
Tel. + 34 931 835 814
Fax + 34 933 041 681

-----Original Message-----
From: Heinrich Nirschl [mailto:[email protected]] 
Sent: lunes, 15 de junio de 2009 22:45
To: Santiago Conde
Cc: [email protected]
Subject: Re: [Asn1] PER encoding of java hierarchy

On Mon, Jun 15, 2009 at 11:56 AM, Santiago Conde<[email protected]> wrote:
> Well, right now I don't have any encoded message because I lack the syntax... 
> I've been thinking of writing one mapping for each of the subclasses. This 
> way the ASN description could be something like
>
> DEFINITIONS IMPLICIT TAGS ::= BEGIN
>        ElememtA ::= SEQUENCE {
>                field1 INTEGER,
>                field2 DerivedClassA
>        }
>
>        ElememtB ::= SEQUENCE {
>                field1 INTEGER,
>                field2 DerivedClassB
>        }
>
>        and so on
> END
>
> I guess that this is most compact way of doing it, but it could do the work.
>
> Regarding the compatibility between standard and PER serializations, our 
> plans are not to keep it, that is, all the objects will make use of PER 
> without caring about java deserializing.
>

I would rather use a CHOICE to represent your base class, e.g.

CHOICE {
    derivedA      [0] DerivedClassA,
    derivedB      [1] DerivedClassB

    and so on
}

Your deserializer can use the tag to determine which case applies.

I have the impression from your earlier mails, that the structure you
want to serialize is rather simple. For the general case you would
have to deal with issues like null pointers, cyclic data structures
and different fields pointing to the same object instance.

Best regards,
Heinrich
_______________________________________________
Asn1 mailing list
[email protected]
http://lists.asn1.org/mailman/listinfo/asn1

Reply via email to