[h323plus] [Opalvoip-devel] [Openh323gk-developer] Question about new ASN compiler
Robert Jongbloed
robert.jongbloed at bigpond.com
Mon Nov 5 17:22:26 EST 2007
> -----Original Message-----
> From: opalvoip-devel-bounces at lists.sourceforge.net [mailto:opalvoip-
> devel-bounces at lists.sourceforge.net] On Behalf Of Jan Willamowius
....
> a smaller memory foot print would of course be nice, but the current
> size isn't much of a problem for GnuGk. I'd have to take see some
> examples of the new interface to get a clearer picture, but I would
> guess GnuGk would be hit pretty hard by those changes since GnuGk
> doesn't use much of the framework hiding the ASN classes. Thus I'd
> prefer to keep the old parser.
The changes are fairly mechanical, though just too difficult to completely
automate as an awk script. Essentially you have code like:
obj.m_field = value;
is changed to
obj.set_field(value);
and
obj.SetTag(H245_Blah::e_BlahChoice);
H245_BlahsChoice & blah = obj;
becomes
H245_BlahsChoice & blah = obj.select_BlahChoice();
At run time, the only semantic different is that optional fields that are
absent from the encoding have no default value. So for something like:
Blah :: SEQUENCE
{
field1 INTEGER
field2 INTEGER OPTIONAL
}
We might have had in the past:
if (obj.m_field2 != 0)
and assumed a default value of the field2 was not encoded. Now if this code
is changed to:
if (obj.get_field2() != 0)
it will assert, it has to be:
if (obj.field2_isSelected() && obj.get_field2() != 0)
P.S. I have actually done this conversion once before, it's a relatively big
job, but 99.9% of the errors were picked up by the compiler.
Robert Jongbloed
OPAL/OpenH323 Architect and Co-founder.
More information about the h323plus
mailing list