Re: SetData & ContentRef

Emmanuel BEUQUE (ebeuque@pratique.fr)
Fri, 23 Jan 1998 10:24:30 +0100

À (At) 16:00 +0100 22/01/98, Andreas Kraft écrivait (wrote) :
>> It's true that this kind of problem could be easily solved if there were
>> more variable type conversions allowed. Currently, there is only Integer
>> <-> OctetString conversions in MHEG-5 through the SetVariable action. It
>> would be interesting to have more such as OctetString <-> ContentRef but
>> why not others like Integer -> Boolean or Integer <-> ObjectRef and so on
>> for any conversion that could be useful.
>
>I see no problems with OctetString<->ContentRef because internaly the
>ContentReference is only an OctetString, too (please help me, I can't
>remember the heavy discussions about the conversions anymore...:(.
>With Integer<->Boolean it is a problem: what is the Integer representation
>of the Boolean value?
>What about Integer<->ObjectRef (or OctetString<->ObjectRef)? This is even
>more a problem because you either loose something in the conversion process
>or make assumptions about the format of the ObjectReference.

My idea here is to provide very easy use of any variable like some other
languages do (if condition of C language for instance).
As you stated, some conversions I suggested cannot be bidirectional without
loosing some information. But I think this kind of conversion could be
useful in some cases anyway.

I would suggest the following rules :
Integer->Boolean : 0 is False, any other integer value is True.
Boolean->Integer : False is 0, True is 1

Integer->ObjectRef : Integer is used as the object number within the current
scene, as if the Optional GroupIdentifier was not encoded.
ObjectRef->Integer : The object number part of the objectRef is returned as
its integer value.

OctetString->ObjectRef : Just convert the octetString in objectRef with the
same
rules that are used for MHEG group textual encoding, e.g. the
octetString may contains the GroupIdentifier followed by the
object number. (No problem that I see)
ObjectRef->OctetString : The full object identifier (including optional Group
Identifier) is returned as an OctetString.
This ObjectRef<->OctetString conversion is fully bidirectional without any
loss of information. This actually need to make assumptions about the
format of the ObjectReference but this is not a problem if these
conversions are provided as a set of ResidentPrograms defined by the
application domain because the Application Domain would also define the
ObjectReference format.

This kind of features could even be provided by MHEG without defining the
rules of conversion but letting it to the application domain. That's what
is done for the StorePersistent/ReadPersistent actions for instance.

Examples of use :

Integer->Boolean :
Suppose you want to return a feedback of the state of listGroup. In fact
you want to inform the user if one or several items of a listGroup are
selected. Suppose you manage a counter with 2 links. ItemSelected increment
the counter by one, ItemDeselected decrement it. Then you could convert
this counter value to a boolean and use it to set the Highlight status of
an Interactible.

Integer->ObjectRef
Suppose you have to do some actions to a set of visible, for instance
stopping all the items of a tokenGroup. Suppose the object numbers of this
items are serialized, from 1 to 20 for instance. Then you could do the
following (The syntax is used for readability but is not conformed to MHEG
IS)

SetVariable(counter :GInteger 1)
Activate(Link)
TestVariable(counter <= 20)
Deactivate(Link)

and the Link would be

EventSource: counter
EventType: TestEvent
EventData: TRUE
LinkEffect:
IntegerToObjectRef(counter, ref)
Stop(ref)
Add(counter, 1)
TestVariable(counter <= 20)

A kind of repeat loop in fact...

What do you think ?

__________________________________________________________________
Emmanuel BEUQUE mailto:ebeuque@pratique.fr
MediaServ tel: +33 (0) 2 99 64 35 64
Multimedia consultant & developer fax: +33 (0) 2 99 64 36 65